darcs

Patch 558 resolve issue1737

Title resolve issue1737
Superseder Nosy List bsrkaditya
Related Issues darcs mv does not warn when moving old to new if > 2 args
View: 1737
Status accepted Assigned To
Milestone

Created on 2011-02-21.20:27:05 by bsrkaditya, last changed 2011-05-10.22:35:34 by darcswatch. Tracked on DarcsWatch.

Files
File name Status Uploaded Type Edit Remove
_patch558_-removed-failing-prefix-from-test.dpatch bsrkaditya, 2011-02-22.05:16:19 application/x-darcs-patch
resolve-issue1737_-darcs-mv-does-not-warn-when-moving-old-to-new-if-_-2-args.dpatch bsrkaditya, 2011-02-21.20:27:05 application/octet-stream
resolve-issue1737_-darcs-mv-does-not-warn-when-moving-old-to-new-if-_-2-args.dpatch bsrkaditya, 2011-02-22.19:43:28 application/x-darcs-patch
unnamed bsrkaditya, 2011-02-21.21:51:26 text/html
unnamed bsrkaditya, 2011-02-22.05:16:19 text/x-darcs-patch
unnamed bsrkaditya, 2011-02-22.05:16:19
unnamed bsrkaditya, 2011-02-22.19:43:28 text/x-darcs-patch
unnamed bsrkaditya, 2011-02-22.19:43:28
See mailing list archives for discussion on individual patches.
Messages
msg13714 (view) Author: bsrkaditya Date: 2011-02-21.20:27:05
This is a fix to a ProbablyEasy bug.
Attachments
msg13716 (view) Author: bsrkaditya Date: 2011-02-21.21:51:26
This is a fix to a ProbablyEasy bug.


1 patch for repository http://darcs.net/screened:

Mon Feb 21 13:32:22 IST 2011  bsrkaditya@gmail.com
  * resolve issue1737: darcs mv does not warn when moving old to new if > 2
args


-- 
BSRK Aditya
Attachments
msg13720 (view) Author: exlevan Date: 2011-02-21.23:02:44
Since this patch intersects with my recent changes to Darcs.Commands.* 
and is trivial, I'll review it.

A note on the patch name: as pointed out in 
http://wiki.darcs.net/Development/GettingStarted#sending-your-patches, 
it's a good practice to keep your patch names down to 72 characters or 
less.

         Nothing -> fail "Invalid destination directory."
         Just to' -> do
           xs <- nub . sort <$> fixSubPaths opts froms
-          case xs of
-            [] -> fail "Nothing to move."
-            froms' -> moveFilesToDir opts froms' to'
+          if to' `elem` xs
+            then fail "Cannot rename a file or directory onto itself!"
+            else case xs of
+              [] -> fail "Nothing to move."
+              froms' -> moveFilesToDir opts froms' to'
 
 moveFile :: [DarcsFlag] -> SubPath -> SubPath -> IO ()
 moveFile opts old new = withRepoLock opts $ RepoJob $ \repository -> do

A check that the moved files do not include the target directory itself, 
good. The error message is consistent with that of 2 aruments case (i.e. 
darcs move x x).

This patch applies cleanly to both HEAD and screened, and doesn't break 
any tests.

One thing that is usually has to be done is writing tests.  But in this 
case, the tests are already written (see tests/failing-issue1737-
move_args.sh in darcs repository).  They are skipped because of the 
"failing-" prefix in the filename.  Could you send a followup patch 
removing that prefix?

Overall, thanks for the patch!  I'm marking it as "accepted", it will 
appear in the repositories when someone from the Core Team will push it.
msg13724 (view) Author: bsrkaditya Date: 2011-02-22.05:16:19
1 patch for repository http://darcs.net/screened:

Tue Feb 22 10:30:31 IST 2011  bsrkaditya@gmail.com
  * [patch558] Removed failing prefix from test
Attachments
msg13735 (view) Author: gh Date: 2011-02-22.16:11:03
Hi BSRK Aditya,

I'm willing to push this patch but because of the poor naming of the
followup patch you sent, I'm going to ask you to just amend the first
patch so that it includes the renaming of the test script.

In case I'm not clear: you should unrecord your patch "[patch558]
Removed failing prefix from test", then amend "resolve issue1737
[...]" to include the renaming, and send this new version as a
followup by using "darcs send --subject="[patch558]".

thanks!

guillaume
msg13737 (view) Author: bsrkaditya Date: 2011-02-22.19:43:28
darcs mv does not warn when moving old to new
is same and the number of arguments are > 2.
(issue1737)

The patch rectifies this error.

The test for this bug is already written
and is tests/failing-issue1737-move_args.sh

The patch renames this to tests/issue1737-move_args.sh

1 patch for repository http://darcs.net/screened:

Wed Feb 23 00:39:56 IST 2011  bsrkaditya@gmail.com
  * resolve issue1737: darcs mv does not warn when moving old to new if > 2 args
Attachments
msg13739 (view) Author: gh Date: 2011-02-22.20:50:13
OK, it's in, thanks!
History
Date User Action Args
2011-02-21 20:27:05bsrkadityacreate
2011-02-21 21:51:26bsrkadityasetfiles: + unnamed, resolve-issue1737_-darcs-mv-does-not-warn-when-moving-old-to-new-if-_-2-args.dpatch
messages: + msg13716
2011-02-21 23:02:44exlevansetstatus: needs-review -> accepted
messages: + msg13720
issues: + darcs mv does not warn when moving old to new if > 2 args
2011-02-21 23:04:49exlevanlinkpatch559 superseder
2011-02-21 23:05:54exlevanlinkpatch560 superseder
2011-02-22 05:16:19bsrkadityasetfiles: + unnamed, _patch558_-removed-failing-prefix-from-test.dpatch, unnamed
messages: + msg13724
title: resolve issue1737: darcs mv does not warn when moving old to new if > 2 args -> Removed failing prefix from test
2011-02-22 05:21:15bsrkadityasetfiles: - resolve-issue1737_-darcs-mv-does-not-warn-when-moving-old-to-new-if-_-2-args.dpatch
2011-02-22 16:11:03ghsetmessages: + msg13735
title: Removed failing prefix from test -> resolve issue1737: darcs mv does not warn when moving old to new if > 2 args
2011-02-22 19:43:28bsrkadityasetfiles: + unnamed, resolve-issue1737_-darcs-mv-does-not-warn-when-moving-old-to-new-if-_-2-args.dpatch, unnamed
messages: + msg13737
title: resolve issue1737: darcs mv does not warn when moving old to new if > 2 args -> resolve issue1737
2011-02-22 20:50:13ghsetmessages: + msg13739
2011-03-09 18:37:24darcswatchsetdarcswatchurl: http://darcswatch.nomeata.de/repo_http:__darcs.net_.html#bundle-128a9125e2e5e04e66dfc5612ccf7b9d76c5f170
2011-05-10 22:35:34darcswatchsetdarcswatchurl: http://darcswatch.nomeata.de/repo_http:__darcs.net_.html#bundle-128a9125e2e5e04e66dfc5612ccf7b9d76c5f170 -> http://darcswatch.nomeata.de/repo_http:__darcs.net_reviewed.html#bundle-128a9125e2e5e04e66dfc5612ccf7b9d76c5f170