mercurial/ui.py
changeset 27264 e07003a94ef3
parent 27253 f43988e5954c
child 27265 47539ea08bdb
equal deleted inserted replaced
27263:4efb36ecaaec 27264:e07003a94ef3
  1079         if defaultpush:
  1079         if defaultpush:
  1080             # "default-push" can be defined without "default" entry. This is a
  1080             # "default-push" can be defined without "default" entry. This is a
  1081             # bit weird, but is allowed for backwards compatibility.
  1081             # bit weird, but is allowed for backwards compatibility.
  1082             if 'default' not in self:
  1082             if 'default' not in self:
  1083                 self['default'] = path('default', rawloc=defaultpush)
  1083                 self['default'] = path('default', rawloc=defaultpush)
  1084             self['default']._pushloc = defaultpush
  1084             self['default'].pushloc = defaultpush
  1085 
  1085 
  1086     def getpath(self, name, default=None):
  1086     def getpath(self, name, default=None):
  1087         """Return a ``path`` from a string, falling back to a default.
  1087         """Return a ``path`` from a string, falling back to a default.
  1088 
  1088 
  1089         ``name`` can be a named path or locations. Locations are filesystem
  1089         ``name`` can be a named path or locations. Locations are filesystem
  1147         self.branch = branch
  1147         self.branch = branch
  1148 
  1148 
  1149         self.name = name
  1149         self.name = name
  1150         self.rawloc = rawloc
  1150         self.rawloc = rawloc
  1151         self.loc = str(u)
  1151         self.loc = str(u)
  1152         self._pushloc = pushloc
  1152         self.pushloc = pushloc
  1153 
  1153 
  1154         # When given a raw location but not a symbolic name, validate the
  1154         # When given a raw location but not a symbolic name, validate the
  1155         # location is valid.
  1155         # location is valid.
  1156         if not name and not u.scheme and not self._isvalidlocalpath(self.loc):
  1156         if not name and not u.scheme and not self._isvalidlocalpath(self.loc):
  1157             raise ValueError('location is not a URL or path to a local '
  1157             raise ValueError('location is not a URL or path to a local '
  1161         """Returns True if the given path is a potentially valid repository.
  1161         """Returns True if the given path is a potentially valid repository.
  1162         This is its own function so that extensions can change the definition of
  1162         This is its own function so that extensions can change the definition of
  1163         'valid' in this case (like when pulling from a git repo into a hg
  1163         'valid' in this case (like when pulling from a git repo into a hg
  1164         one)."""
  1164         one)."""
  1165         return os.path.isdir(os.path.join(path, '.hg'))
  1165         return os.path.isdir(os.path.join(path, '.hg'))
  1166 
       
  1167     @property
       
  1168     def pushloc(self):
       
  1169         return self._pushloc or self.loc
       
  1170 
  1166 
  1171 # we instantiate one globally shared progress bar to avoid
  1167 # we instantiate one globally shared progress bar to avoid
  1172 # competing progress bars when multiple UI objects get created
  1168 # competing progress bars when multiple UI objects get created
  1173 _progresssingleton = None
  1169 _progresssingleton = None
  1174 
  1170