Make copy --after work for files that have been hg added.
--- 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