[PATCH 5 of 5 STABLE] largefiles: exit from forget with 0 only on success

Matt Harbison matt_harbison at yahoo.com
Wed Sep 5 23:33:11 CDT 2012


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1346899343 14400
# Branch stable
# Node ID 9f82e8d1440dcd70510baf399dc480b98315063c
# Parent  d48bb31246621a420ecbd03c2dc871db82c57f6f
largefiles: exit from forget with 0 only on success

This maintains the exit codes documented in commands.py.

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -896,7 +896,7 @@
 
 def overrideforget(orig, ui, repo, *pats, **opts):
     installnormalfilesmatchfn(repo[None].manifest())
-    orig(ui, repo, *pats, **opts)
+    result = orig(ui, repo, *pats, **opts)
     restorematchfn()
     m = scmutil.match(repo[None], pats, opts)
 
@@ -913,6 +913,7 @@
                 os.path.isdir(m.rel(lfutil.standin(f))):
             ui.warn(_('not removing %s: file is already untracked\n')
                     % m.rel(f))
+            result = 1
 
     for f in forget:
         if ui.verbose or not m.exact(f):
@@ -934,6 +935,8 @@
     finally:
         wlock.release()
 
+    return result
+
 def getoutgoinglfiles(ui, repo, dest=None, **opts):
     dest = ui.expandpath(dest or 'default-push', dest or 'default')
     dest, branches = hg.parseurl(dest, opts.get('branch'))
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -116,6 +116,9 @@
   $ hg remove large1-test
   not removing large1-test: file is untracked
   [1]
+  $ hg forget large1-test
+  not removing large1-test: file is already untracked
+  [1]
   $ rm large1-test
 
 Copy both largefiles and normal files (testing that status output is correct).


More information about the Mercurial-devel mailing list