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