merge with main
authorThomas Arendsen Hein <thomas@intevation.de>
Tue, 18 Sep 2012 15:30:22 +0200
changeset 17595 741e2bef4155
parent 17593 9e31a72bede7 (current diff)
parent 17583 55724f42fa14 (diff)
child 17596 2eac9641496d
merge with main
--- a/hgext/largefiles/overrides.py	Sun Sep 16 22:43:24 2012 +0200
+++ b/hgext/largefiles/overrides.py	Tue Sep 18 15:30:22 2012 +0200
@@ -141,14 +141,17 @@
         for f in files:
             ui.warn(_('not removing %s: %s (use forget to undo)\n')
                     % (m.rel(f), reason))
+        return int(len(files) > 0)
+
+    result = 0
 
     if after:
         remove, forget = deleted, []
-        warn(modified + added + clean, _('file still exists'))
+        result = warn(modified + added + clean, _('file still exists'))
     else:
         remove, forget = deleted + clean, []
-        warn(modified, _('file is modified'))
-        warn(added, _('file has been marked for add'))
+        result = warn(modified, _('file is modified'))
+        result = warn(added, _('file has been marked for add')) or result
 
     for f in sorted(remove + forget):
         if ui.verbose or not m.exact(f):
@@ -181,6 +184,8 @@
     finally:
         wlock.release()
 
+    return result
+
 # For overriding mercurial.hgweb.webcommands so that largefiles will
 # appear at their right place in the manifests.
 def decodepath(orig, path):
@@ -207,9 +212,9 @@
 
 def overrideremove(orig, ui, repo, *pats, **opts):
     installnormalfilesmatchfn(repo[None].manifest())
-    orig(ui, repo, *pats, **opts)
+    result = orig(ui, repo, *pats, **opts)
     restorematchfn()
-    removelargefiles(ui, repo, *pats, **opts)
+    return removelargefiles(ui, repo, *pats, **opts) or result
 
 def overridestatusfn(orig, repo, rev2, **opts):
     try:
@@ -235,7 +240,7 @@
 def overridelog(orig, ui, repo, *pats, **opts):
     try:
         repo.lfstatus = True
-        orig(ui, repo, *pats, **opts)
+        return orig(ui, repo, *pats, **opts)
     finally:
         repo.lfstatus = False
 
@@ -738,7 +743,7 @@
 def overriderebase(orig, ui, repo, **opts):
     repo._isrebasing = True
     try:
-        orig(ui, repo, **opts)
+        return orig(ui, repo, **opts)
     finally:
         repo._isrebasing = False
 
@@ -889,7 +894,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)
 
@@ -906,6 +911,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):
@@ -927,6 +933,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'))
@@ -968,7 +976,7 @@
     return toupload
 
 def overrideoutgoing(orig, ui, repo, dest=None, **opts):
-    orig(ui, repo, dest, **opts)
+    result = orig(ui, repo, dest, **opts)
 
     if opts.pop('large', None):
         toupload = getoutgoinglfiles(ui, repo, dest, **opts)
@@ -980,6 +988,8 @@
                 ui.status(lfutil.splitstandin(file) + '\n')
             ui.status('\n')
 
+    return result
+
 def overridesummary(orig, ui, repo, *pats, **opts):
     try:
         repo.lfstatus = True
--- a/tests/test-largefiles.t	Sun Sep 16 22:43:24 2012 +0200
+++ b/tests/test-largefiles.t	Tue Sep 18 15:30:22 2012 +0200
@@ -79,6 +79,17 @@
   C sub/normal2
   $ rm sub/unknown
 
+Test exit codes for remove warning cases (modified and still exiting)
+
+  $ hg remove -A large1
+  not removing large1: file still exists (use forget to undo)
+  [1]
+  $ echo 'modified' > large1
+  $ hg remove large1
+  not removing large1: file is modified (use forget to undo)
+  [1]
+  $ hg up -Cq
+
 Remove both largefiles and normal files.
 
   $ hg remove normal1 large1
@@ -96,11 +107,18 @@
   A large1-test
   $ hg rm large1-test
   not removing large1-test: file has been marked for add (use forget to undo)
+  [1]
   $ hg st
   A large1-test
   $ hg forget large1-test
   $ hg st
   ? large1-test
+  $ 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).
@@ -1144,6 +1162,15 @@
 largefiles can be pushed locally (issue3583)
   $ hg init dest
   $ cd r4
+  $ hg outgoing ../dest
+  comparing with ../dest
+  searching for changes
+  changeset:   0:639881c12b4c
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     m1
+  
   $ hg push ../dest
   pushing to ../dest
   searching for changes
@@ -1152,6 +1179,13 @@
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
+ 
+exit code with nothing outgoing (issue3611)
+  $ hg outgoing ../dest
+  comparing with ../dest
+  searching for changes
+  no changes found
+  [1]
   $ cd ..
 
 #if serve