Mercurial > hg
comparison contrib/convert-repo @ 4102:06d65498f73b
convert-repo: use .git/objects/ rather than .git/HEAD to detect git repos
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 21 Feb 2007 11:02:37 -0600 |
parents | 6b2909e84203 |
children | d5011e347476 |
comparison
equal
deleted
inserted
replaced
4101:e2ed92f4c0f7 | 4102:06d65498f73b |
---|---|
291 class convert_git: | 291 class convert_git: |
292 def __init__(self, path): | 292 def __init__(self, path): |
293 if os.path.isdir(path + "/.git"): | 293 if os.path.isdir(path + "/.git"): |
294 path += "/.git" | 294 path += "/.git" |
295 self.path = path | 295 self.path = path |
296 if not os.path.exists(path + "/HEAD"): | 296 if not os.path.exists(path + "/objects"): |
297 raise NoRepo("couldn't open GIT repo %s" % path) | 297 raise NoRepo("couldn't open GIT repo %s" % path) |
298 | 298 |
299 def getheads(self): | 299 def getheads(self): |
300 fh = os.popen("GIT_DIR=%s git-rev-parse --verify HEAD" % self.path) | 300 fh = os.popen("GIT_DIR=%s git-rev-parse --verify HEAD" % self.path) |
301 return [fh.read()[:-1]] | 301 return [fh.read()[:-1]] |