[PATCH] convert: fetch all heads of a git repository

Brendan Cully brendan at kublai.com
Sun Jul 1 15:41:29 CDT 2007


# HG changeset patch
# User Brendan Cully <brendan at kublai.com>
# Date 1183322471 25200
# Node ID e6f7abdd86521b5a149a78b7d25b7d23653c20d5
# Parent  20ec5cc02f1878e6dbb52d2c49b7ad39029a7a3b
convert: fetch all heads of a git repository

diff --git a/hgext/convert/git.py b/hgext/convert/git.py
--- a/hgext/convert/git.py
+++ b/hgext/convert/git.py
@@ -16,8 +16,9 @@ class convert_git(converter_source):
         self.encoding = 'utf-8'
 
     def getheads(self):
-        fh = os.popen("GIT_DIR=%s git-rev-parse --verify HEAD" % self.path)
-        return [fh.read()[:-1]]
+        fh = os.popen("GIT_DIR=%s git-rev-parse --branches" % self.path)
+        heads = fh.read().splitlines()
+        return heads
 
     def catfile(self, rev, type):
         if rev == "0" * 40: raise IOError()


More information about the Mercurial-devel mailing list