diff hgext/evolve.py @ 1055:cfe1b9d3e5d9 stable

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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 14 Aug 2014 15:17:02 -0700
parents 93e920feff5e
children 00bc31523074 f3867e60d072
line wrap: on
line diff
--- 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()}