This is only a minor improvement over my previous patch.  I noticed that two
sections of code were doing trying to do the exact same thing, so I broke out a 
new function to share.

Sat Jul 30 14:53:52 EDT 2005  Matt Lavin <[EMAIL PROTECTED]>
  * Make send --to override default email and add test for it

Sat Jul 30 17:20:12 EDT 2005  Matt Lavin <[EMAIL PROTECTED]>
  * share target collection code in send implementation

New patches:

[Make send --to override default email and add test for it
Matt Lavin <[EMAIL PROTECTED]>**20050730185352] {
hunk ./Send.lhs 206
-    Just ts -> do announce_recipients ts
-                  return opts
-    Nothing ->
+    [] ->
hunk ./Send.lhs 215
-    where the_targets = mapM to_whom opts
-          to_whom (Target t) = Just t
-          to_whom _ = Nothing
+    ts -> do announce_recipients ts
+             return opts
+    where the_targets = to_whom opts []
+          to_whom [] acc = acc
+          to_whom (Target t:rest) acc = to_whom rest (t:acc)
+          to_whom (_:rest) acc = to_whom rest acc
hunk ./Send.lhs 232
-            else when (the_targets == Nothing) $
+            else when (the_targets == []) $
addfile ./tests/send.sh
hunk ./tests/send.sh 1
+#!/bin/sh
+set -ev
+
+test $DARCS || DARCS=$PWD/../darcs
+
+rm -rf temp1 temp2
+mkdir temp1 temp2
+
+cd temp2
+$DARCS init
+
+# setup test
+cd ../temp1
+$DARCS init
+touch foo bar
+$DARCS add foo bar
+$DARCS record -a -m add_foo_bar -A x
+
+# Test that a default preference value is not needed to send
+$DARCS send --author=me -a [EMAIL PROTECTED] "--sendmail-command=cat %<" ../temp2 | grep -x "To: [EMAIL PROTECTED]" 
+
+# Test that a default preference will be used when no --to value is specified
+echo "[EMAIL PROTECTED]" > ../temp2/_darcs/prefs/email 
+$DARCS send --author=me -a "--sendmail-command=cat %<" ../temp2 | grep -x "To: [EMAIL PROTECTED]"
+
+# Test that the --to parameter overrides the default value in the repository
+$DARCS send --author=me -a [EMAIL PROTECTED] "--sendmail-command=cat %<" ../temp2 | grep -x "To: [EMAIL PROTECTED]"
+
+rm -rf temp1 temp2
}

[share target collection code in send implementation
Matt Lavin <[EMAIL PROTECTED]>**20050730212012] {
hunk ./Send.lhs 217
-    where the_targets = to_whom opts []
-          to_whom [] acc = acc
-          to_whom (Target t:rest) acc = to_whom rest (t:acc)
-          to_whom (_:rest) acc = to_whom rest acc
+    where the_targets = collect_targets opts
hunk ./Send.lhs 247
-    case catMaybes $ map towhom flags of
+    case collect_targets flags of
hunk ./Send.lhs 250
+
+collect_targets :: [DarcsFlag] -> [String]
+collect_targets flags =  
+    catMaybes $ map towhom flags
}

Context:

[mention in changelog the win32 build improvement in recognizing windows.
David Roundy <[EMAIL PROTECTED]>**20050730124809] 
[use presence of windows.h to decide if we're in windows.
David Roundy <[EMAIL PROTECTED]>**20050730124536] 
[add new changelog entry and update older one.
David Roundy <[EMAIL PROTECTED]>**20050730115001] 
[fix bug introduced in 208 fix which messed up --list-options output.
David Roundy <[EMAIL PROTECTED]>**20050729121804
 We need to make sure that drop_paths doesn't do anything to an absolute
 path or URL.
] 
[Don't die on sigALRM (linking with -threaded means we see loads of them)
Ian Lynagh <[EMAIL PROTECTED]>**20050728131023] 
[Give help for 'c' in selectchanges
Ian Lynagh <[EMAIL PROTECTED]>**20050728125910] 
[Include autoconf-detected libs in LDFLAGS
Joshua J. Berry <[EMAIL PROTECTED]>**20050728031609
 Autoconf uses @LIBS@ -- not @LDFLAGS@ -- for libraries it detects (e.g. using
 AC_SEARCH_LIBS).
] 
[resolve conflict with myself...
David Roundy <[EMAIL PROTECTED]>**20050727100745] 
[fix pulling from a relative defaultrepo from within a subdirectory.
David Roundy <[EMAIL PROTECTED]>**20050722105708
 This is a fix for bug #208.  It is perhaps a tad more invasive than
 necesary, and introduces a FilePathUtils module that is perhaps
 overkill... especially since it doesn't do much.
] 
[Small tweaks to the with_new_pending patch
Ian Lynagh <[EMAIL PROTECTED]>**20050727025308] 
[replace write_pending with "with_new_pending".
David Roundy <[EMAIL PROTECTED]>**20050722125725
 This patch is basically an extension of Ian's earlier patch that created a
 "write_pending_then" function.  This one creates two functions,
 with_new_pending and add_to_pending.
 
 The idea is that we can't check if a new pending is valid until after we've
 updated the pristine cache.  But it's possible that the pending patch
 itself was lazily generated with get_unrecorded, in which case it's not
 safe to modify the pristine cache until after we've written pending.  This
 new interface makes it much harder to make this kind of mistake.  I also
 think it's pretty intuitive.
] 
[Removed an unused reference to Slurpy
Ian Lynagh <[EMAIL PROTECTED]>**20050709114603] 
[remove TODO annotation for two tests that now pass.
David Roundy <[EMAIL PROTECTED]>**20050728115034] 
[new changelog entries.
David Roundy <[EMAIL PROTECTED]>**20050726123329] 
[clean up formatting in Depends.
David Roundy <[EMAIL PROTECTED]>**20050723130807] 
[changelog entry for fix to RT#208.
David Roundy <[EMAIL PROTECTED]>**20050722113803] 
[make make_changelog a bit more flexible in its parsing.
David Roundy <[EMAIL PROTECTED]>**20050722113701
 One can now have blank lines between the match: lines and the actual
 comments.
] 
[give better error message when dealing with a non-repository.
David Roundy <[EMAIL PROTECTED]>**20050722105908] 
[make make_changelog ignore boring files (emacs backups) in changelog.in/entries/.
David Roundy <[EMAIL PROTECTED]>**20050726121455] 
[fix bug in get_patches_beyond_tag that broke get --partial.
David Roundy <[EMAIL PROTECTED]>**20050723125507
 The bug was that we sometimes looked at patches that weren't strictly
 necesary.  This was because of the concat in get_patches_beyond_tag, which
 loses information about tag dependencies.  A clean implementation of a
 get_extra that accepts a true PatchSet would be a nicer fix (since it might
 fix other similar problems), but this fix is also correct and simple.
] 
[add changelog entry for get --partial fix.
David Roundy <[EMAIL PROTECTED]>**20050723130715] 
[scrunch up the tla/cvs tables a bit in the manual.
David Roundy <[EMAIL PROTECTED]>**20050724181011] 
[another alternative formatting for cvs/tla tables.
Erik Schnetter <[EMAIL PROTECTED]>**20050724134656] 
[alternative formatting for cvs/tla tables.
Erik Schnetter <[EMAIL PROTECTED]>**20050724113905] 
[make add/remove --list-options not output preceding ./
David Roundy <[EMAIL PROTECTED]>**20050723134758
 We were treating the repository root differently from subdirectories
 because the file paths didn't need to get "fixed".  Addresses bug #158.
] 
[fix unit test that prompts for input
Will <[EMAIL PROTECTED]>**20050722181028] 
[Make DarcsRepo.add_to_inventory take a list.
Juliusz Chroboczek <[EMAIL PROTECTED]>**20050720174029
 This avoids opening the inventory multiple times.  Thanks to Ian for the hint.
] 
[Use mapM_ instead of the comprehensible alternative.
Juliusz Chroboczek <[EMAIL PROTECTED]>**20050720164258
 Mentioning mapM_ always impresses people at dinner parties.  Thanks to
 Ian for the hint.
] 
[Move iterateGitTree out of the IO monad.
Juliusz Chroboczek <[EMAIL PROTECTED]>**20050720162841
 We're reading immutable on-disk data, it's safe to do it unsafely.
] 
[Clean up usage of interleaveIO in Git.
Juliusz Chroboczek <[EMAIL PROTECTED]>**20050720162251] 
[fix write_problem to show all problems.
David Roundy <[EMAIL PROTECTED]>**20050717110628] 
[don't import head and tail, which are in the prelude.
David Roundy <[EMAIL PROTECTED]>**20050716143547] 
[Rename bound variable in fromJust macro.
Juliusz Chroboczek <[EMAIL PROTECTED]>**20050716221705
 Avoids ``shadows existing variable'' warnings which for some reason are
 errors.
 
 Could we please use Lisp macros instead?
] 
[TAG 2005-07-18
Ian Lynagh <[EMAIL PROTECTED]>**20050718193534] 
[put configure.ac back in the public domain.
David Roundy <[EMAIL PROTECTED]>**20050720115702] 
[fix error in name of --reorder-patches flag.
David Roundy <[EMAIL PROTECTED]>**20050722110752] 
[Push and pull can now show the detailed diffs of patches
Jim Radford <[EMAIL PROTECTED]>**20050717042645
 The same distinction is now made between --summary and --verbose
 as changes makes.
] 
[advance DARCS_VERSION to 1.0.4pre2.
David Roundy <[EMAIL PROTECTED]>**20050720115536
 In the new tradition of changing the version after a release rather than
 before a release (although when the release type changes to rc or actual
 release it'll have to be done before the release).
] 
[drop $srcdir use; build-directories aren't supported anyway
Peter Simons <[EMAIL PROTECTED]>**20050719140044] 
[clean generated manual files at realclean
Peter Simons <[EMAIL PROTECTED]>**20050719135935] 
[cosmetic changes
Peter Simons <[EMAIL PROTECTED]>**20050719135834] 
[move comment to the right place
Peter Simons <[EMAIL PROTECTED]>**20050719135818] 
[let config.status generate config.command
Peter Simons <[EMAIL PROTECTED]>**20050719135733] 
[make use of autoconf 2.5x's AC_INIT macro
Peter Simons <[EMAIL PROTECTED]>**20050719135611] 
[use ./config.status to re-configure build after autoconf changes
Peter Simons <[EMAIL PROTECTED]>**20050719135435] 
[update distclean and realclean targets
Peter Simons <[EMAIL PROTECTED]>**20050719135415] 
[canonize [EMAIL PROTECTED]
Peter Simons <[EMAIL PROTECTED]>**20050719134834] 
[cosmetic change
Peter Simons <[EMAIL PROTECTED]>**20050719134816] 
[update test suite to work with Peter's makefile changes.
David Roundy <[EMAIL PROTECTED]>**20050721102319] 
[TAG 1.0.4pre1
David Roundy <[EMAIL PROTECTED]>**20050718112234] 
Patch bundle hash:
a93c2c1df7bc75269923e2e9b29db7ecdb950b75
_______________________________________________
darcs-devel mailing list
[email protected]
http://www.abridgegame.org/cgi-bin/mailman/listinfo/darcs-devel

Reply via email to