mozhg: access active bookmark properly (bug 1241615); r?dminor draft
authorGregory Szorc <gps@mozilla.com>
Thu, 21 Jan 2016 17:55:21 -0800
changeset 6913 461015a1274be53cb40c6a0e7f729cc9ec12df32
parent 6912 f8f880b536482ef6499795c083301a40f5d7fc88
push id545
push usergszorc@mozilla.com
push dateFri, 22 Jan 2016 02:05:16 +0000
reviewersdminor
bugs1241615
mozhg: access active bookmark properly (bug 1241615); r?dminor Mercurial 3.7 changed the API yet again. It looks like repo._activebookmark is the most appropriate way to access the active bookmark, so just use that if it is defined.
pylib/mozhg/mozhg/rewrite.py
--- a/pylib/mozhg/mozhg/rewrite.py
+++ b/pylib/mozhg/mozhg/rewrite.py
@@ -13,18 +13,21 @@ import mercurial.hg as hg
 import mercurial.lock as lockmod
 import mercurial.obsolete as obsolete
 import mercurial.phases as phases
 import mercurial.repair as repair
 import mercurial.util as util
 
 
 # Mercurial 3.5 renamed readcurrent to readactive.
+# Mercurial 3.7 renamed readactive to _readactive.
 def activebookmark(repo):
-    if hasattr(bookmarks, 'readactive'):
+    if hasattr(repo, '_activebookmark'):
+        return repo._activebookmark
+    elif hasattr(bookmarks, 'readactive'):
         return bookmarks.readactive(repo)
     else:
         return bookmarks.readcurrent(repo)
 
 
 def newparents(repo, ctx, revmap):
     """Obtain the parent nodes of a potentially rewritten changeset.