##// END OF EJS Templates
ui: capture push location on path instances...
Gregory Szorc -
r26064:1b1ab6ff default
parent child Browse files
Show More
@@ -996,8 +996,18 b' class paths(dict):'
996 996 # No location is the same as not existing.
997 997 if not loc:
998 998 continue
999
1000 # TODO ignore default-push once all consumers stop referencing it
1001 # since it is handled specifically below.
1002
999 1003 self[name] = path(name, rawloc=loc)
1000 1004
1005 # Handle default-push, which is a one-off that defines the push URL for
1006 # the "default" path.
1007 defaultpush = ui.config('paths', 'default-push')
1008 if defaultpush and 'default' in self:
1009 self['default']._pushloc = defaultpush
1010
1001 1011 def getpath(self, name, default=None):
1002 1012 """Return a ``path`` from a string, falling back to a default.
1003 1013
@@ -1027,11 +1037,12 b' class paths(dict):'
1027 1037 class path(object):
1028 1038 """Represents an individual path and its configuration."""
1029 1039
1030 def __init__(self, name, rawloc=None):
1040 def __init__(self, name, rawloc=None, pushloc=None):
1031 1041 """Construct a path from its config options.
1032 1042
1033 1043 ``name`` is the symbolic name of the path.
1034 1044 ``rawloc`` is the raw location, as defined in the config.
1045 ``pushloc`` is the raw locations pushes should be made to.
1035 1046
1036 1047 If ``name`` is not defined, we require that the location be a) a local
1037 1048 filesystem path with a .hg directory or b) a URL. If not,
@@ -1053,6 +1064,7 b' class path(object):'
1053 1064 self.name = name
1054 1065 self.rawloc = rawloc
1055 1066 self.loc = str(u)
1067 self._pushloc = pushloc
1056 1068
1057 1069 # When given a raw location but not a symbolic name, validate the
1058 1070 # location is valid.
@@ -1061,6 +1073,10 b' class path(object):'
1061 1073 raise ValueError('location is not a URL or path to a local '
1062 1074 'repo: %s' % rawloc)
1063 1075
1076 @property
1077 def pushloc(self):
1078 return self._pushloc or self.loc
1079
1064 1080 # we instantiate one globally shared progress bar to avoid
1065 1081 # competing progress bars when multiple UI objects get created
1066 1082 _progresssingleton = None
General Comments 0
You need to be logged in to leave comments. Login now