changeset 35311:12ce62c72c24

patch: catch unexpected case in _inlinediff If operation is neither 'diff.inserted' or 'diff.deleted', label and token won't be define. This patch explicitely catches that exception.
author Matthieu Laneuville <matthieu.laneuville@octobus.net>
date Fri, 08 Dec 2017 16:54:59 +0900
parents 10cce12fdcd3
children 73abb81ccb28
files mercurial/patch.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Fri Dec 08 16:47:18 2017 +0900
+++ b/mercurial/patch.py	Fri Dec 08 16:54:59 2017 +0900
@@ -2575,6 +2575,9 @@
         token = '+'
         s2 = s2[1:]
         s1 = s1[1:]
+    else:
+        raise error.ProgrammingError("Case not expected, operation = %s" %
+                                     operation)
 
     s = difflib.ndiff(re.split(br'(\W)', s2), re.split(br'(\W)', s1))
     for part in s: