converting fails on an old .hgsubstrate
Created originally on Bitbucket by mattip
I get an error when trying to parse an .hgsubstate
file that has the format
80037 greenlet
80348 lib_pypy/pyrepl
80409 testrunner
This is from the bitbucket.org/pypy/pypy repo.
The problem is that the first field is not a sha hash, as expected. The following change “fixed” it (by ignoring the lines)
$ hg diff
diff -r aa15905ca87f hggit/util.py
--- a/hggit/util.py Wed Aug 07 11:47:57 2019 -0500
+++ b/hggit/util.py Wed Aug 21 14:56:38 2019 +0300
@@ -44,6 +44,9 @@
if not ls or ls[0] == '#':
continue
value, name = l.split(' ', 1)
+ # value must be a sha hash
+ if len(value) != 40:
+ value = '0' * 40
rv[name.strip()] = value.strip()
return rv