largefiles: fix confusion upon removal of added largefile (issue3176)

This patch makes "hg remove" work the same way on largefiles as it does on
regular Mercurial files.  If you try to remove an added largefile, the removal
fails and you are instead prompted to use "hg forget" to undo the add.
This commit is contained in:
Na'Tosha Bard 2012-01-08 11:19:51 +01:00
parent 649b8283da
commit 0bd0abc6e9
2 changed files with 15 additions and 5 deletions

View File

@ -130,7 +130,7 @@ def override_remove(orig, ui, repo, *pats, **opts):
orig(ui, repo, *pats, **opts)
restorematchfn()
after, force = opts.get('after'), opts.get('force')
after = opts.get('after')
if not pats and not after:
raise util.Abort(_('no files specified'))
m = scmutil.match(repo[None], pats, opts)
@ -145,12 +145,10 @@ def override_remove(orig, ui, repo, *pats, **opts):
def warn(files, reason):
for f in files:
ui.warn(_('not removing %s: %s (use -f to force removal)\n')
ui.warn(_('not removing %s: %s (use forget to undo)\n')
% (m.rel(f), reason))
if force:
remove, forget = modified + deleted + clean, added
elif after:
if after:
remove, forget = deleted, []
warn(modified + added + clean, _('file still exists'))
else:

View File

@ -50,6 +50,18 @@ Remove both largefiles and normal files.
$ hg commit -m "remove files"
$ ls
sub
$ echo "testlargefile" > large1-test
$ hg add --large large1-test
$ hg st
A large1-test
$ hg rm large1-test
not removing large1-test: file has been marked for add (use forget to undo)
$ hg st
A large1-test
$ hg forget large1-test
$ hg st
? large1-test
$ rm large1-test
Copy both largefiles and normal files (testing that status output is correct).