286555803dae — Sean Farley 7 years ago
git_handler: update for bookmark changes in mercurial 3.5
1 files changed, 10 insertions(+), 2 deletions(-)

M hggit/git_handler.py
M hggit/git_handler.py +10 -2
@@ 262,7 262,11 @@ class GitHandler(object):
                 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 @@ class GitHandler(object):
                     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():