##// END OF EJS Templates
add debugignore which yields the combined ignore patten of the .hgignore files...
jfh -
r13396:3e66eec9 default
parent child Browse files
Show More
@@ -1351,6 +1351,11 b' def debugdate(ui, date, range=None, **op'
1351 1351 m = util.matchdate(range)
1352 1352 ui.write("match: %s\n" % m(d[0]))
1353 1353
1354 def debugignore(ui, repo, *values, **opts):
1355 """display the combined ignore pattern"""
1356 ignore = repo.dirstate._ignore
1357 ui.write("%s\n" % ignore.includepat)
1358
1354 1359 def debugindex(ui, repo, file_, **opts):
1355 1360 """dump the contents of an index file"""
1356 1361 r = None
@@ -4347,6 +4352,7 b' table = {'
4347 4352 _('[-e] DATE [RANGE]')),
4348 4353 "debugdata": (debugdata, [], _('FILE REV')),
4349 4354 "debugfsinfo": (debugfsinfo, [], _('[PATH]')),
4355 "debugignore": (debugignore, [], ''),
4350 4356 "debugindex": (debugindex,
4351 4357 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
4352 4358 _('FILE')),
@@ -39,11 +39,11 b' class match(object):'
39 39 self._anypats = bool(include or exclude)
40 40
41 41 if include:
42 im = _buildmatch(_normalize(include, 'glob', root, cwd, auditor),
43 '(?:/|$)')
42 pats = _normalize(include, 'glob', root, cwd, auditor)
43 self.includepat, im = _buildmatch(pats, '(?:/|$)')
44 44 if exclude:
45 em = _buildmatch(_normalize(exclude, 'glob', root, cwd, auditor),
46 '(?:/|$)')
45 pats = _normalize(exclude, 'glob', root, cwd, auditor)
46 self.excludepat, em = _buildmatch(pats, '(?:/|$)')
47 47 if exact:
48 48 self._files = patterns
49 49 pm = self.exact
@@ -51,7 +51,7 b' class match(object):'
51 51 pats = _normalize(patterns, default, root, cwd, auditor)
52 52 self._files = _roots(pats)
53 53 self._anypats = self._anypats or _anypats(pats)
54 pm = _buildmatch(pats, '$')
54 self.patternspat, pm = _buildmatch(pats, '$')
55 55
56 56 if patterns or exact:
57 57 if include:
@@ -246,7 +246,7 b' def _buildmatch(pats, tail):'
246 246 pat = '(?:%s)' % '|'.join([_regex(k, p, tail) for (k, p) in pats])
247 247 if len(pat) > 20000:
248 248 raise OverflowError()
249 return re.compile(pat).match
249 return pat, re.compile(pat).match
250 250 except OverflowError:
251 251 # We're using a Python with a tiny regex engine and we
252 252 # made it explode, so we'll divide the pattern list in two
@@ -254,8 +254,9 b' def _buildmatch(pats, tail):'
254 254 l = len(pats)
255 255 if l < 2:
256 256 raise
257 a, b = _buildmatch(pats[:l//2], tail), _buildmatch(pats[l//2:], tail)
258 return lambda s: a(s) or b(s)
257 pata, a = _buildmatch(pats[:l//2], tail),
258 patb, b = _buildmatch(pats[l//2:], tail)
259 return pat, lambda s: a(s) or b(s)
259 260 except re.error:
260 261 for k, p in pats:
261 262 try:
@@ -75,6 +75,7 b' Show debug commands if there are no othe'
75 75 debugdata
76 76 debugdate
77 77 debugfsinfo
78 debugignore
78 79 debugindex
79 80 debugindexdot
80 81 debuginstall
@@ -214,6 +215,7 b' Show all commands + options'
214 215 debugdata:
215 216 debugdate: extended
216 217 debugfsinfo:
218 debugignore:
217 219 debugindex: format
218 220 debugindexdot:
219 221 debuginstall:
@@ -120,3 +120,5 b' Check it does not ignore the current dir'
120 120 $ hg status .
121 121 A b.o
122 122
123 $ hg debugignore
124 (?:(?:|.*/)[^/]*(?:/|$))
General Comments 0
You need to be logged in to leave comments. Login now