compat: make obshistory._getdifflines compatible with mercurial 4.1
authorBoris Feld <boris.feld@octobus.net>
Thu, 15 Jun 2017 20:40:07 +0200
changeset 2592 fb33d856d25e
parent 2591 1991935fb603
child 2593 ed977325cd2a
compat: make obshistory._getdifflines compatible with mercurial 4.1 On Mercurial version 4.1 and lower, patch.diff seems to returns an empty list when there is no change. Mercurial 4.2 returns None so we add a if for this case.
hgext3rd/evolve/obshistory.py
--- a/hgext3rd/evolve/obshistory.py	Fri Jun 09 00:52:54 2017 +0100
+++ b/hgext3rd/evolve/obshistory.py	Thu Jun 15 20:40:07 2017 +0200
@@ -484,6 +484,9 @@
 def _getdifflines(iterdiff):
     """return a cleaned up lines"""
     try:
+        # XXX-COMPAT Mercurial 4.1 compat
+        if isinstance(iterdiff, list) and len(iterdiff) == 0:
+            return None
         lines = iterdiff.next()
     except StopIteration:
         return None