# HG changeset patch # User Brendan Cully # Date 2007-04-25 01:43:18 # Node ID de612b5f8d598a91fe3115a8971a4a8c16ab4d0c # Parent 109077e7048dfdec1a329535b26d4914cf907408 Make copy --after work for files that have been hg added. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -503,7 +503,7 @@ def docopy(ui, repo, pats, opts, wlock): 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) diff --git a/tests/test-copy2 b/tests/test-copy2 --- a/tests/test-copy2 +++ b/tests/test-copy2 @@ -38,4 +38,10 @@ hg debugrename bar 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 diff --git a/tests/test-copy2.out b/tests/test-copy2.out --- a/tests/test-copy2.out +++ b/tests/test-copy2.out @@ -20,3 +20,6 @@ copy: foo -> bar 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