diff mercurial/hg.py @ 12400:40852b4b910c

incoming/outgoing: Fix recursion on sub repositories Incoming and outgoing are fixed so they go through the whole three of repositories instead of only visiting first level of sub repositories.
author Erik Zielke <ez@aragost.com>
date Fri, 24 Sep 2010 12:00:55 +0200
parents f2daa6ab514a
children 55f0648c7e2d
line wrap: on
line diff
--- a/mercurial/hg.py	Fri Sep 24 10:13:49 2010 +0200
+++ b/mercurial/hg.py	Fri Sep 24 12:00:55 2010 +0200
@@ -409,6 +409,15 @@
     return stats[3] > 0
 
 def incoming(ui, repo, source, opts):
+    def recurse():
+        ret = 1
+        if opts.get('subrepos'):
+            ctx = repo[None]
+            for subpath in sorted(ctx.substate):
+                sub = ctx.sub(subpath)
+                ret = min(ret, sub.incoming(ui, source, opts))
+        return ret
+
     limit = cmdutil.loglimit(opts)
     source, branches = parseurl(ui.expandpath(source), opts.get('branch'))
     other = repository(remoteui(repo, opts), source)
@@ -426,7 +435,7 @@
         except:
             pass
         ui.status(_("no changes found\n"))
-        return 1
+        return recurse()
 
     cleanup = None
     try:
@@ -469,8 +478,19 @@
             other.close()
         if cleanup:
             os.unlink(cleanup)
+    recurse()
+    return 0 # exit code is zero since we found incoming changes
 
 def outgoing(ui, repo, dest, opts):
+    def recurse():
+        ret = 1
+        if opts.get('subrepos'):
+            ctx = repo[None]
+            for subpath in sorted(ctx.substate):
+                sub = ctx.sub(subpath)
+                ret = min(ret, sub.outgoing(ui, dest, opts))
+        return ret
+
     limit = cmdutil.loglimit(opts)
     dest = ui.expandpath(dest or 'default-push', dest or 'default')
     dest, branches = parseurl(dest, opts.get('branch'))
@@ -483,7 +503,8 @@
     o = discovery.findoutgoing(repo, other, force=opts.get('force'))
     if not o:
         ui.status(_("no changes found\n"))
-        return 1
+        return recurse()
+
     o = repo.changelog.nodesbetween(o, revs)[0]
     if opts.get('newest_first'):
         o.reverse()
@@ -498,6 +519,8 @@
         count += 1
         displayer.show(repo[n])
     displayer.close()
+    recurse()
+    return 0 # exit code is zero since we found outgoing changes
 
 def revert(repo, node, choose):
     """revert changes to revision in node without updating dirstate"""