# HG changeset patch # User Brendan Cully # Date 1177950764 25200 # Node ID a6436e9333db5df324daf3acb645d3f9d6af4c7e # Parent cf5f35ec47207b28b8f3c83b1ff9386caa85b95a Also restore old rm -A behavior for inexact patterns diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2083,7 +2083,7 @@ def remove(ui, repo, *pats, **opts): entire project history. If the files still exist in the working directory, they will be deleted from it. If invoked with --after, files are marked as removed, but not actually unlinked unless --force - is also given. Without an explicit pattern, --after will only mark + is also given. Without exact file names, --after will only mark files as removed if they are no longer in the working directory. This command schedules the files to be removed at the next commit. @@ -2111,7 +2111,7 @@ def remove(ui, repo, *pats, **opts): reason = _('has been marked for add (use -f to force removal)') elif abs in unknown: reason = _('is not managed') - elif opts['after'] and not pats and abs not in deleted: + elif opts['after'] and not exact and abs not in deleted: continue elif abs in removed: continue diff --git a/tests/test-remove b/tests/test-remove --- a/tests/test-remove +++ b/tests/test-remove @@ -23,18 +23,21 @@ hg add a hg rm a hg rm -f a echo b > b -echo c > c +mkdir c +echo d > c/d hg ci -A -m 3 -d "1000001 0" echo c >> b hg rm b hg rm -f b -hg rm -A c +hg rm -A c/d hg st -cat c +cat c/d hg revert c hg rm -A hg st -rm c +hg rm -A c +hg st +rm c/d hg rm -A hg st diff --git a/tests/test-remove.out b/tests/test-remove.out --- a/tests/test-remove.out +++ b/tests/test-remove.out @@ -52,13 +52,15 @@ diff -r 8ba83d44753d -r a1fce69c50d9 foo not removing a: file has been marked for add (use -f to force removal) adding a adding b -adding c +adding c/d not removing b: file is modified (use -f to force removal) R b -R c -c +R c/d +d +undeleting c/d +R b R b -removing c +removing c/d R b -R c +R c/d 3 files updated, 0 files merged, 0 files removed, 0 files unresolved