diff hggit/git_handler.py @ 379:ed8034b1cb0d

Made hggit.git_handler.get_changed_refs try to use commands.bookmark before trying with bookmarks.bookmark, for compatibility with Mercurial 1.8+.
author DontCare4Free <webmaster@dontcare4free.tk>
date Thu, 24 Mar 2011 00:13:59 +0100
parents b4f5f2729acb
children 249ee603cb5c
line wrap: on
line diff
--- a/hggit/git_handler.py	Tue Mar 01 08:24:36 2011 -0600
+++ b/hggit/git_handler.py	Thu Mar 24 00:13:59 2011 +0100
@@ -10,6 +10,7 @@
 try:
     from mercurial import bookmarks
     bookmarks.update
+    from mercurial import commands
 except ImportError:
     from hgext import bookmarks
 from mercurial.i18n import _
@@ -564,7 +565,10 @@
             del new_refs['capabilities^{}']
             if not self.local_heads():
                 tip = hex(self.repo.lookup('tip'))
-                bookmarks.bookmark(self.ui, self.repo, 'master', tip, force=True)
+		try:
+			commands.bookmark(self.ui, self.repo, 'master', tip, force=True)
+		except NameError:
+	                bookmarks.bookmark(self.ui, self.repo, 'master', tip, force=True)
                 bookmarks.setcurrent(self.repo, 'master')
                 new_refs['refs/heads/master'] = self.map_git_get(tip)