changeset 17583:55724f42fa14

merge with stable
author Matt Mackall <mpm@selenic.com>
date Mon, 17 Sep 2012 15:13:17 -0500
parents 54c832922e85 (current diff) 495d3c671a8b (diff)
children 741e2bef4155
files hgext/largefiles/overrides.py tests/test-largefiles.t
diffstat 2 files changed, 53 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Mon Sep 17 21:53:50 2012 +0200
+++ b/hgext/largefiles/overrides.py	Mon Sep 17 15:13:17 2012 -0500
@@ -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	Mon Sep 17 21:53:50 2012 +0200
+++ b/tests/test-largefiles.t	Mon Sep 17 15:13:17 2012 -0500
@@ -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