hg2git.py: Don't complain die for non-existent heads

Previously, when no head was present under .git/refs/heads, we simply
died as we couldn't open the file. Now, simply return None in case we
cannot read from it.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
This commit is contained in:
Rocco Rutte
2007-03-12 11:13:48 +00:00
parent e448736a0b
commit 191928202b

View File

@@ -307,10 +307,13 @@ def save_cache(filename,cache):
def verify_heads(ui,repo,cache):
def getsha1(branch):
f=open(os.getenv('GIT_DIR','/dev/null')+'/refs/heads/'+branch)
sha1=f.readlines()[0].split('\n')[0]
f.close()
return sha1
try:
f=open(os.getenv('GIT_DIR','/dev/null')+'/refs/heads/'+branch)
sha1=f.readlines()[0].split('\n')[0]
f.close()
return sha1
except IOError:
return None
# get list of hg's branches to verify, don't take all git has
branches=repo.branchtags()