Show More
@@ -430,6 +430,8 b' def commit(ui, repo, *pats, **opts):' | |||||
430 | files = modified + added + removed |
|
430 | files = modified + added + removed | |
431 | slist = None |
|
431 | slist = None | |
432 | for f in fns: |
|
432 | for f in fns: | |
|
433 | if f == '.': | |||
|
434 | continue | |||
433 | if f not in files: |
|
435 | if f not in files: | |
434 | rf = repo.wjoin(f) |
|
436 | rf = repo.wjoin(f) | |
435 | if f in unknown: |
|
437 | if f in unknown: |
@@ -442,7 +442,7 b' class dirstate(object):' | |||||
442 | # don't trip over symlinks |
|
442 | # don't trip over symlinks | |
443 | st = os.lstat(p) |
|
443 | st = os.lstat(p) | |
444 | if stat.S_ISDIR(st.st_mode): |
|
444 | if stat.S_ISDIR(st.st_mode): | |
445 | if not ignore(p): |
|
445 | if not ignore(np): | |
446 | work.append(p) |
|
446 | work.append(p) | |
447 | if directories: |
|
447 | if directories: | |
448 | yield 'd', np, st |
|
448 | yield 'd', np, st |
@@ -447,7 +447,7 b' def _matcher(canonroot, cwd, names, inc,' | |||||
447 | if c in _globchars: return True |
|
447 | if c in _globchars: return True | |
448 | return False |
|
448 | return False | |
449 |
|
449 | |||
450 |
def regex(kind, name |
|
450 | def regex(kind, name): | |
451 | '''convert a pattern into a regular expression''' |
|
451 | '''convert a pattern into a regular expression''' | |
452 | if not name: |
|
452 | if not name: | |
453 | return '' |
|
453 | return '' | |
@@ -463,16 +463,16 b' def _matcher(canonroot, cwd, names, inc,' | |||||
463 | if name.startswith('^'): |
|
463 | if name.startswith('^'): | |
464 | return name |
|
464 | return name | |
465 | return '.*' + name |
|
465 | return '.*' + name | |
466 |
return globre(name, '', |
|
466 | return globre(name, '', '(?:/|$)') | |
467 |
|
467 | |||
468 |
def matchfn(pats |
|
468 | def matchfn(pats): | |
469 | """build a matching function from a set of patterns""" |
|
469 | """build a matching function from a set of patterns""" | |
470 | if not pats: |
|
470 | if not pats: | |
471 | return |
|
471 | return | |
472 | matches = [] |
|
472 | matches = [] | |
473 | for k, p in pats: |
|
473 | for k, p in pats: | |
474 | try: |
|
474 | try: | |
475 |
pat = '(?:%s)' % regex(k, p |
|
475 | pat = '(?:%s)' % regex(k, p) | |
476 | matches.append(re.compile(pat).match) |
|
476 | matches.append(re.compile(pat).match) | |
477 | except re.error: |
|
477 | except re.error: | |
478 | if src: raise Abort("%s: invalid pattern (%s): %s" % (src, k, p)) |
|
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 | roots, pats, anypats = normalizepats(names, dflt_pat) |
|
521 | roots, pats, anypats = normalizepats(names, dflt_pat) | |
522 |
|
522 | |||
523 |
patmatch = matchfn(pats |
|
523 | patmatch = matchfn(pats) or always | |
524 | incmatch = always |
|
524 | incmatch = always | |
525 | if inc: |
|
525 | if inc: | |
526 | dummy, inckinds, dummy = normalizepats(inc, 'glob') |
|
526 | dummy, inckinds, dummy = normalizepats(inc, 'glob') | |
527 |
incmatch = matchfn(inckinds |
|
527 | incmatch = matchfn(inckinds) | |
528 | excmatch = lambda fn: False |
|
528 | excmatch = lambda fn: False | |
529 | if exc: |
|
529 | if exc: | |
530 | dummy, exckinds, dummy = normalizepats(exc, 'glob') |
|
530 | dummy, exckinds, dummy = normalizepats(exc, 'glob') | |
531 |
excmatch = matchfn(exckinds |
|
531 | excmatch = matchfn(exckinds) | |
532 |
|
532 | |||
533 | if not names and inc and not exc: |
|
533 | if not names and inc and not exc: | |
534 | # common case: hgignore patterns |
|
534 | # common case: hgignore patterns |
@@ -71,4 +71,21 b' echo % full log' | |||||
71 | hg log -v |
|
71 | hg log -v | |
72 | cd .. |
|
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 | exit 0 |
|
91 | exit 0 |
@@ -64,3 +64,34 b' description:' | |||||
64 | commit-subdir-1 |
|
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 | beans/.hg: No such file or directory |
|
210 | beans/.hg: No such file or directory | |
211 |
|
211 | |||
212 | hg debugwalk glob:* |
|
212 | hg debugwalk 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 | |||
213 | f fennel fennel |
|
219 | f fennel fennel | |
214 | f fenugreek fenugreek |
|
220 | f fenugreek fenugreek | |
215 | f fiddlehead fiddlehead |
|
221 | f fiddlehead fiddlehead | |
216 | f glob:glob glob:glob |
|
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 | hg debugwalk re:.*[kb]$ |
|
228 | hg debugwalk re:.*[kb]$ | |
219 | f beans/black beans/black |
|
229 | f beans/black beans/black |
General Comments 0
You need to be logged in to leave comments.
Login now