Show More
@@ -550,9 +550,21 b' class ui(object):' | |||||
550 |
|
550 | |||
551 | def expandpath(self, loc, default=None): |
|
551 | def expandpath(self, loc, default=None): | |
552 | """Return repository location relative to cwd or from [paths]""" |
|
552 | """Return repository location relative to cwd or from [paths]""" | |
553 | p = self.paths.getpath(loc, default=default) |
|
553 | try: | |
|
554 | p = self.paths.getpath(loc) | |||
554 | if p: |
|
555 | if p: | |
555 | return p.rawloc |
|
556 | return p.rawloc | |
|
557 | except error.RepoError: | |||
|
558 | pass | |||
|
559 | ||||
|
560 | if default: | |||
|
561 | try: | |||
|
562 | p = self.paths.getpath(default) | |||
|
563 | if p: | |||
|
564 | return p.rawloc | |||
|
565 | except error.RepoError: | |||
|
566 | pass | |||
|
567 | ||||
556 | return loc |
|
568 | return loc | |
557 |
|
569 | |||
558 | @util.propertycache |
|
570 | @util.propertycache | |
@@ -1014,9 +1026,24 b' class paths(dict):' | |||||
1014 | ``name`` can be a named path or locations. Locations are filesystem |
|
1026 | ``name`` can be a named path or locations. Locations are filesystem | |
1015 | paths or URIs. |
|
1027 | paths or URIs. | |
1016 |
|
1028 | |||
1017 | Returns the first of ``name`` or ``default`` that is present, or None |
|
1029 | Returns None if ``name`` is not a registered path, a URI, or a local | |
1018 | if neither is present. |
|
1030 | path to a repo. | |
1019 | """ |
|
1031 | """ | |
|
1032 | # Only fall back to default if no path was requested. | |||
|
1033 | if name is None: | |||
|
1034 | if default: | |||
|
1035 | try: | |||
|
1036 | return self[default] | |||
|
1037 | except KeyError: | |||
|
1038 | return None | |||
|
1039 | else: | |||
|
1040 | return None | |||
|
1041 | ||||
|
1042 | # Most likely empty string. | |||
|
1043 | # This may need to raise in the future. | |||
|
1044 | if not name: | |||
|
1045 | return None | |||
|
1046 | ||||
1020 | try: |
|
1047 | try: | |
1021 | return self[name] |
|
1048 | return self[name] | |
1022 | except KeyError: |
|
1049 | except KeyError: | |
@@ -1024,15 +1051,10 b' class paths(dict):' | |||||
1024 | try: |
|
1051 | try: | |
1025 | return path(None, rawloc=name) |
|
1052 | return path(None, rawloc=name) | |
1026 | except ValueError: |
|
1053 | except ValueError: | |
1027 | pass |
|
1054 | raise error.RepoError(_('repository %s does not exist') % | |
|
1055 | name) | |||
1028 |
|
1056 | |||
1029 | if default is not None: |
|
1057 | assert False | |
1030 | try: |
|
|||
1031 | return self[default] |
|
|||
1032 | except KeyError: |
|
|||
1033 | pass |
|
|||
1034 |
|
||||
1035 | return None |
|
|||
1036 |
|
1058 | |||
1037 | class path(object): |
|
1059 | class path(object): | |
1038 | """Represents an individual path and its configuration.""" |
|
1060 | """Represents an individual path and its configuration.""" |
@@ -45,3 +45,9 b" Push should push to 'default-push' when " | |||||
45 | adding manifests |
|
45 | adding manifests | |
46 | adding file changes |
|
46 | adding file changes | |
47 | added 1 changesets with 1 changes to 1 files |
|
47 | added 1 changesets with 1 changes to 1 files | |
|
48 | ||||
|
49 | Pushing to a path that isn't defined should not fall back to default | |||
|
50 | ||||
|
51 | $ hg --cwd b push doesnotexist | |||
|
52 | abort: repository doesnotexist does not exist! | |||
|
53 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now