import: handle patch with no node information
patch created by old Mercurial version or other tool have no node information.
We cannot create marker in this case.
--- a/hgext/evolve.py Thu Aug 14 15:14:18 2014 -0700
+++ b/hgext/evolve.py Thu Aug 14 15:17:02 2014 -0700
@@ -933,7 +933,8 @@
def tryimportone(orig, ui, repo, hunk, parents, opts, *args, **kwargs):
extracted = patch.extract(ui, hunk)
expected = extracted[5]
- expected = node.bin(expected)
+ if extracted is not None:
+ expected = node.bin(expected)
oldextract = patch.extract
try:
patch.extract = lambda ui, hunk: extracted
@@ -941,7 +942,8 @@
finally:
patch.extract = oldextract
created = ret[1]
- if opts['obsolete'] and created is not None and created != expected:
+ if (opts['obsolete'] and None not in (created, expected)
+ and created != expected):
tr = repo.transaction('import-obs')
try:
metadata = {'user': ui.username()}