Make copy --after work for files that have been hg added.
authorBrendan Cully <brendan@kublai.com>
Tue, 24 Apr 2007 18:43:18 -0700
changeset 4376 de612b5f8d59
parent 4375 109077e7048d
child 4377 4759da3e4dc8
child 4381 f4af7960d578
Make copy --after work for files that have been hg added.
mercurial/commands.py
tests/test-copy2
tests/test-copy2.out
--- a/mercurial/commands.py	Tue Apr 24 12:02:51 2007 -0700
+++ b/mercurial/commands.py	Tue Apr 24 18:43:18 2007 -0700
@@ -503,7 +503,7 @@
                      util.localpath(prevsrc)))
             return
         if (not opts['after'] and os.path.exists(reltarget) or
-            opts['after'] and repo.dirstate.state(abstarget) not in '?r'):
+            opts['after'] and repo.dirstate.state(abstarget) not in '?ar'):
             if not opts['force']:
                 ui.warn(_('%s: not overwriting - file exists\n') %
                         reltarget)
--- a/tests/test-copy2	Tue Apr 24 12:02:51 2007 -0700
+++ b/tests/test-copy2	Tue Apr 24 18:43:18 2007 -0700
@@ -38,4 +38,10 @@
 echo "# should show no copies"
 hg debugstate|grep '^copy'
 
+echo "# copy --after on an added file"
+cp bar baz
+hg add baz
+hg cp -A bar baz
+hg st -C
+
 exit 0
--- a/tests/test-copy2.out	Tue Apr 24 12:02:51 2007 -0700
+++ b/tests/test-copy2.out	Tue Apr 24 18:43:18 2007 -0700
@@ -20,3 +20,6 @@
      1         5       7      1       2 dd12c926cf16 2ed2a3912a0b 000000000000
 bar renamed from foo:dd12c926cf165e3eb4cf87b084955cb617221c17
 # should show no copies
+# copy --after on an added file
+A baz
+  bar