revset: define "pat" variable unconditionally in subrepo()
It's a source of UnboundLocalError to define and use local variables
conditionally. As getstring() always returns a str, "pat" can be initialized
to None.
--- a/mercurial/revset.py Tue May 05 10:47:35 2015 +0900
+++ b/mercurial/revset.py Sat Feb 13 20:13:45 2016 +0900
@@ -1982,6 +1982,7 @@
"""
# i18n: "subrepo" is a keyword
args = getargs(x, 0, 1, _('subrepo takes at most one argument'))
+ pat = None
if len(args) != 0:
pat = getstring(args[0], _("subrepo requires a pattern"))
@@ -1997,7 +1998,7 @@
c = repo[x]
s = repo.status(c.p1().node(), c.node(), match=m)
- if len(args) == 0:
+ if pat is None:
return s.added or s.modified or s.removed
if s.added: