[PATCH] rename --after: do not unlink source file (issue 910)

Adrian Buehlmann adrian at cadifra.com
Sat Apr 19 04:11:44 CDT 2008


(this replaces http://selenic.com/pipermail/mercurial-devel/2008-April/005923.html)

As provided by Alexis S. L. Carvalho at
http://selenic.com/pipermail/mercurial-devel/2008-April/005931.html

After reading the code (see localrepo.localrepository.remove),
I believe Alexis' change is good.

I ran the regression tests on FreeBSD 6.2 and verified that the change fixes
http://www.selenic.com/mercurial/bts/issue910 on Windows.

Many thanks to Alexis and Paul

Please accept the patch below:

# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1208594550 -7200
# Node ID 68eea0baca055d367b14b7b9a56ecc0aeade0ee7
# Parent  090f2145df7db6a638c53cee74a7fbd2fa6b9619
rename --after: do not unlink source file (issue 910)

"rename --after a.txt A.txt" on case mangling systems (e.g. Windows)
erroneously deleted A.txt (even if modified).

Code change provided by Alexis S. L. Carvalho
http://selenic.com/pipermail/mercurial-devel/2008-April/005931.html

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -395,7 +395,7 @@
                 repo.copy(origsrc, abstarget)

         if rename and not dryrun:
-            repo.remove([abssrc], True)
+            repo.remove([abssrc], not after)

     # pat: ossep
     # dest ossep



More information about the Mercurial-devel mailing list