changeset 46913:b2740c547243

outgoing: make `recurse` a real function If we want to use this in a loop, we need to be able to pass argument. Differential Revision: https://phab.mercurial-scm.org/D10381
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 11 Apr 2021 19:31:03 +0200
parents 627bb1875fee
children 50b79f8b802d
files mercurial/hg.py
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Sun Apr 11 19:20:14 2021 +0200
+++ b/mercurial/hg.py	Sun Apr 11 19:31:03 2021 +0200
@@ -1348,15 +1348,17 @@
         raise
 
 
+def _outgoing_recurse(ui, repo, dest, opts):
+    ret = 1
+    if opts.get(b'subrepos'):
+        ctx = repo[None]
+        for subpath in sorted(ctx.substate):
+            sub = ctx.sub(subpath)
+            ret = min(ret, sub.outgoing(ui, dest, opts))
+    return ret
+
+
 def outgoing(ui, repo, dest, opts):
-    def recurse():
-        ret = 1
-        if opts.get(b'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 = logcmdutil.getlimit(opts)
     o, other = _outgoing(ui, repo, dest, opts)
@@ -1380,7 +1382,7 @@
                 displayer.show(repo[n])
             displayer.close()
         cmdutil.outgoinghooks(ui, repo, other, opts, o)
-        ret = min(ret, recurse())
+        ret = min(ret, _outgoing_recurse(ui, repo, dest, opts))
         return ret  # exit code is zero since we found outgoing changes
     finally:
         other.close()