This might be overkill. I just thought it would be amusing if darcs had a module just for the English language :-)
Tue Jan 29 16:36:13 GMT 2008 Eric Kow <[EMAIL PROTECTED]> * Add some simple English morphology. Tue Jan 29 16:36:19 GMT 2008 Eric Kow <[EMAIL PROTECTED]> * Refactor SelectChanges English. Tue Jan 29 16:36:33 GMT 2008 Eric Kow <[EMAIL PROTECTED]> * [issue558] Singular 'do you want to revert this change?'
New patches: [Add some simple English morphology. Eric Kow <[EMAIL PROTECTED]>**20080129163613] { hunk ./GNUmakefile 49 ThisVersion.lhs \ CommandLine.lhs \ URL.hs HTTP.hs DateMatcher.lhs \ - Exec.lhs FastPackedString.hs FileName.lhs FileSystem.hs IsoDate.lhs \ + English.lhs Exec.lhs\ + FastPackedString.hs FileName.lhs FileSystem.hs IsoDate.lhs \ Lcs.lhs OldDate.lhs \ Printer.lhs \ RegChars.lhs \ addfile ./src/English.lhs hunk ./src/English.lhs 1 +% Copyright (C) 2008 Eric Kow +% +% This program is free software; you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation; either version 2, or (at your option) +% any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; see the file COPYING. If not, write to +% the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +% Boston, MA 02110-1301, USA. + + +\begin{code} +module English where + +englishNum :: Nounlike n => Int -> n -> ShowS +englishNum x = if x < 2 then singular else plural + +class Nounlike a where + plural :: a -> ShowS + singular :: a -> ShowS + +newtype Noun = Noun String + +instance Nounlike Noun where + plural (Noun "") = id + plural (Noun s) | last s == 'e' = showString s . showChar 's' + plural (Noun s) = showString s . showString "es" + singular (Noun s) = showString s + +data This = This Noun + +instance Nounlike This where + plural (This s) = showString "these " . plural s + singular (This s) = showString "this " . singular s +\end{code} } [Refactor SelectChanges English. Eric Kow <[EMAIL PROTECTED]>**20080129163619] { hunk ./src/Darcs/SelectChanges.lhs 40 import Control.Monad ( when ) import System ( exitWith, ExitCode(ExitSuccess) ) +import English ( Noun(..), englishNum ) import Darcs.Hopefully ( PatchInfoAnd, hopefully, n2pia ) import Darcs.Repository ( Repository, read_repo, read_pending ) import Darcs.Patch ( RepoPatch, Patchy, Prim, summary, commute, hunk ./src/Darcs/SelectChanges.lhs 241 then job $ case whichch of LastReversed -> invert other_ps :> invert ps_to_consider _ -> ps_to_consider :> other_ps else do pc <- without_buffering $ - tentatively_text_select "" jobname ("patch", "patches") whichch + tentatively_text_select "" jobname (Noun "patch") whichch opts ps_len ps_len_calced 0 NilRL init_tps init_pc job $ selected_patches whichch rejected_ps pc where ps_to_consider :> other_ps = p2c ps hunk ./src/Darcs/SelectChanges.lhs 320 do_next_action ja je = tentatively_text_select ja jn je whichch opts n_max n_max_calced (n+1) (tp:<:tps_done) tps_todo' - do_next = do_next_action "" ("patch","patches") + do_next = do_next_action "" (Noun "patch") helper :: PatchChoices p -> p helper = undefined thing = Darcs.Patch.thing (helper pc) hunk ./src/Darcs/SelectChanges.lhs 362 'y' -> do_next $ force_yes (tag tp) pc 'n' -> do_next $ force_no (tag tp) pc 'w' -> do_next $ make_uncertain (tag tp) pc - 's' -> do_next_action "Skipped" ("change","") $ skip_file - 'f' -> do_next_action "Included" ("change","") $ do_file + 's' -> do_next_action "Skipped" (Noun "change") $ skip_file + 'f' -> do_next_action "Included" (Noun "change") $ do_file 'v' -> printPatch viewp >> repeat_this 'p' -> printPatchPager viewp >> repeat_this 'x' -> do putDocLn $ prefix " " $ summary viewp hunk ./src/Darcs/SelectChanges.lhs 472 _ -> do putStrLn $ helpFor jn options repeat_this -tentatively_text_select :: Patchy p => String -> String -> (String,String) -> WhichChanges -> [DarcsFlag] +tentatively_text_select :: Patchy p => String -> String -> Noun -> WhichChanges -> [DarcsFlag] -> Int -> Bool -> Int -> RL (TaggedPatch p) -> FL (TaggedPatch p) -> PatchChoices p -> IO (PatchChoices p) hunk ./src/Darcs/SelectChanges.lhs 489 when (Verbose `elem` opts) $ showskippedpatch skipped where _doing_ = _action_ ++ " " ++ jobname - _with_ = " of " ++ show numSkipped ++ " " ++ _elem_ + _with_ = " of " ++ show numSkipped ++ " " ++ _elem_ "" _action_ = if (length jobaction) == 0 then "Skipped" else jobaction hunk ./src/Darcs/SelectChanges.lhs 491 - _elem_ = if numSkipped == 1 then (fst jobelement) else - if (length $ snd jobelement) == 0 then (fst jobelement ++ "s") else (snd jobelement) + _elem_ = englishNum numSkipped jobelement showskippedpatch (tp:>:tps) = (putDocLn $ prefix " " $ summary (tp_patch tp)) >> showskippedpatch tps showskippedpatch NilFL = return () } [[issue558] Singular 'do you want to revert this change?' Eric Kow <[EMAIL PROTECTED]>**20080129163633] { hunk ./src/Darcs/Commands/Revert.lhs 25 import Control.Monad ( when ) import Data.List ( sort ) +import English (englishNum, This(..), Noun(..)) import Darcs.Commands ( DarcsCommand(..), nodefaults ) import Darcs.Arguments ( DarcsFlag( All, Debug ), ignoretimes, working_repo_dir, hunk ./src/Darcs/Commands/Revert.lhs 42 amInRepository, slurp_recorded_and_unrecorded, ) import Darcs.Patch ( invert, apply_to_filepaths, commute ) -import Darcs.Patch.Ordered ( FL(..), (:>)(..), nullFL, (+>+) ) +import Darcs.Patch.Ordered ( FL(..), (:>)(..), lengthFL, nullFL, (+>+) ) import Darcs.SelectChanges ( with_selected_last_changes_to_files' ) import Darcs.Patch.TouchesFiles ( choose_touching ) import Darcs.Commands.Unrevert ( write_unrevert ) hunk ./src/Darcs/Commands/Revert.lhs 104 then putStrLn $ "If you don't want to revert after all," ++ " that's fine with me!" else do + let theseChanges = englishNum (lengthFL p) . This . Noun $ "change" yorn <- if All `elem` opts then return "y" hunk ./src/Darcs/Commands/Revert.lhs 107 - else askUser "Do you really want to revert these changes? " + else askUser $ "Do you really want to revert " ++ theseChanges "? " case yorn of ('y':_) -> return () _ -> exitWith $ ExitSuccess withGutsOf repository $ do } Context: [ratify use of hGetContents. David Roundy <[EMAIL PROTECTED]>**20080129150247] [Fix curl version check for pipelining. Dmitry Kurochkin <[EMAIL PROTECTED]>**20080128223731] [issue612: regression test demonstrates that hashed and darcs-2 formats resist a certain kind of corruption. Mark Stosberg <[EMAIL PROTECTED]>**20080126031445 (but the old fashioned repo format does not). ] [Remove features not used in parsing patch dates. Eric Kow <[EMAIL PROTECTED]>**20080129092401] [Extract external-merge from {apply,pull} conflict options. [EMAIL PROTECTED] [Don't emit \r when the handle is a terminal. [EMAIL PROTECTED] [Replace unpull by obliterate as much as possible. [EMAIL PROTECTED] [Move rollback to another section of TheCommands. [EMAIL PROTECTED] [give progress output when getting over ssh. David Roundy <[EMAIL PROTECTED]>**20080128222133] [remove progress output that seems too often to be unhelpful. David Roundy <[EMAIL PROTECTED]>**20080128221922] [nicer error message in ssh connection code. David Roundy <[EMAIL PROTECTED]>**20080128221229] [use new ssh connection for copySSHs as well (speed my test up by 20% from the sftp code). David Roundy <[EMAIL PROTECTED]>**20080128220858] [fix bug introduced by rewrite of IsoDate module. David Roundy <[EMAIL PROTECTED]>**20080128220647 The problem was that this module served two functions. One was to allow nice date matching, and the other was to allow parsing of old patches, created before we moved to the simple 20080127... format. I've split the latter function into a separate "frozen" module, so that we can safely develop more friendly date-parsing code. ] [Test infrastructure improvement: Add debug mode to Perl test scripts. Mark Stosberg <[EMAIL PROTECTED]>**20080126154444 Set this to see the output of every 'darcs' call made through this script: DARCS_DEBUG=1 ./bin/prove -v add.pl pull.pl ] [reuse ssh connection using transfer-mode. David Roundy <[EMAIL PROTECTED]>**20080128201613] [try using darcs transfer-mode if available. David Roundy <[EMAIL PROTECTED]>**20080128194406 Note that this doesn't yet gain us any performance, it's just a step towards a faster connection-sharing approach. ] [issue227: regression test for get --context with an absolute path Mark Stosberg <[EMAIL PROTECTED]>**20080126021139] [flush output in transfer-mode. David Roundy <[EMAIL PROTECTED]>**20080128193910] [[issue625] Non-recursive --repodir. Eric Kow <[EMAIL PROTECTED]>**20080128193459] [add transfer-mode for faster ssh access. David Roundy <[EMAIL PROTECTED]>**20080128165256] [refactor SSH code into own module. David Roundy <[EMAIL PROTECTED]>**20080128172658] [remove unneeded export from URL. David Roundy <[EMAIL PROTECTED]>**20080128172534] [Fix optimize_relink for POSIX environment (no cp -a or du -l support; now needs perl) Kevin Quick <[EMAIL PROTECTED]>**20080125220119] [Test Fix: make test pass when there is a space in the darcs repo path Mark Stosberg <[EMAIL PROTECTED]>**20080126170531] [Test Fix: replace system calls with quoted function calls Mark Stosberg <[EMAIL PROTECTED]>**20080126170253] [Test fix: work when darcs repo root has a space in it Mark Stosberg <[EMAIL PROTECTED]>**20080126165818] [replace system call with Perl for better portability Mark Stosberg <[EMAIL PROTECTED]>**20080124013552] [Remove more unneeded "--author" flags in the Perl test scripts, because the harness takes care of them Mark Stosberg <[EMAIL PROTECTED]>**20080120010553] [remove now-unused perl_harness Mark Stosberg <[EMAIL PROTECTED]>**20080120005850] [Merge Curl and Libwww to URL module. Dmitry Kurochkin <[EMAIL PROTECTED]>**20080127182001] [Fix darcs version in libwww user agent. Dmitry Kurochkin <[EMAIL PROTECTED]>**20080127181548] [Cleanup libwww module, better error handling, follow redirects (closes issue621). Dmitry Kurochkin <[EMAIL PROTECTED]>**20080127152710] [Rework libcurl module: use multi interface, support pipelining. Dmitry Kurochkin <[EMAIL PROTECTED]>**20080127151756] [Do not announce recipients in send -O. Eric Kow <[EMAIL PROTECTED]>**20080128151812] [Add ability to see skipped/included patches when verbose flag present. Kevin Quick <[EMAIL PROTECTED]>**20080127190546] [Update patch selection feedback for messages more appropriate to the job being performed. Kevin Quick <[EMAIL PROTECTED]>**20080126035000] [adding File::Temp 0.20 to tree for more consistent test results. It is GPL-licensed. Mark Stosberg <[EMAIL PROTECTED]>**20080124033049] [update restrictive perms test to run a temporary directory and clean up after itself. Mark Stosberg <[EMAIL PROTECTED]>**20080123000417 Running in a tru temporary directory allows the potential to run tests in parallel. ] [ issue602: part 1: Always prefer our private copy of Test::More over the system-wide one for more consistent results Mark Stosberg <[EMAIL PROTECTED]>**20080124005407] [ issue602, part 2: freshen our versions of Test::More and Test::Builder Mark Stosberg <[EMAIL PROTECTED]>**20080123013642] [Test for issue625. Eric Kow <[EMAIL PROTECTED]>**20080128150059] [[issue457] Check match syntax early. Eric Kow <[EMAIL PROTECTED]>**20080128144840] [Add a comment for Real patches. [EMAIL PROTECTED] [beautify remove_subsequenceFL. David Roundy <[EMAIL PROTECTED]>**20080125225637] [beautify remove_subsequenceRL. David Roundy <[EMAIL PROTECTED]>**20080125225440] [we removed --modernize-patches, so remove the test case. David Roundy <[EMAIL PROTECTED]>**20080125225423] [eliminate --modernize-patches and make --uncompress work (issue620) David Roundy <[EMAIL PROTECTED]>**20080125220624] [make hashed repositories respect --dont-compress. David Roundy <[EMAIL PROTECTED]>**20080125210529] [Remove TimeDiff experiment. Eric Kow <[EMAIL PROTECTED]>**20080128115307] [Simplify date matcher and fix tz-related bug. Eric Kow <[EMAIL PROTECTED]>**20080128115214 When matching partial dates, we should not trust the ctYear, etc on the CalendarTime because it may vary by timezone. This also leads to a simplification in the tentative date matching. Note: subtle change in matching. Now all matching is done within a range, excluding the latter date. We check date < end instead of date <= end ] [More aggressive testing of date parser. Eric Kow <[EMAIL PROTECTED]>**20080127164254 Using record --pipe to set patch dates. ] [Support more interactive use of echo_to_darcs in test harness. Eric Kow <[EMAIL PROTECTED]>**20080127164241] [Overhaul date parsing code. Eric Kow <[EMAIL PROTECTED]>**20080127163040 - Add the ability to match on partial ISO 8601 dates, for example, treating 2008-08 as matching the whole month and not just the first day of that month - Fix some bugs in the parsing of fancy English dates - Fix bugs in the interpretation of English dates (for example, the interpretation of '3 days before last week' was for all patches since that date, and not for all patches *on* that date) - Treat user input as being in the local timezone - Make the matching code a bit more compact ] [Make documentation on dates more explicit. Eric Kow <[EMAIL PROTECTED]>**20080127162931] [resolve conflict with Eric on controlMasterPath. David Roundy <[EMAIL PROTECTED]>**20080125203903] [More concise backup warning. Eric Kow <[EMAIL PROTECTED]>**20071105012930] [Remove now obsolete wrapper for Map (we now require GHC >= 6.4). Eric Kow <[EMAIL PROTECTED]>**20071105192636] [Modernise Data.Map import. Eric Kow <[EMAIL PROTECTED]>**20071105192530] [Give ssh CM socket a unique name for each darcs process. Eric Kow <[EMAIL PROTECTED]>**20071105021956 Delete the socket in the unlikely event that a previous darcs had a socket with the same name left over. ] [Create ssh CM socket in $HOME/.darcs if possible. Eric Kow <[EMAIL PROTECTED]>**20071105015525] [Refactor y/n prompts. Eric Kow <[EMAIL PROTECTED]>**20071019213307] [issue578: steve and monica test for rolling back a rollback Mark Stosberg <[EMAIL PROTECTED]>**20080118031606] [eliminate lazy parsing of patches, which gives bad error messages (issue364) David Roundy <[EMAIL PROTECTED]>**20080125191836] [make uniqueoptions.sh test give friendlier output. David Roundy <[EMAIL PROTECTED]>**20080125183430] [fix code to avoid duplicate --verbose in --help (so tests will pass). David Roundy <[EMAIL PROTECTED]>**20080125183420] [update some ChangeLog entries to also credit those who contributed through bug reporting, test writing or feedback. Mark Stosberg <[EMAIL PROTECTED]>**20080122235435] [More error messages for libwww. Dmitry Kurochkin <[EMAIL PROTECTED]>**20080124092600] [issue608: a new test for 'mv', following Zooko's bug report Mark Stosberg <[EMAIL PROTECTED]>**20080124013856] [[issue492] Check that context file actually exists in darcs get. Eric Kow <[EMAIL PROTECTED]>**20080125183741] [[issue227] Platform-independent absolute paths in get --context Eric Kow <[EMAIL PROTECTED]>**20080125181702] [Make verbosity flags advanced options universally. Eric Kow <[EMAIL PROTECTED]>**20080125181005] [report progress in writing the inventory out for hashed repos. David Roundy <[EMAIL PROTECTED]>**20080125172017] [make empty key case of progress reporting fast. David Roundy <[EMAIL PROTECTED]>**20080125171859] [fix issue where we overwrote prompt with progress info. David Roundy <[EMAIL PROTECTED]>**20080125164609] [fix bug where we used show on an exception (and thus printed "User error"). David Roundy <[EMAIL PROTECTED]>**20080125164209 This partially addresses issue168 by improving the error message. ] [add gnulib sha1.c file as a faster sha1 option. David Roundy <[EMAIL PROTECTED]>**20080123212502] [fix embarrassing bug in External. David Roundy <[EMAIL PROTECTED]>**20080125152329 (which demonstrates that I didn't compile before pushing) ] [for now, print progress reports to stdout. David Roundy <[EMAIL PROTECTED]>**20080125152105 My hope is that this will alleviate some of the issues with progress reports overwriting prompts. ] [revamp progress reporting, making it more efficient and adding more output. David Roundy <[EMAIL PROTECTED]>**20080125151540 Note that there is still at least one time sink that remains to be identified. ] [avoid creating darcs-ssh if we aren't using ControlMaster. (issue613) David Roundy <[EMAIL PROTECTED]>**20080125150846] [fix bug where darcs-ssh got even worse name (issue613). David Roundy <[EMAIL PROTECTED]>**20080125150355] [provide more detailed progress reports in HashedIO. David Roundy <[EMAIL PROTECTED]>**20080124145156] [print additional debug data in Progress. David Roundy <[EMAIL PROTECTED]>**20080124145114] [add a few more debug messages in Repository.Internal. David Roundy <[EMAIL PROTECTED]>**20080124144829] [fix incorrect report that we were reading patches. David Roundy <[EMAIL PROTECTED]>**20080124125040] [reenable mandatory sha1 checks, now that we can link with a faster sha1. David Roundy <[EMAIL PROTECTED]>**20080123203104] [remove (broken) git support and add openssl sha1 support. David Roundy <[EMAIL PROTECTED]>**20080123202025 These two changes got merged together as I was introducing the configure.ac changes to support openssl as a sha1 alternative to our Haskell code. (Yes, I'm lazy.) ] [remove redundant hash checks in hashed IO code. David Roundy <[EMAIL PROTECTED]>**20080123173022] [output nicer progress in convert. David Roundy <[EMAIL PROTECTED]>**20080123170428] [output timings when --timings is specified. David Roundy <[EMAIL PROTECTED]>**20080123170314] [remove inaccurate message in convert. David Roundy <[EMAIL PROTECTED]>**20080123170243] [use debugMessage in HashedIO. David Roundy <[EMAIL PROTECTED]>**20080123160835] [add --timings flag (that as yet does nothing). David Roundy <[EMAIL PROTECTED]>**20080123154931] [Major Perl test suite clean-up. Mark Stosberg <[EMAIL PROTECTED]>**20080120035651 The primary purpose of this patch was make sure all the tests are executed in randomly named directories, which allows us to run Perl tests in parallel, without the directory names collided. This isn't enabled by default for "make test", but it is there to play with. In the test directory, you can now do: ./bin/prove -j9 *.pl to run 9 tests in parallel. There is also "--fork" option which should be a win on multi-CPU computers. See "perldoc ./bin/prove" for details. As part of this, a lot of boiler-plate code at the top and bottom of the scripts could be eliminated, and I made few other minor style clean-ups while I had the files open. There should be no functional changes to the tests. ] [Take advantage of new Perl testing infrastructure by eliminating needless --ignore-time mentions Mark Stosberg <[EMAIL PROTECTED]>**20080120005242] [Take advantage of updated Perl testing infrastructure by removing needless author mentions in tests Mark Stosberg <[EMAIL PROTECTED]>**20080120004503] [use --ignore-time in tests instead of "sleep", for faster, more reliable results Mark Stosberg <[EMAIL PROTECTED]>**20080118030241] [Issue395: avoid single letter patch names in the test suite. Mark Stosberg <[EMAIL PROTECTED]>**20080118020634] [add regression test for amend-record removed file Tommy Pettersson <[EMAIL PROTECTED]>**20080122223231] [use UTC in date matching test untill match handles time zones Tommy Pettersson <[EMAIL PROTECTED]>**20080122134322] [fix bug with timestamps and obliterate. David Roundy <[EMAIL PROTECTED]>**20080122224607] [Test: unpull may hide changes when using timestamp optimisation. [EMAIL PROTECTED] [avoid printing totals that are less than our current progress. David Roundy <[EMAIL PROTECTED]>**20080122210546] [TAG 2.0.0pre3 David Roundy <[EMAIL PROTECTED]>**20080122200612] Patch bundle hash: fdd1f6dea814190d8a05c09a4a1ef1a363758be8
_______________________________________________ darcs-devel mailing list darcs-devel@darcs.net http://lists.osuosl.org/mailman/listinfo/darcs-devel