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
--- 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.