Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 46908:4452cb788404
urlutil: extract `parseurl` from `hg` into the new module
The new module is well fitting for this new code. And this will be useful to
make the gathered code collaborate more later.
Differential Revision: https://phab.mercurial-scm.org/D10375
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 12 Apr 2021 06:34:54 +0200 |
parents | ffd3e823a7e5 |
children | 9e021cffb356 |
comparison
equal
deleted
inserted
replaced
46907:ffd3e823a7e5 | 46908:4452cb788404 |
---|---|
1058 # make sure tests are repeatable | 1058 # make sure tests are repeatable |
1059 random.seed(int(opts[b'seed'])) | 1059 random.seed(int(opts[b'seed'])) |
1060 | 1060 |
1061 if not remote_revs: | 1061 if not remote_revs: |
1062 | 1062 |
1063 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl)) | 1063 remoteurl, branches = urlutil.parseurl(ui.expandpath(remoteurl)) |
1064 remote = hg.peer(repo, opts, remoteurl) | 1064 remote = hg.peer(repo, opts, remoteurl) |
1065 ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(remoteurl)) | 1065 ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(remoteurl)) |
1066 else: | 1066 else: |
1067 branches = (None, []) | 1067 branches = (None, []) |
1068 remote_filtered_revs = scmutil.revrange( | 1068 remote_filtered_revs = scmutil.revrange( |
3650 b"server specified" | 3650 b"server specified" |
3651 ) | 3651 ) |
3652 ) | 3652 ) |
3653 source = b"default" | 3653 source = b"default" |
3654 | 3654 |
3655 source, branches = hg.parseurl(ui.expandpath(source)) | 3655 source, branches = urlutil.parseurl(ui.expandpath(source)) |
3656 url = urlutil.url(source) | 3656 url = urlutil.url(source) |
3657 | 3657 |
3658 defaultport = {b'https': 443, b'ssh': 22} | 3658 defaultport = {b'https': 443, b'ssh': 22} |
3659 if url.scheme in defaultport: | 3659 if url.scheme in defaultport: |
3660 try: | 3660 try: |
3760 return | 3760 return |
3761 | 3761 |
3762 for backup in backups: | 3762 for backup in backups: |
3763 # Much of this is copied from the hg incoming logic | 3763 # Much of this is copied from the hg incoming logic |
3764 source = ui.expandpath(os.path.relpath(backup, encoding.getcwd())) | 3764 source = ui.expandpath(os.path.relpath(backup, encoding.getcwd())) |
3765 source, branches = hg.parseurl(source, opts.get(b"branch")) | 3765 source, branches = urlutil.parseurl(source, opts.get(b"branch")) |
3766 try: | 3766 try: |
3767 other = hg.peer(repo, opts, source) | 3767 other = hg.peer(repo, opts, source) |
3768 except error.LookupError as ex: | 3768 except error.LookupError as ex: |
3769 msg = _(b"\nwarning: unable to open bundle %s") % source | 3769 msg = _(b"\nwarning: unable to open bundle %s") % source |
3770 hint = _(b"\n(missing parent rev %s)\n") % short(ex.name) | 3770 hint = _(b"\n(missing parent rev %s)\n") % short(ex.name) |