[PATCH 2 of 4] convert: add bookmarks reading support to git backend

Edouard Gomez ed.gomez at free.fr
Tue Jul 6 17:11:46 CDT 2010


# HG changeset patch
# User Edouard Gomez <ed.gomez at free.fr>
# Date 1278454019 -7200
# Node ID 5726214b3e86e4f0ccdc47c7b39d466073aac5bd
# Parent  040f2b92d9bc39e19688ab037c88d2d59a3e940a
convert: add bookmarks reading support to git backend

diff --git a/hgext/convert/git.py b/hgext/convert/git.py
--- a/hgext/convert/git.py
+++ b/hgext/convert/git.py
@@ -167,3 +167,17 @@
             raise util.Abort(_('cannot read changes in %s') % version)
 
         return changes
+
+    def getbookmarks(self):
+        bookmarks = {}
+        fh = self.gitopen('git ls-remote --heads origin')
+        prefix = 'refs/heads/'
+        prefixlen = len(prefix)
+        for line in fh:
+            line = line.strip()
+            rev, name = line.split(None, 1)
+            if not name.startswith(prefix):
+                continue
+            name = name[prefixlen:]
+            bookmarks[name] = rev
+        return bookmarks


More information about the Mercurial-devel mailing list