mercurial/patch.py
changeset 30819 897726622877
parent 30808 8540967cd9e0
child 30924 48dea083f66d
--- a/mercurial/patch.py	Fri Jan 13 20:16:56 2017 -0800
+++ b/mercurial/patch.py	Sun Jan 15 16:33:15 2017 +0900
@@ -2184,6 +2184,9 @@
                 # the hash config could be an integer (for length of hash) or a
                 # word (e.g. short, full, none)
                 hlen = int(hconf)
+                if hlen < 0 or hlen > 40:
+                    msg = _("invalid length for extendedheader.index: '%d'\n")
+                    ui.warn(msg % hlen)
             except ValueError:
                 # default value
                 if hconf == 'short' or hconf == '':
@@ -2194,9 +2197,6 @@
                     msg = _("invalid value for extendedheader.index: '%s'\n")
                     ui.warn(msg % hconf)
             finally:
-                if hlen < 0 or hlen > 40:
-                    msg = _("invalid length for extendedheader.index: '%d'\n")
-                    ui.warn(msg % hlen)
                 buildopts['index'] = hlen
 
     if whitespace: