mirror of
https://github.com/frej/fast-export.git
synced 2025-11-02 17:25:48 +01:00
hg2git.py: Bail out for certain errors
New is that we also check for multiple tips having the same branch name, i.e. no unnamed heads. Signed-off-by: Rocco Rutte <pdmef@gmx.net>
This commit is contained in:
18
hg2git.py
18
hg2git.py
@@ -65,7 +65,7 @@ def get_branch(name):
|
|||||||
name=cfg_master
|
name=cfg_master
|
||||||
return name
|
return name
|
||||||
|
|
||||||
def get_changeset(ui,repo,revision,authors):
|
def get_changeset(ui,repo,revision,authors={}):
|
||||||
node=repo.lookup(revision)
|
node=repo.lookup(revision)
|
||||||
(manifest,user,(time,timezone),files,desc,extra)=repo.changelog.read(node)
|
(manifest,user,(time,timezone),files,desc,extra)=repo.changelog.read(node)
|
||||||
tz="%+03d%02d" % (-timezone / 3600, ((-timezone % 3600) / 60))
|
tz="%+03d%02d" % (-timezone / 3600, ((-timezone % 3600) / 60))
|
||||||
@@ -332,19 +332,31 @@ def verify_heads(ui,repo,cache):
|
|||||||
except IOError:
|
except IOError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# get list of hg's branches to verify, don't take all git has
|
|
||||||
branches=repo.branchtags()
|
branches=repo.branchtags()
|
||||||
l=[(-repo.changelog.rev(n), n, t) for t, n in branches.items()]
|
l=[(-repo.changelog.rev(n), n, t) for t, n in branches.items()]
|
||||||
l.sort()
|
l.sort()
|
||||||
|
|
||||||
|
# get list of hg's branches to verify, don't take all git has
|
||||||
for _,_,b in l:
|
for _,_,b in l:
|
||||||
b=get_branch(b)
|
b=get_branch(b)
|
||||||
sys.stderr.write('Verifying branch [%s]\n' % b)
|
sys.stderr.write('Verifying branch [%s]\n' % b)
|
||||||
sha1=getsha1(b)
|
sha1=getsha1(b)
|
||||||
c=cache.get(b)
|
c=cache.get(b)
|
||||||
if sha1!=c:
|
if sha1!=c:
|
||||||
sys.stderr.write('Warning: Branch [%s] modified outside hg2git:'
|
sys.stderr.write('Error: Branch [%s] modified outside hg2git:'
|
||||||
'\n%s (repo) != %s (cache)\n' % (b,sha1,c))
|
'\n%s (repo) != %s (cache)\n' % (b,sha1,c))
|
||||||
|
return False
|
||||||
|
|
||||||
|
# verify that branch has exactly one head
|
||||||
|
t={}
|
||||||
|
for h in repo.heads():
|
||||||
|
(_,_,_,_,_,branch,_)=get_changeset(ui,repo,h)
|
||||||
|
if t.get(branch,False):
|
||||||
|
sys.stderr.write('Error: repository has at least one unnamed head: hg r%s\n' %
|
||||||
|
repo.changelog.rev(h))
|
||||||
|
return False
|
||||||
|
t[branch]=True
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def hg2git(repourl,m,marksfile,headsfile,tipfile,authors={},sob=False):
|
def hg2git(repourl,m,marksfile,headsfile,tipfile,authors={},sob=False):
|
||||||
|
|||||||
Reference in New Issue
Block a user