[Request] [+- ] D10420: summary: use the new APIs
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Wed Apr 14 23:41:02 UTC 2021
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
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.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D10420
AFFECTED FILES
mercurial/commands.py
CHANGE DETAILS
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -7203,7 +7203,12 @@
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)
@@ -7226,11 +7231,22 @@
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)
To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210414/8f15dca3/attachment.html>
More information about the Mercurial-patches
mailing list