comparison hgext/evolve.py @ 1511:91b6a30424a3 stable

evolve: compatibility with coming 3.6 Some function in the import stack changed, we have to adapt.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 12 Oct 2015 01:22:41 -0700
parents e8f7e4c53537
children c40108ae8fb0
comparison
equal deleted inserted replaced
1503:e8f7e4c53537 1511:91b6a30424a3
1027 'the created commit'))) 1027 'the created commit')))
1028 1028
1029 @eh.wrapfunction(mercurial.cmdutil, 'tryimportone') 1029 @eh.wrapfunction(mercurial.cmdutil, 'tryimportone')
1030 def tryimportone(orig, ui, repo, hunk, parents, opts, *args, **kwargs): 1030 def tryimportone(orig, ui, repo, hunk, parents, opts, *args, **kwargs):
1031 extracted = patch.extract(ui, hunk) 1031 extracted = patch.extract(ui, hunk)
1032 expected = extracted[5] 1032 if util.safehasattr(extracted, 'get'):
1033 # mercurial 3.6 return a dictionary there
1034 expected = extracted.get('nodeid')
1035 else:
1036 expected = extracted[5]
1033 if expected is not None: 1037 if expected is not None:
1034 expected = node.bin(expected) 1038 expected = node.bin(expected)
1035 oldextract = patch.extract 1039 oldextract = patch.extract
1036 try: 1040 try:
1037 patch.extract = lambda ui, hunk: extracted 1041 patch.extract = lambda ui, hunk: extracted