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>
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()