changeset 15786:aca0f2b3c7e3 stable

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.
author Na'Tosha Bard <natosha@unity3d.com>
date Sun, 08 Jan 2012 11:19:51 +0100
parents 01831f55e972
children 0c7b83a057aa
files hgext/largefiles/overrides.py tests/test-largefiles.t
diffstat 2 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Fri Jan 06 11:15:32 2012 +0100
+++ b/hgext/largefiles/overrides.py	Sun Jan 08 11:19:51 2012 +0100
@@ -130,7 +130,7 @@
     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 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:
--- a/tests/test-largefiles.t	Fri Jan 06 11:15:32 2012 +0100
+++ b/tests/test-largefiles.t	Sun Jan 08 11:19:51 2012 +0100
@@ -50,6 +50,18 @@
   $ 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).