From b7cc6ab3bfecaea47105c23739b289461c2bf347 Mon Sep 17 00:00:00 2001 From: Frej Drejhammar Date: Sat, 2 Apr 2016 15:01:45 +0200 Subject: [PATCH] verify_heads() needs to be aware of the branch renaming map As all branches created on the git side are transformed by sanitize_name(), this should be a safe backwards compatible change. If a user is doing incremental imports and sanitize_name() now suddenly modifies the branch name, verify_heads() would already have complained on the first incremental run. Thanks goes to Steve Tousignant for discovering the problem. --- hg-fast-export.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hg-fast-export.py b/hg-fast-export.py index ffc6573..5263b3f 100755 --- a/hg-fast-export.py +++ b/hg-fast-export.py @@ -327,7 +327,7 @@ def branchtip(repo, heads): break return tip -def verify_heads(ui,repo,cache,force): +def verify_heads(ui,repo,cache,force,branchesmap): branches={} for bn, heads in repo.branchmap().iteritems(): branches[bn] = branchtip(repo, heads) @@ -337,7 +337,7 @@ def verify_heads(ui,repo,cache,force): # get list of hg's branches to verify, don't take all git has for _,_,b in l: b=get_branch(b) - sha1=get_git_sha1(b) + sha1=get_git_sha1(sanitize_name(b,"branch",branchesmap)) c=cache.get(b) if sha1!=c: sys.stderr.write('Error: Branch [%s] modified outside hg-fast-export:' @@ -368,7 +368,7 @@ def hg2git(repourl,m,marksfile,mappingfile,headsfile,tipfile, ui,repo=setup_repo(repourl) - if not verify_heads(ui,repo,heads_cache,force): + if not verify_heads(ui,repo,heads_cache,force,branchesmap): return 1 try: -- 2.11.4.GIT