changeset 906:286555803dae

git_handler: update for bookmark changes in mercurial 3.5
author Sean Farley <sean@farley.io>
date Tue, 12 May 2015 17:05:13 -0700
parents d8ac1b54766b
children d153586c28f8
files hggit/git_handler.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -262,7 +262,11 @@
                 bms = getattr(self.repo['tip'], 'bookmarks',
                               lambda: None)()
                 if bms:
-                    bookmarks.setcurrent(self.repo, bms[0])
+                    try:
+                        bookmarks.activate(self.repo, bms[0])
+                    except AttributeError:
+                        # hg < 3.5
+                        bookmarks.setcurrent(self.repo, bms[0])
 
         self.save_map(self.map_file)
 
@@ -1010,7 +1014,11 @@
                     except NameError:
                         bookmarks.bookmark(self.ui, self.repo, 'master',
                                            rev=tip, force=True)
-                    bookmarks.setcurrent(self.repo, 'master')
+                    try:
+                        bookmarks.activate(self.repo, 'master')
+                    except AttributeError:
+                        # hg < 3.5
+                        bookmarks.setcurrent(self.repo, 'master')
                     new_refs['refs/heads/master'] = self.map_git_get(tip)
 
         for rev, rev_refs in exportable.iteritems():