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
--- 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()