Commits

Anonymous committed 5791023 Merge

Merge

Comments (0)

Files changed (2)

mercurial_reviewboard/__init__.py

 import cStringIO
 import operator
 
-from mercurial import cmdutil, hg, ui, mdiff, patch, util
+from distutils.version import LooseVersion
+from mercurial import cmdutil, hg, ui, mdiff, patch, util, localrepo
 from mercurial.i18n import _
 from mercurial.commands import bundle, unbundle
 
 
 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:
         return repo.findoutgoing(remoterepo)
 
     try:
-        outgoing = discovery.findcommonoutgoing(repo, remoterepo)
-        return outgoing.missing
+        if LooseVersion(util.version()) >= LooseVersion('2.1'):
+            outgoing = discovery.findcommonoutgoing(repo, remoterepo)
+            return outgoing.missing
+        common, outheads = discovery.findcommonoutgoing(repo, remoterepo)
+        return repo.changelog.findmissing(common=common, heads=outheads)
     except AttributeError:
         # Must be earlier than 1.9
         return discovery.findoutgoing(repo, remoterepo)

mercurial_reviewboard/reviewboard.py

File contents unchanged.