ui: store pushloc as separate attribute
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 06 Dec 2015 11:49:02 -0800
changeset 27264 e07003a94ef3
parent 27263 4efb36ecaaec
child 27265 47539ea08bdb
ui: store pushloc as separate attribute The magic @property is going to interfere with the ability to print path sub-options. We only access it in one location and it is trivial to in-line, so do that.
mercurial/commands.py
mercurial/ui.py
--- a/mercurial/commands.py	Sat Dec 05 23:37:46 2015 -0800
+++ b/mercurial/commands.py	Sun Dec 06 11:49:02 2015 -0800
@@ -5639,7 +5639,8 @@
     if not path:
         raise error.Abort(_('default repository not configured!'),
                          hint=_('see the "path" section in "hg help config"'))
-    dest, branches = path.pushloc, (path.branch, opts.get('branch') or [])
+    dest = path.pushloc or path.loc
+    branches = (path.branch, opts.get('branch') or [])
     ui.status(_('pushing to %s\n') % util.hidepassword(dest))
     revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
     other = hg.peer(repo, opts, dest)
--- a/mercurial/ui.py	Sat Dec 05 23:37:46 2015 -0800
+++ b/mercurial/ui.py	Sun Dec 06 11:49:02 2015 -0800
@@ -1081,7 +1081,7 @@
             # bit weird, but is allowed for backwards compatibility.
             if 'default' not in self:
                 self['default'] = path('default', rawloc=defaultpush)
-            self['default']._pushloc = defaultpush
+            self['default'].pushloc = defaultpush
 
     def getpath(self, name, default=None):
         """Return a ``path`` from a string, falling back to a default.
@@ -1149,7 +1149,7 @@
         self.name = name
         self.rawloc = rawloc
         self.loc = str(u)
-        self._pushloc = pushloc
+        self.pushloc = pushloc
 
         # When given a raw location but not a symbolic name, validate the
         # location is valid.
@@ -1164,10 +1164,6 @@
         one)."""
         return os.path.isdir(os.path.join(path, '.hg'))
 
-    @property
-    def pushloc(self):
-        return self._pushloc or self.loc
-
 # we instantiate one globally shared progress bar to avoid
 # competing progress bars when multiple UI objects get created
 _progresssingleton = None