# HG changeset patch # User Pierre-Yves David # Date 1499008415 -7200 # Node ID 189fd9d6a405d180347025cefb03e6f85a504d52 # Parent a32afe67e8a60501b01491d1cdd1d1da77e99645 obslog: handle patch generation for mercurial 4.1- The unidiff API changed, we detect and work around that. diff -r a32afe67e8a6 -r 189fd9d6a405 hgext3rd/evolve/obshistory.py --- a/hgext3rd/evolve/obshistory.py Sun Jul 02 16:39:48 2017 +0200 +++ b/hgext3rd/evolve/obshistory.py Sun Jul 02 17:13:35 2017 +0200 @@ -172,11 +172,15 @@ succname = "%s-changeset-description" % succctx d = mdiff.unidiff(basedesc, '', succdesc, '', basename, succname) - uheaders, hunks = d + # mercurial 4.1 and before return the patch directly + if not isinstance(d, tuple): + patch = d + else: + uheaders, hunks = d - # Copied from patch.diff - text = ''.join(sum((list(hlines) for hrange, hlines in hunks), [])) - patch = "\n".join(uheaders + [text]) + # Copied from patch.diff + text = ''.join(sum((list(hlines) for hrange, hlines in hunks), [])) + patch = "\n".join(uheaders + [text]) return _indent(patch) class missingchangectx(object):