From 7224e420a75fe1d6a78551522b1f7c5058eed788 Mon Sep 17 00:00:00 2001 From: Frej Drejhammar Date: Sun, 3 Apr 2016 15:48:03 +0200 Subject: [PATCH] Warn if one of the marks, mapping, or heads files are empty --- hg-fast-export.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hg-fast-export.py b/hg-fast-export.py index 5263b3f..325c26d 100755 --- a/hg-fast-export.py +++ b/hg-fast-export.py @@ -359,6 +359,10 @@ def verify_heads(ui,repo,cache,force,branchesmap): def hg2git(repourl,m,marksfile,mappingfile,headsfile,tipfile, authors={},branchesmap={},tagsmap={}, sob=False,force=False,hgtags=False,notes=False,encoding='',fn_encoding=''): + def check_cache(filename, contents): + if len(contents) == 0: + sys.stderr.write('Warning: %s does not contain any data, this will probably make an incremental import fail\n' % filename) + _max=int(m) old_marks=load_cache(marksfile,lambda s: int(s)-1) @@ -366,6 +370,12 @@ def hg2git(repourl,m,marksfile,mappingfile,headsfile,tipfile, heads_cache=load_cache(headsfile) state_cache=load_cache(tipfile) + if len(state_cache) != 0: + for (name, data) in [(marksfile, old_marks), + (mappingfile, mapping_cache), + (headsfile, state_cache)]: + check_cache(name, data) + ui,repo=setup_repo(repourl) if not verify_heads(ui,repo,heads_cache,force,branchesmap): -- 2.11.4.GIT