##// END OF EJS Templates
narrowmatcher: propagate the rel() method...
Matt Harbison -
r23686:164915e8 default
parent child Browse files
Show More
@@ -1991,7 +1991,7 b' def add(ui, repo, match, dryrun, listsub'
1991 1991 cca(f)
1992 1992 names.append(f)
1993 1993 if ui.verbose or not exact:
1994 ui.status(_('adding %s\n') % match.rel(join(f)))
1994 ui.status(_('adding %s\n') % match.rel(f))
1995 1995
1996 1996 for subpath in sorted(wctx.substate):
1997 1997 sub = wctx.sub(subpath)
@@ -2042,12 +2042,12 b' def forget(ui, repo, match, prefix, expl'
2042 2042 if repo.wvfs.exists(f):
2043 2043 ui.warn(_('not removing %s: '
2044 2044 'file is already untracked\n')
2045 % match.rel(join(f)))
2045 % match.rel(f))
2046 2046 bad.append(f)
2047 2047
2048 2048 for f in forget:
2049 2049 if ui.verbose or not match.exact(f):
2050 ui.status(_('removing %s\n') % match.rel(join(f)))
2050 ui.status(_('removing %s\n') % match.rel(f))
2051 2051
2052 2052 rejected = wctx.forget(forget, prefix)
2053 2053 bad.extend(f for f in rejected if f in match.files())
@@ -2095,10 +2095,10 b' def remove(ui, repo, m, prefix, after, f'
2095 2095 if repo.wvfs.exists(f):
2096 2096 if repo.wvfs.isdir(f):
2097 2097 ui.warn(_('not removing %s: no tracked files\n')
2098 % m.rel(join(f)))
2098 % m.rel(f))
2099 2099 else:
2100 2100 ui.warn(_('not removing %s: file is untracked\n')
2101 % m.rel(join(f)))
2101 % m.rel(f))
2102 2102 # missing files will generate a warning elsewhere
2103 2103 ret = 1
2104 2104
@@ -2107,22 +2107,22 b' def remove(ui, repo, m, prefix, after, f'
2107 2107 elif after:
2108 2108 list = deleted
2109 2109 for f in modified + added + clean:
2110 ui.warn(_('not removing %s: file still exists\n') % m.rel(join(f)))
2110 ui.warn(_('not removing %s: file still exists\n') % m.rel(f))
2111 2111 ret = 1
2112 2112 else:
2113 2113 list = deleted + clean
2114 2114 for f in modified:
2115 2115 ui.warn(_('not removing %s: file is modified (use -f'
2116 ' to force removal)\n') % m.rel(join(f)))
2116 ' to force removal)\n') % m.rel(f))
2117 2117 ret = 1
2118 2118 for f in added:
2119 2119 ui.warn(_('not removing %s: file has been marked for add'
2120 ' (use forget to undo)\n') % m.rel(join(f)))
2120 ' (use forget to undo)\n') % m.rel(f))
2121 2121 ret = 1
2122 2122
2123 2123 for f in sorted(list):
2124 2124 if ui.verbose or not m.exact(f):
2125 ui.status(_('removing %s\n') % m.rel(join(f)))
2125 ui.status(_('removing %s\n') % m.rel(f))
2126 2126
2127 2127 wlock = repo.wlock()
2128 2128 try:
@@ -138,7 +138,7 b' class match(object):'
138 138 '''Convert repo path to a display path. If patterns or -I/-X were used
139 139 to create this matcher, the display path will be relative to cwd.
140 140 Otherwise it is relative to the root of the repo.'''
141 return (self._pathrestricted and self.rel(f)) or f
141 return (self._pathrestricted and self.rel(f)) or self.abs(f)
142 142
143 143 def files(self):
144 144 '''Explicitly listed files or patterns or roots:
@@ -186,8 +186,8 b' class narrowmatcher(match):'
186 186 ['b.txt']
187 187 >>> m2.exact('b.txt')
188 188 True
189 >>> m2.rel('b.txt')
190 'b.txt'
189 >>> util.pconvert(m2.rel('b.txt'))
190 'sub/b.txt'
191 191 >>> def bad(f, msg):
192 192 ... print "%s: %s" % (f, msg)
193 193 >>> m1.bad = bad
@@ -217,6 +217,9 b' class narrowmatcher(match):'
217 217 def bad(self, f, msg):
218 218 self._matcher.bad(self._path + "/" + f, msg)
219 219
220 def rel(self, f):
221 return self._matcher.rel(self._path + "/" + f)
222
220 223 def patkind(pattern, default=None):
221 224 '''If pattern is 'kind:pat' with a known kind, return kind.'''
222 225 return _patsplit(pattern, default)[0]
@@ -773,9 +773,9 b' def addremove(repo, matcher, prefix, opt'
773 773 for abs in sorted(toprint):
774 774 if repo.ui.verbose or not m.exact(abs):
775 775 if abs in unknownset:
776 status = _('adding %s\n') % m.uipath(join(abs))
776 status = _('adding %s\n') % m.uipath(abs)
777 777 else:
778 status = _('removing %s\n') % m.uipath(join(abs))
778 status = _('removing %s\n') % m.uipath(abs)
779 779 repo.ui.status(status)
780 780
781 781 renames = _findrenames(repo, m, added + unknown, removed + deleted,
@@ -107,7 +107,7 b' Check that deep archiving works'
107 107 $ mkdir sub1/sub2/folder
108 108 $ echo 'subfolder' > sub1/sub2/folder/test.txt
109 109 $ hg ci -ASm "add test.txt"
110 adding sub1/sub2/folder/test.txt (glob)
110 adding sub1/sub2/folder/test.txt
111 111 committing subrepository sub1
112 112 committing subrepository sub1/sub2 (glob)
113 113
@@ -162,10 +162,10 b' Test relative path printing + subrepos'
162 162 $ rm sub1/sub2/folder/test.txt
163 163 $ rm sub1/sub2/test.txt
164 164 $ hg ci -ASm "remove test.txt"
165 adding sub1/sub2/folder/bar (glob)
166 removing sub1/sub2/folder/test.txt (glob)
167 removing sub1/sub2/test.txt (glob)
168 adding sub1/foo (glob)
165 adding sub1/sub2/folder/bar
166 removing sub1/sub2/folder/test.txt
167 removing sub1/sub2/test.txt
168 adding sub1/foo
169 169 adding foo/bar/abc
170 170 committing subrepository sub1
171 171 committing subrepository sub1/sub2 (glob)
General Comments 0
You need to be logged in to leave comments. Login now