##// END OF EJS Templates
Merge additional fixes for my matcher changes
Alexis S. L. Carvalho -
r4256:fe0fe0b4 merge default
parent child Browse files
Show More
@@ -430,6 +430,8 b' def commit(ui, repo, *pats, **opts):'
430 430 files = modified + added + removed
431 431 slist = None
432 432 for f in fns:
433 if f == '.':
434 continue
433 435 if f not in files:
434 436 rf = repo.wjoin(f)
435 437 if f in unknown:
@@ -442,7 +442,7 b' class dirstate(object):'
442 442 # don't trip over symlinks
443 443 st = os.lstat(p)
444 444 if stat.S_ISDIR(st.st_mode):
445 if not ignore(p):
445 if not ignore(np):
446 446 work.append(p)
447 447 if directories:
448 448 yield 'd', np, st
@@ -447,7 +447,7 b' def _matcher(canonroot, cwd, names, inc,'
447 447 if c in _globchars: return True
448 448 return False
449 449
450 def regex(kind, name, tail):
450 def regex(kind, name):
451 451 '''convert a pattern into a regular expression'''
452 452 if not name:
453 453 return ''
@@ -463,16 +463,16 b' def _matcher(canonroot, cwd, names, inc,'
463 463 if name.startswith('^'):
464 464 return name
465 465 return '.*' + name
466 return globre(name, '', tail)
466 return globre(name, '', '(?:/|$)')
467 467
468 def matchfn(pats, tail):
468 def matchfn(pats):
469 469 """build a matching function from a set of patterns"""
470 470 if not pats:
471 471 return
472 472 matches = []
473 473 for k, p in pats:
474 474 try:
475 pat = '(?:%s)' % regex(k, p, tail)
475 pat = '(?:%s)' % regex(k, p)
476 476 matches.append(re.compile(pat).match)
477 477 except re.error:
478 478 if src: raise Abort("%s: invalid pattern (%s): %s" % (src, k, p))
@@ -520,15 +520,15 b' def _matcher(canonroot, cwd, names, inc,'
520 520
521 521 roots, pats, anypats = normalizepats(names, dflt_pat)
522 522
523 patmatch = matchfn(pats, '$') or always
523 patmatch = matchfn(pats) or always
524 524 incmatch = always
525 525 if inc:
526 526 dummy, inckinds, dummy = normalizepats(inc, 'glob')
527 incmatch = matchfn(inckinds, '(?:/|$)')
527 incmatch = matchfn(inckinds)
528 528 excmatch = lambda fn: False
529 529 if exc:
530 530 dummy, exckinds, dummy = normalizepats(exc, 'glob')
531 excmatch = matchfn(exckinds, '(?:/|$)')
531 excmatch = matchfn(exckinds)
532 532
533 533 if not names and inc and not exc:
534 534 # common case: hgignore patterns
@@ -71,4 +71,21 b' echo % full log'
71 71 hg log -v
72 72 cd ..
73 73
74 echo % dot and subdir commit test
75 hg init test3
76 cd test3
77 mkdir foo
78 echo foo content > foo/plain-file
79 hg add foo/plain-file
80 hg ci -d '1000000 0' -u test -m commit-foo-subdir foo
81 echo modified foo content > foo/plain-file
82 hg ci -d '2000000 0' -u test -m commit-foo-dot .
83 echo % full log
84 hg log -v
85 echo % subdir log
86 cd foo
87 hg log .
88 cd ..
89 cd ..
90
74 91 exit 0
@@ -64,3 +64,34 b' description:'
64 64 commit-subdir-1
65 65
66 66
67 % dot and subdir commit test
68 % full log
69 changeset: 1:d9180e04fa8a
70 tag: tip
71 user: test
72 date: Sat Jan 24 03:33:20 1970 +0000
73 files: foo/plain-file
74 description:
75 commit-foo-dot
76
77
78 changeset: 0:80b572aaf098
79 user: test
80 date: Mon Jan 12 13:46:40 1970 +0000
81 files: foo/plain-file
82 description:
83 commit-foo-subdir
84
85
86 % subdir log
87 changeset: 1:d9180e04fa8a
88 tag: tip
89 user: test
90 date: Sat Jan 24 03:33:20 1970 +0000
91 summary: commit-foo-dot
92
93 changeset: 0:80b572aaf098
94 user: test
95 date: Mon Jan 12 13:46:40 1970 +0000
96 summary: commit-foo-subdir
97
@@ -210,10 +210,20 b' hg debugwalk beans/.hg'
210 210 beans/.hg: No such file or directory
211 211
212 212 hg debugwalk glob:*
213 f fennel fennel
214 f fenugreek fenugreek
215 f fiddlehead fiddlehead
216 f glob:glob glob:glob
213 f beans/black beans/black
214 f beans/borlotti beans/borlotti
215 f beans/kidney beans/kidney
216 f beans/navy beans/navy
217 f beans/pinto beans/pinto
218 f beans/turtle beans/turtle
219 f fennel fennel
220 f fenugreek fenugreek
221 f fiddlehead fiddlehead
222 f glob:glob glob:glob
223 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
224 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
225 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
226 f mammals/skunk mammals/skunk
217 227
218 228 hg debugwalk re:.*[kb]$
219 229 f beans/black beans/black
General Comments 0
You need to be logged in to leave comments. Login now