comparison mercurial/cmdutil.py @ 9118:78e54b9f3a62

cmdutil: fall back to filename if glob expand has errors On Windows, Mercurial tries to glob expand provided filenames as a convenience to the user. Unfortunately, there are valid filenames which are not valid glob patterns. In those cases, we should fallback to the original provided filename.
author Steve Borho <steve@borho.org>
date Sun, 12 Jul 2009 00:46:43 -0500
parents 4a1187d3cb00
children 1ef630452e0b
comparison
equal deleted inserted replaced
9113:f439d82f018c 9118:78e54b9f3a62
240 return list(pats) 240 return list(pats)
241 ret = [] 241 ret = []
242 for p in pats: 242 for p in pats:
243 kind, name = _match._patsplit(p, None) 243 kind, name = _match._patsplit(p, None)
244 if kind is None: 244 if kind is None:
245 globbed = glob.glob(name) 245 try:
246 globbed = glob.glob(name)
247 except re.error:
248 globbed = [name]
246 if globbed: 249 if globbed:
247 ret.extend(globbed) 250 ret.extend(globbed)
248 continue 251 continue
249 ret.append(p) 252 ret.append(p)
250 return ret 253 return ret