# HG changeset patch # User Pierre-Yves David # Date 2021-04-14 17:30:48 # Node ID 5d91eeac37ab3b404c936a6c6dba1e5e75359c5f # Parent 394cfc42c05c728be1fcef6dff2be51083f0889b summary: use the new APIs Summary can perform some incoming/outgoing queries (that should be common to the other command with the same needs, but that is another story). We now use the new APIs to do so. The current code behavior is a bit fishy, relying to the fact "default" will be picked as the destination in last resort. I did not altered that, but left various comment to highlight the issue. Differential Revision: https://phab.mercurial-scm.org/D10420 diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -7210,7 +7210,12 @@ def summary(ui, repo, **opts): return def getincoming(): - source, branches = urlutil.parseurl(ui.expandpath(b'default')) + # XXX We should actually skip this if no default is specified, instead + # of passing "default" which will resolve as "./default/" if no default + # path is defined. + source, branches = urlutil.get_unique_pull_path( + b'summary', repo, ui, b'default' + ) sbranch = branches[0] try: other = hg.peer(repo, {}, source) @@ -7233,11 +7238,22 @@ def summary(ui, repo, **opts): source = sbranch = sother = commoninc = incoming = None def getoutgoing(): - dest, branches = urlutil.parseurl( - ui.expandpath(b'default-push', b'default') - ) - dbranch = branches[0] - revs, checkout = hg.addbranchrevs(repo, repo, branches, None) + # XXX We should actually skip this if no default is specified, instead + # of passing "default" which will resolve as "./default/" if no default + # path is defined. + d = None + if b'default-push' in ui.paths: + d = b'default-push' + elif b'default' in ui.paths: + d = b'default' + if d is not None: + path = urlutil.get_unique_push_path(b'summary', repo, ui, d) + dest = path.pushloc or path.loc + dbranch = path.branch + else: + dest = b'default' + dbranch = None + revs, checkout = hg.addbranchrevs(repo, repo, (dbranch, []), None) if source != dest: try: dother = hg.peer(repo, {}, dest)