I recently noticed that the behavior of the --to argument to the send 
command did not behave exactly how the documentation described.  The
manual for darcs says that the --to command will be used instead of the
value in _darcs/prefs/email, but the code was actually using BOTH the email
pref and the --to arg.  The patch below should fix the inconsistency.

Two words of warning:

1.  This is my first patch to darcs, so please forgive any bad
    coding style or other obviously wrong things.

2.  I have little experience with Haskell, so I probably didn't do
    everything in the most efficient or 'correct' way.

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

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
}

Context:

[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:
2e32e7b5516799e841e6fa807f23b10e8068ed90
_______________________________________________
darcs-devel mailing list
[email protected]
http://www.abridgegame.org/cgi-bin/mailman/listinfo/darcs-devel

Reply via email to