[PATCH 2 of 6] subrepo: treat git error code 1 as success

Eric Eisner ede at MIT.EDU
Thu Dec 9 15:53:25 CST 2010


# HG changeset patch
# User Eric Eisner <ede at mit.edu>
# Date 1291931534 18000
# Node ID 3bc237b0eaeacdd7099efd3a8f84f191e6c63c43
# Parent  c869bd9e1193cf37cc09797581e3807dd176f983
subrepo: treat git error code 1 as success

At least status, commit, merge-base, and diff all return 1 when not failing.

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -641,7 +641,7 @@ class gitsubrepo(abstractsubrepo):
         # wait for the child to exit to avoid race condition.
         p.wait()
 
-        if p.returncode != 0:
+        if p.returncode != 0 and p.returncode != 1:
             # there are certain error codes that are ok
             command = None
             for arg in commands:
@@ -650,8 +650,6 @@ class gitsubrepo(abstractsubrepo):
                     break
             if command == 'cat-file':
                 return retdata, p.returncode
-            if command in ('commit', 'status') and p.returncode == 1:
-                return retdata, p.returncode
             # for all others, abort
             raise util.Abort('git %s error %d' % (command, p.returncode))
 


More information about the Mercurial-devel mailing list