evolve: compatibility with coming 3.6 stable
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 12 Oct 2015 01:22:41 -0700
branchstable
changeset 1511 91b6a30424a3
parent 1503 e8f7e4c53537
child 1512 c40108ae8fb0
child 1518 bca3fce56b2c
evolve: compatibility with coming 3.6 Some function in the import stack changed, we have to adapt.
README
hgext/evolve.py
--- a/README	Mon Sep 14 13:48:34 2015 -0700
+++ b/README	Mon Oct 12 01:22:41 2015 -0700
@@ -53,6 +53,7 @@
 
 5.2.1 --
 
+- add compatibility with Mercurial 3.6
 - prune: fixed possible issue with lock and bookmark
 - next/prev: fixed possible issue with lock and bookmark
 
--- a/hgext/evolve.py	Mon Sep 14 13:48:34 2015 -0700
+++ b/hgext/evolve.py	Mon Oct 12 01:22:41 2015 -0700
@@ -1029,7 +1029,11 @@
 @eh.wrapfunction(mercurial.cmdutil, 'tryimportone')
 def tryimportone(orig, ui, repo, hunk, parents, opts, *args, **kwargs):
     extracted = patch.extract(ui, hunk)
-    expected = extracted[5]
+    if util.safehasattr(extracted, 'get'):
+        # mercurial 3.6 return a dictionary there
+        expected = extracted.get('nodeid')
+    else:
+        expected = extracted[5]
     if expected is not None:
         expected = node.bin(expected)
     oldextract = patch.extract