comparison contrib/convert-repo @ 2657:e6a7a6a33a62

make convert-repo deal with git symbolic refs. Problem noticed by Sébastien Pierre
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 24 Jul 2006 13:47:29 -0700
parents 5cc414722587
children 158fce02dc40
comparison
equal deleted inserted replaced
2655:df5e58c84b01 2657:e6a7a6a33a62
26 class convert_git: 26 class convert_git:
27 def __init__(self, path): 27 def __init__(self, path):
28 self.path = path 28 self.path = path
29 29
30 def getheads(self): 30 def getheads(self):
31 return [file(self.path + "/HEAD").read()[:-1]] 31 fh = os.popen("GIT_DIR=%s git-rev-parse --verify HEAD" % self.path)
32 return [fh.read()[:-1]]
32 33
33 def catfile(self, rev, type): 34 def catfile(self, rev, type):
34 if rev == "0" * 40: raise IOError() 35 if rev == "0" * 40: raise IOError()
35 fh = os.popen("GIT_DIR=%s git-cat-file %s %s 2>/dev/null" % (self.path, type, rev)) 36 fh = os.popen("GIT_DIR=%s git-cat-file %s %s 2>/dev/null" % (self.path, type, rev))
36 return fh.read() 37 return fh.read()