frej / fast-export

A mercurial to git converter using git-fast-import
http://repo.or.cz/w/fast-export.git
808 stars 255 forks source link

Make sure parameter is not None #269

Closed gotoh closed 3 years ago

gotoh commented 3 years ago

This fix avoids the exception while making a error message caused by the parameter 'c' is None when we start first exporting onto non empty git repo, 'c' should be checked like 'sha1'.

Output before fix:

$ sh /c/develop/fast-export/hg-fast-export.sh -r ../../hgrepo/TaiyoLaser-hg -e cp932 --fe cp932 -M main
Traceback (most recent call last):
  File "/c/develop/fast-export/hg-fast-export.py", line 729, in <module>
    sys.exit(hg2git(options.repourl,m,options.marksfile,options.mappingfile,
  File "/c/develop/fast-export/hg-fast-export.py", line 548, in hg2git
    if not verify_heads(ui,repo,heads_cache,force,ignore_unnamed_heads,branchesmap):
  File "/c/develop/fast-export/hg-fast-export.py", line 504, in verify_heads
    b'Error: Branch [%s] modified outside hg-fast-export:'
TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'NoneType'
fast-import statistics:
...

Output after fix:

Error: Branch [main] modified outside hg-fast-export:
3b903ad701dc0942c99b1d7ae7ca3d481cab3928 (repo) != None (cache)
fast-import statistics:
...
gotoh commented 3 years ago

Yes, you fixed my issue correctly. I'll close this PR.

frej commented 3 years ago

Thanks @gotoh, I'll merge #270.