Commits

Anonymous committed 3b88c0c

Make it compatible for mercurial >= 2.3

Fix the problem showing "abort: repository ... is not local"

Comments (0)

Files changed (1)

mercurial_reviewboard/__init__.py

 import operator
 
 from distutils.version import LooseVersion
-from mercurial import cmdutil, hg, ui, mdiff, patch, util
+from mercurial import cmdutil, hg, ui, mdiff, patch, util, localrepo
 from mercurial.i18n import _
 
 from reviewboard import make_rbclient, ReviewBoardError
 
 def remoteparent(ui, repo, ctx, upstream=None):
     remotepath = expandpath(ui, upstream)
-    remoterepo = hg.repository(ui, remotepath)
-    
+
+    if hasattr(localrepo, 'localpeer'):
+        # hg >= 2.3
+        remoterepo = hg.peer(repo, {}, remotepath)
+        other = remoterepo.local()
+        if other is not None:
+            remoterepo = other
+    else:
+        # hg < 2.3
+        remoterepo = hg.repository(ui, remotepath)
+
     out = findoutgoing(repo, remoterepo)
     
     for o in out: