Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 46954:5d91eeac37ab
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
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 14 Apr 2021 19:30:48 +0200 |
parents | 82366464190a |
children | d55b71393907 |
comparison
equal
deleted
inserted
replaced
46953:394cfc42c05c | 46954:5d91eeac37ab |
---|---|
7208 needsoutgoing = True | 7208 needsoutgoing = True |
7209 if not needsincoming and not needsoutgoing: | 7209 if not needsincoming and not needsoutgoing: |
7210 return | 7210 return |
7211 | 7211 |
7212 def getincoming(): | 7212 def getincoming(): |
7213 source, branches = urlutil.parseurl(ui.expandpath(b'default')) | 7213 # XXX We should actually skip this if no default is specified, instead |
7214 # of passing "default" which will resolve as "./default/" if no default | |
7215 # path is defined. | |
7216 source, branches = urlutil.get_unique_pull_path( | |
7217 b'summary', repo, ui, b'default' | |
7218 ) | |
7214 sbranch = branches[0] | 7219 sbranch = branches[0] |
7215 try: | 7220 try: |
7216 other = hg.peer(repo, {}, source) | 7221 other = hg.peer(repo, {}, source) |
7217 except error.RepoError: | 7222 except error.RepoError: |
7218 if opts.get(b'remote'): | 7223 if opts.get(b'remote'): |
7231 source, sbranch, sother, commoninc, incoming = getincoming() | 7236 source, sbranch, sother, commoninc, incoming = getincoming() |
7232 else: | 7237 else: |
7233 source = sbranch = sother = commoninc = incoming = None | 7238 source = sbranch = sother = commoninc = incoming = None |
7234 | 7239 |
7235 def getoutgoing(): | 7240 def getoutgoing(): |
7236 dest, branches = urlutil.parseurl( | 7241 # XXX We should actually skip this if no default is specified, instead |
7237 ui.expandpath(b'default-push', b'default') | 7242 # of passing "default" which will resolve as "./default/" if no default |
7238 ) | 7243 # path is defined. |
7239 dbranch = branches[0] | 7244 d = None |
7240 revs, checkout = hg.addbranchrevs(repo, repo, branches, None) | 7245 if b'default-push' in ui.paths: |
7246 d = b'default-push' | |
7247 elif b'default' in ui.paths: | |
7248 d = b'default' | |
7249 if d is not None: | |
7250 path = urlutil.get_unique_push_path(b'summary', repo, ui, d) | |
7251 dest = path.pushloc or path.loc | |
7252 dbranch = path.branch | |
7253 else: | |
7254 dest = b'default' | |
7255 dbranch = None | |
7256 revs, checkout = hg.addbranchrevs(repo, repo, (dbranch, []), None) | |
7241 if source != dest: | 7257 if source != dest: |
7242 try: | 7258 try: |
7243 dother = hg.peer(repo, {}, dest) | 7259 dother = hg.peer(repo, {}, dest) |
7244 except error.RepoError: | 7260 except error.RepoError: |
7245 if opts.get(b'remote'): | 7261 if opts.get(b'remote'): |