changeset 4256:fe0fe0b4d73b

Merge additional fixes for my matcher changes
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Tue, 20 Mar 2007 22:21:05 -0300
parents e76e52145c3d (current diff) ef1f1a4b2efb (diff)
children 1b5c38e9d7aa f51317e24114
files mercurial/commands.py mercurial/dirstate.py mercurial/util.py tests/test-commit.out tests/test-walk.out
diffstat 6 files changed, 72 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Mar 20 13:13:39 2007 -0700
+++ b/mercurial/commands.py	Tue Mar 20 22:21:05 2007 -0300
@@ -430,6 +430,8 @@
         files = modified + added + removed
         slist = None
         for f in fns:
+            if f == '.':
+                continue
             if f not in files:
                 rf = repo.wjoin(f)
                 if f in unknown:
--- a/mercurial/dirstate.py	Tue Mar 20 13:13:39 2007 -0700
+++ b/mercurial/dirstate.py	Tue Mar 20 22:21:05 2007 -0300
@@ -442,7 +442,7 @@
                     # don't trip over symlinks
                     st = os.lstat(p)
                     if stat.S_ISDIR(st.st_mode):
-                        if not ignore(p):
+                        if not ignore(np):
                             work.append(p)
                             if directories:
                                 yield 'd', np, st
--- a/mercurial/util.py	Tue Mar 20 13:13:39 2007 -0700
+++ b/mercurial/util.py	Tue Mar 20 22:21:05 2007 -0300
@@ -447,7 +447,7 @@
             if c in _globchars: return True
         return False
 
-    def regex(kind, name, tail):
+    def regex(kind, name):
         '''convert a pattern into a regular expression'''
         if not name:
             return ''
@@ -463,16 +463,16 @@
             if name.startswith('^'):
                 return name
             return '.*' + name
-        return globre(name, '', tail)
+        return globre(name, '', '(?:/|$)')
 
-    def matchfn(pats, tail):
+    def matchfn(pats):
         """build a matching function from a set of patterns"""
         if not pats:
             return
         matches = []
         for k, p in pats:
             try:
-                pat = '(?:%s)' % regex(k, p, tail)
+                pat = '(?:%s)' % regex(k, p)
                 matches.append(re.compile(pat).match)
             except re.error:
                 if src: raise Abort("%s: invalid pattern (%s): %s" % (src, k, p))
@@ -520,15 +520,15 @@
 
     roots, pats, anypats = normalizepats(names, dflt_pat)
 
-    patmatch = matchfn(pats, '$') or always
+    patmatch = matchfn(pats) or always
     incmatch = always
     if inc:
         dummy, inckinds, dummy = normalizepats(inc, 'glob')
-        incmatch = matchfn(inckinds, '(?:/|$)')
+        incmatch = matchfn(inckinds)
     excmatch = lambda fn: False
     if exc:
         dummy, exckinds, dummy = normalizepats(exc, 'glob')
-        excmatch = matchfn(exckinds, '(?:/|$)')
+        excmatch = matchfn(exckinds)
 
     if not names and inc and not exc:
         # common case: hgignore patterns
--- a/tests/test-commit	Tue Mar 20 13:13:39 2007 -0700
+++ b/tests/test-commit	Tue Mar 20 22:21:05 2007 -0300
@@ -71,4 +71,21 @@
 hg log -v
 cd ..
 
+echo % dot and subdir commit test
+hg init test3
+cd test3
+mkdir foo
+echo foo content > foo/plain-file
+hg add foo/plain-file
+hg ci -d '1000000 0' -u test -m commit-foo-subdir foo
+echo modified foo content > foo/plain-file
+hg ci -d '2000000 0' -u test -m commit-foo-dot .
+echo % full log
+hg log -v
+echo % subdir log
+cd foo
+hg log .
+cd ..
+cd ..
+
 exit 0
--- a/tests/test-commit.out	Tue Mar 20 13:13:39 2007 -0700
+++ b/tests/test-commit.out	Tue Mar 20 22:21:05 2007 -0300
@@ -64,3 +64,34 @@
 commit-subdir-1
 
 
+% dot and subdir commit test
+% full log
+changeset:   1:d9180e04fa8a
+tag:         tip
+user:        test
+date:        Sat Jan 24 03:33:20 1970 +0000
+files:       foo/plain-file
+description:
+commit-foo-dot
+
+
+changeset:   0:80b572aaf098
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+files:       foo/plain-file
+description:
+commit-foo-subdir
+
+
+% subdir log
+changeset:   1:d9180e04fa8a
+tag:         tip
+user:        test
+date:        Sat Jan 24 03:33:20 1970 +0000
+summary:     commit-foo-dot
+
+changeset:   0:80b572aaf098
+user:        test
+date:        Mon Jan 12 13:46:40 1970 +0000
+summary:     commit-foo-subdir
+
--- a/tests/test-walk.out	Tue Mar 20 13:13:39 2007 -0700
+++ b/tests/test-walk.out	Tue Mar 20 22:21:05 2007 -0300
@@ -210,10 +210,20 @@
 beans/.hg: No such file or directory
 
 hg debugwalk glob:*
-f  fennel      fennel
-f  fenugreek   fenugreek
-f  fiddlehead  fiddlehead
-f  glob:glob   glob:glob
+f  beans/black                     beans/black
+f  beans/borlotti                  beans/borlotti
+f  beans/kidney                    beans/kidney
+f  beans/navy                      beans/navy
+f  beans/pinto                     beans/pinto
+f  beans/turtle                    beans/turtle
+f  fennel                          fennel
+f  fenugreek                       fenugreek
+f  fiddlehead                      fiddlehead
+f  glob:glob                       glob:glob
+f  mammals/Procyonidae/cacomistle  mammals/Procyonidae/cacomistle
+f  mammals/Procyonidae/coatimundi  mammals/Procyonidae/coatimundi
+f  mammals/Procyonidae/raccoon     mammals/Procyonidae/raccoon
+f  mammals/skunk                   mammals/skunk
 
 hg debugwalk re:.*[kb]$
 f  beans/black    beans/black