Warn if one of the marks, mapping, or heads files are empty

This commit is contained in:
Frej Drejhammar
2016-04-03 15:48:03 +02:00
parent b7cc6ab3bf
commit 7224e420a7

View File

@@ -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):