41 # ui.expandpath() leaves 'default-push' and 'default' alone if |
41 # ui.expandpath() leaves 'default-push' and 'default' alone if |
42 # they cannot be expanded: fallback to the empty string, |
42 # they cannot be expanded: fallback to the empty string, |
43 # meaning the current directory. |
43 # meaning the current directory. |
44 if repo is None: |
44 if repo is None: |
45 path = ui.expandpath(b'default') |
45 path = ui.expandpath(b'default') |
46 path, _branches = hg.parseurl(path) |
46 path, _branches = urlutil.parseurl(path) |
47 remote = hg.peer(repo or ui, {}, path) |
47 remote = hg.peer(repo or ui, {}, path) |
48 elif path == b'default-push' or path == b'default': |
48 elif path == b'default-push' or path == b'default': |
49 remote = repo |
49 remote = repo |
50 else: |
50 else: |
51 path, _branches = hg.parseurl(path) |
51 path, _branches = urlutil.parseurl(path) |
52 remote = hg.peer(repo or ui, {}, path) |
52 remote = hg.peer(repo or ui, {}, path) |
53 |
53 |
54 # The path could be a scheme so use Mercurial's normal functionality |
54 # The path could be a scheme so use Mercurial's normal functionality |
55 # to resolve the scheme to a repository and use its path |
55 # to resolve the scheme to a repository and use its path |
56 path = util.safehasattr(remote, b'url') and remote.url() or remote.path |
56 path = util.safehasattr(remote, b'url') and remote.url() or remote.path |