reviewboard: adapt discovery repo code to Mercurial 4.4 (bug 1413628); r?glob draft
authorGregory Szorc <gps@mozilla.com>
Thu, 02 Nov 2017 12:46:26 -0700
changeset 11787 37f0b566d740352a33fb5eae5a9e132bf256b353
parent 11786 0531b5b87f4145c3edd2784a0597c4b20551b089
child 11788 43508692ed23f922bd7738324e0ccd2082686ccb
push id1816
push usergszorc@mozilla.com
push dateThu, 02 Nov 2017 19:46:54 +0000
reviewersglob
bugs1413628
reviewboard: adapt discovery repo code to Mercurial 4.4 (bug 1413628); r?glob Mercurial 4.4 renamed some httppeer attributes. Add some code to look for both names and set the appropriate one. This fixes a test failure in test-repo-discovery.t. MozReview-Commit-ID: 7zqYJkqLBq6
hgext/reviewboard/client.py
--- a/hgext/reviewboard/client.py
+++ b/hgext/reviewboard/client.py
@@ -279,24 +279,32 @@ def wrappedpush(orig, repo, remote, forc
         # the remote below.
         if newurl.host != oldurl.host:
             raise util.Abort(_('refusing to redirect due to URL mismatch: %s' %
                 newurl))
 
         repo.ui.status(_('redirecting push to %s\n') % newurl)
 
         if isinstance(remote, httppeer.httppeer):
+            # TRACKING various attributes renamed in Mercurial 4.4.
             remote._url = str(newurl)
 
             newurl.user = oldurl.user
             newurl.passwd = oldurl.passwd
-            remote.path = str(newurl)
+
+            if util.safehasattr(remote, '_path'):
+                remote._path = str(newurl)
+            else:
+                remote.path = str(newurl)
 
             # Wipe out cached capabilities.
-            remote.caps = None
+            if util.safehasattr(remote, '_caps'):
+                remote._caps = None
+            else:
+                remote.caps = None
 
             newremote = remote
 
         elif isinstance(remote, sshpeer.sshpeer):
             newurl.user = oldurl.user
 
             # SSH remotes establish processes. We can't simply monkeypatch
             # the instance.