##// END OF EJS Templates
dirstate: don't walk ignored directories...
Alexis S. L. Carvalho -
r6032:b41f0d6a default
parent child Browse files
Show More
@@ -1,582 +1,593 b''
1 """
1 """
2 dirstate.py - working directory tracking for mercurial
2 dirstate.py - working directory tracking for mercurial
3
3
4 Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
5
5
6 This software may be used and distributed according to the terms
6 This software may be used and distributed according to the terms
7 of the GNU General Public License, incorporated herein by reference.
7 of the GNU General Public License, incorporated herein by reference.
8 """
8 """
9
9
10 from node import *
10 from node import *
11 from i18n import _
11 from i18n import _
12 import struct, os, time, bisect, stat, strutil, util, re, errno, ignore
12 import struct, os, time, bisect, stat, strutil, util, re, errno, ignore
13 import cStringIO, osutil
13 import cStringIO, osutil
14
14
15 _unknown = ('?', 0, 0, 0)
15 _unknown = ('?', 0, 0, 0)
16 _format = ">cllll"
16 _format = ">cllll"
17
17
18 class dirstate(object):
18 class dirstate(object):
19
19
20 def __init__(self, opener, ui, root):
20 def __init__(self, opener, ui, root):
21 self._opener = opener
21 self._opener = opener
22 self._root = root
22 self._root = root
23 self._dirty = False
23 self._dirty = False
24 self._dirtypl = False
24 self._dirtypl = False
25 self._ui = ui
25 self._ui = ui
26
26
27 def __getattr__(self, name):
27 def __getattr__(self, name):
28 if name == '_map':
28 if name == '_map':
29 self._read()
29 self._read()
30 return self._map
30 return self._map
31 elif name == '_copymap':
31 elif name == '_copymap':
32 self._read()
32 self._read()
33 return self._copymap
33 return self._copymap
34 elif name == '_branch':
34 elif name == '_branch':
35 try:
35 try:
36 self._branch = (self._opener("branch").read().strip()
36 self._branch = (self._opener("branch").read().strip()
37 or "default")
37 or "default")
38 except IOError:
38 except IOError:
39 self._branch = "default"
39 self._branch = "default"
40 return self._branch
40 return self._branch
41 elif name == '_pl':
41 elif name == '_pl':
42 self._pl = [nullid, nullid]
42 self._pl = [nullid, nullid]
43 try:
43 try:
44 st = self._opener("dirstate").read(40)
44 st = self._opener("dirstate").read(40)
45 if len(st) == 40:
45 if len(st) == 40:
46 self._pl = st[:20], st[20:40]
46 self._pl = st[:20], st[20:40]
47 except IOError, err:
47 except IOError, err:
48 if err.errno != errno.ENOENT: raise
48 if err.errno != errno.ENOENT: raise
49 return self._pl
49 return self._pl
50 elif name == '_dirs':
50 elif name == '_dirs':
51 self._dirs = {}
51 self._dirs = {}
52 for f in self._map:
52 for f in self._map:
53 if self[f] != 'r':
53 if self[f] != 'r':
54 self._incpath(f)
54 self._incpath(f)
55 return self._dirs
55 return self._dirs
56 elif name == '_ignore':
56 elif name == '_ignore':
57 files = [self._join('.hgignore')]
57 files = [self._join('.hgignore')]
58 for name, path in self._ui.configitems("ui"):
58 for name, path in self._ui.configitems("ui"):
59 if name == 'ignore' or name.startswith('ignore.'):
59 if name == 'ignore' or name.startswith('ignore.'):
60 files.append(os.path.expanduser(path))
60 files.append(os.path.expanduser(path))
61 self._ignore = ignore.ignore(self._root, files, self._ui.warn)
61 self._ignore = ignore.ignore(self._root, files, self._ui.warn)
62 return self._ignore
62 return self._ignore
63 elif name == '_slash':
63 elif name == '_slash':
64 self._slash = self._ui.configbool('ui', 'slash') and os.sep != '/'
64 self._slash = self._ui.configbool('ui', 'slash') and os.sep != '/'
65 return self._slash
65 return self._slash
66 else:
66 else:
67 raise AttributeError, name
67 raise AttributeError, name
68
68
69 def _join(self, f):
69 def _join(self, f):
70 return os.path.join(self._root, f)
70 return os.path.join(self._root, f)
71
71
72 def getcwd(self):
72 def getcwd(self):
73 cwd = os.getcwd()
73 cwd = os.getcwd()
74 if cwd == self._root: return ''
74 if cwd == self._root: return ''
75 # self._root ends with a path separator if self._root is '/' or 'C:\'
75 # self._root ends with a path separator if self._root is '/' or 'C:\'
76 rootsep = self._root
76 rootsep = self._root
77 if not rootsep.endswith(os.sep):
77 if not rootsep.endswith(os.sep):
78 rootsep += os.sep
78 rootsep += os.sep
79 if cwd.startswith(rootsep):
79 if cwd.startswith(rootsep):
80 return cwd[len(rootsep):]
80 return cwd[len(rootsep):]
81 else:
81 else:
82 # we're outside the repo. return an absolute path.
82 # we're outside the repo. return an absolute path.
83 return cwd
83 return cwd
84
84
85 def pathto(self, f, cwd=None):
85 def pathto(self, f, cwd=None):
86 if cwd is None:
86 if cwd is None:
87 cwd = self.getcwd()
87 cwd = self.getcwd()
88 path = util.pathto(self._root, cwd, f)
88 path = util.pathto(self._root, cwd, f)
89 if self._slash:
89 if self._slash:
90 return path.replace(os.sep, '/')
90 return path.replace(os.sep, '/')
91 return path
91 return path
92
92
93 def __getitem__(self, key):
93 def __getitem__(self, key):
94 ''' current states:
94 ''' current states:
95 n normal
95 n normal
96 m needs merging
96 m needs merging
97 r marked for removal
97 r marked for removal
98 a marked for addition
98 a marked for addition
99 ? not tracked'''
99 ? not tracked'''
100 return self._map.get(key, ("?",))[0]
100 return self._map.get(key, ("?",))[0]
101
101
102 def __contains__(self, key):
102 def __contains__(self, key):
103 return key in self._map
103 return key in self._map
104
104
105 def __iter__(self):
105 def __iter__(self):
106 a = self._map.keys()
106 a = self._map.keys()
107 a.sort()
107 a.sort()
108 for x in a:
108 for x in a:
109 yield x
109 yield x
110
110
111 def parents(self):
111 def parents(self):
112 return self._pl
112 return self._pl
113
113
114 def branch(self):
114 def branch(self):
115 return self._branch
115 return self._branch
116
116
117 def setparents(self, p1, p2=nullid):
117 def setparents(self, p1, p2=nullid):
118 self._dirty = self._dirtypl = True
118 self._dirty = self._dirtypl = True
119 self._pl = p1, p2
119 self._pl = p1, p2
120
120
121 def setbranch(self, branch):
121 def setbranch(self, branch):
122 self._branch = branch
122 self._branch = branch
123 self._opener("branch", "w").write(branch + '\n')
123 self._opener("branch", "w").write(branch + '\n')
124
124
125 def _read(self):
125 def _read(self):
126 self._map = {}
126 self._map = {}
127 self._copymap = {}
127 self._copymap = {}
128 if not self._dirtypl:
128 if not self._dirtypl:
129 self._pl = [nullid, nullid]
129 self._pl = [nullid, nullid]
130 try:
130 try:
131 st = self._opener("dirstate").read()
131 st = self._opener("dirstate").read()
132 except IOError, err:
132 except IOError, err:
133 if err.errno != errno.ENOENT: raise
133 if err.errno != errno.ENOENT: raise
134 return
134 return
135 if not st:
135 if not st:
136 return
136 return
137
137
138 if not self._dirtypl:
138 if not self._dirtypl:
139 self._pl = [st[:20], st[20: 40]]
139 self._pl = [st[:20], st[20: 40]]
140
140
141 # deref fields so they will be local in loop
141 # deref fields so they will be local in loop
142 dmap = self._map
142 dmap = self._map
143 copymap = self._copymap
143 copymap = self._copymap
144 unpack = struct.unpack
144 unpack = struct.unpack
145 e_size = struct.calcsize(_format)
145 e_size = struct.calcsize(_format)
146 pos1 = 40
146 pos1 = 40
147 l = len(st)
147 l = len(st)
148
148
149 # the inner loop
149 # the inner loop
150 while pos1 < l:
150 while pos1 < l:
151 pos2 = pos1 + e_size
151 pos2 = pos1 + e_size
152 e = unpack(">cllll", st[pos1:pos2]) # a literal here is faster
152 e = unpack(">cllll", st[pos1:pos2]) # a literal here is faster
153 pos1 = pos2 + e[4]
153 pos1 = pos2 + e[4]
154 f = st[pos2:pos1]
154 f = st[pos2:pos1]
155 if '\0' in f:
155 if '\0' in f:
156 f, c = f.split('\0')
156 f, c = f.split('\0')
157 copymap[f] = c
157 copymap[f] = c
158 dmap[f] = e # we hold onto e[4] because making a subtuple is slow
158 dmap[f] = e # we hold onto e[4] because making a subtuple is slow
159
159
160 def invalidate(self):
160 def invalidate(self):
161 for a in "_map _copymap _branch _pl _dirs _ignore".split():
161 for a in "_map _copymap _branch _pl _dirs _ignore".split():
162 if a in self.__dict__:
162 if a in self.__dict__:
163 delattr(self, a)
163 delattr(self, a)
164 self._dirty = False
164 self._dirty = False
165
165
166 def copy(self, source, dest):
166 def copy(self, source, dest):
167 self._dirty = True
167 self._dirty = True
168 self._copymap[dest] = source
168 self._copymap[dest] = source
169
169
170 def copied(self, file):
170 def copied(self, file):
171 return self._copymap.get(file, None)
171 return self._copymap.get(file, None)
172
172
173 def copies(self):
173 def copies(self):
174 return self._copymap
174 return self._copymap
175
175
176 def _incpath(self, path):
176 def _incpath(self, path):
177 c = path.rfind('/')
177 c = path.rfind('/')
178 if c >= 0:
178 if c >= 0:
179 dirs = self._dirs
179 dirs = self._dirs
180 base = path[:c]
180 base = path[:c]
181 if base not in dirs:
181 if base not in dirs:
182 self._incpath(base)
182 self._incpath(base)
183 dirs[base] = 1
183 dirs[base] = 1
184 else:
184 else:
185 dirs[base] += 1
185 dirs[base] += 1
186
186
187 def _decpath(self, path):
187 def _decpath(self, path):
188 c = path.rfind('/')
188 c = path.rfind('/')
189 if c >= 0:
189 if c >= 0:
190 base = path[:c]
190 base = path[:c]
191 dirs = self._dirs
191 dirs = self._dirs
192 if dirs[base] == 1:
192 if dirs[base] == 1:
193 del dirs[base]
193 del dirs[base]
194 self._decpath(base)
194 self._decpath(base)
195 else:
195 else:
196 dirs[base] -= 1
196 dirs[base] -= 1
197
197
198 def _incpathcheck(self, f):
198 def _incpathcheck(self, f):
199 if '\r' in f or '\n' in f:
199 if '\r' in f or '\n' in f:
200 raise util.Abort(_("'\\n' and '\\r' disallowed in filenames"))
200 raise util.Abort(_("'\\n' and '\\r' disallowed in filenames"))
201 # shadows
201 # shadows
202 if f in self._dirs:
202 if f in self._dirs:
203 raise util.Abort(_('directory %r already in dirstate') % f)
203 raise util.Abort(_('directory %r already in dirstate') % f)
204 for c in strutil.rfindall(f, '/'):
204 for c in strutil.rfindall(f, '/'):
205 d = f[:c]
205 d = f[:c]
206 if d in self._dirs:
206 if d in self._dirs:
207 break
207 break
208 if d in self._map and self[d] != 'r':
208 if d in self._map and self[d] != 'r':
209 raise util.Abort(_('file %r in dirstate clashes with %r') %
209 raise util.Abort(_('file %r in dirstate clashes with %r') %
210 (d, f))
210 (d, f))
211 self._incpath(f)
211 self._incpath(f)
212
212
213 def _changepath(self, f, newstate, relaxed=False):
213 def _changepath(self, f, newstate, relaxed=False):
214 # handle upcoming path changes
214 # handle upcoming path changes
215 oldstate = self[f]
215 oldstate = self[f]
216 if oldstate not in "?r" and newstate in "?r":
216 if oldstate not in "?r" and newstate in "?r":
217 if "_dirs" in self.__dict__:
217 if "_dirs" in self.__dict__:
218 self._decpath(f)
218 self._decpath(f)
219 return
219 return
220 if oldstate in "?r" and newstate not in "?r":
220 if oldstate in "?r" and newstate not in "?r":
221 if relaxed and oldstate == '?':
221 if relaxed and oldstate == '?':
222 # XXX
222 # XXX
223 # in relaxed mode we assume the caller knows
223 # in relaxed mode we assume the caller knows
224 # what it is doing, workaround for updating
224 # what it is doing, workaround for updating
225 # dir-to-file revisions
225 # dir-to-file revisions
226 if "_dirs" in self.__dict__:
226 if "_dirs" in self.__dict__:
227 self._incpath(f)
227 self._incpath(f)
228 return
228 return
229 self._incpathcheck(f)
229 self._incpathcheck(f)
230 return
230 return
231
231
232 def normal(self, f):
232 def normal(self, f):
233 'mark a file normal and clean'
233 'mark a file normal and clean'
234 self._dirty = True
234 self._dirty = True
235 self._changepath(f, 'n', True)
235 self._changepath(f, 'n', True)
236 s = os.lstat(self._join(f))
236 s = os.lstat(self._join(f))
237 self._map[f] = ('n', s.st_mode, s.st_size, s.st_mtime, 0)
237 self._map[f] = ('n', s.st_mode, s.st_size, s.st_mtime, 0)
238 if self._copymap.has_key(f):
238 if self._copymap.has_key(f):
239 del self._copymap[f]
239 del self._copymap[f]
240
240
241 def normallookup(self, f):
241 def normallookup(self, f):
242 'mark a file normal, but possibly dirty'
242 'mark a file normal, but possibly dirty'
243 self._dirty = True
243 self._dirty = True
244 self._changepath(f, 'n', True)
244 self._changepath(f, 'n', True)
245 self._map[f] = ('n', 0, -1, -1, 0)
245 self._map[f] = ('n', 0, -1, -1, 0)
246 if f in self._copymap:
246 if f in self._copymap:
247 del self._copymap[f]
247 del self._copymap[f]
248
248
249 def normaldirty(self, f):
249 def normaldirty(self, f):
250 'mark a file normal, but dirty'
250 'mark a file normal, but dirty'
251 self._dirty = True
251 self._dirty = True
252 self._changepath(f, 'n', True)
252 self._changepath(f, 'n', True)
253 self._map[f] = ('n', 0, -2, -1, 0)
253 self._map[f] = ('n', 0, -2, -1, 0)
254 if f in self._copymap:
254 if f in self._copymap:
255 del self._copymap[f]
255 del self._copymap[f]
256
256
257 def add(self, f):
257 def add(self, f):
258 'mark a file added'
258 'mark a file added'
259 self._dirty = True
259 self._dirty = True
260 self._changepath(f, 'a')
260 self._changepath(f, 'a')
261 self._map[f] = ('a', 0, -1, -1, 0)
261 self._map[f] = ('a', 0, -1, -1, 0)
262 if f in self._copymap:
262 if f in self._copymap:
263 del self._copymap[f]
263 del self._copymap[f]
264
264
265 def remove(self, f):
265 def remove(self, f):
266 'mark a file removed'
266 'mark a file removed'
267 self._dirty = True
267 self._dirty = True
268 self._changepath(f, 'r')
268 self._changepath(f, 'r')
269 self._map[f] = ('r', 0, 0, 0, 0)
269 self._map[f] = ('r', 0, 0, 0, 0)
270 if f in self._copymap:
270 if f in self._copymap:
271 del self._copymap[f]
271 del self._copymap[f]
272
272
273 def merge(self, f):
273 def merge(self, f):
274 'mark a file merged'
274 'mark a file merged'
275 self._dirty = True
275 self._dirty = True
276 s = os.lstat(self._join(f))
276 s = os.lstat(self._join(f))
277 self._changepath(f, 'm', True)
277 self._changepath(f, 'm', True)
278 self._map[f] = ('m', s.st_mode, s.st_size, s.st_mtime, 0)
278 self._map[f] = ('m', s.st_mode, s.st_size, s.st_mtime, 0)
279 if f in self._copymap:
279 if f in self._copymap:
280 del self._copymap[f]
280 del self._copymap[f]
281
281
282 def forget(self, f):
282 def forget(self, f):
283 'forget a file'
283 'forget a file'
284 self._dirty = True
284 self._dirty = True
285 try:
285 try:
286 self._changepath(f, '?')
286 self._changepath(f, '?')
287 del self._map[f]
287 del self._map[f]
288 except KeyError:
288 except KeyError:
289 self._ui.warn(_("not in dirstate: %s!\n") % f)
289 self._ui.warn(_("not in dirstate: %s!\n") % f)
290
290
291 def clear(self):
291 def clear(self):
292 self._map = {}
292 self._map = {}
293 if "_dirs" in self.__dict__:
293 if "_dirs" in self.__dict__:
294 delattr(self, "_dirs");
294 delattr(self, "_dirs");
295 self._copymap = {}
295 self._copymap = {}
296 self._pl = [nullid, nullid]
296 self._pl = [nullid, nullid]
297 self._dirty = True
297 self._dirty = True
298
298
299 def rebuild(self, parent, files):
299 def rebuild(self, parent, files):
300 self.clear()
300 self.clear()
301 for f in files:
301 for f in files:
302 if files.execf(f):
302 if files.execf(f):
303 self._map[f] = ('n', 0777, -1, 0, 0)
303 self._map[f] = ('n', 0777, -1, 0, 0)
304 else:
304 else:
305 self._map[f] = ('n', 0666, -1, 0, 0)
305 self._map[f] = ('n', 0666, -1, 0, 0)
306 self._pl = (parent, nullid)
306 self._pl = (parent, nullid)
307 self._dirty = True
307 self._dirty = True
308
308
309 def write(self):
309 def write(self):
310 if not self._dirty:
310 if not self._dirty:
311 return
311 return
312 cs = cStringIO.StringIO()
312 cs = cStringIO.StringIO()
313 copymap = self._copymap
313 copymap = self._copymap
314 pack = struct.pack
314 pack = struct.pack
315 write = cs.write
315 write = cs.write
316 write("".join(self._pl))
316 write("".join(self._pl))
317 for f, e in self._map.iteritems():
317 for f, e in self._map.iteritems():
318 if f in copymap:
318 if f in copymap:
319 f = "%s\0%s" % (f, copymap[f])
319 f = "%s\0%s" % (f, copymap[f])
320 e = pack(_format, e[0], e[1], e[2], e[3], len(f))
320 e = pack(_format, e[0], e[1], e[2], e[3], len(f))
321 write(e)
321 write(e)
322 write(f)
322 write(f)
323 st = self._opener("dirstate", "w", atomictemp=True)
323 st = self._opener("dirstate", "w", atomictemp=True)
324 st.write(cs.getvalue())
324 st.write(cs.getvalue())
325 st.rename()
325 st.rename()
326 self._dirty = self._dirtypl = False
326 self._dirty = self._dirtypl = False
327
327
328 def _filter(self, files):
328 def _filter(self, files):
329 ret = {}
329 ret = {}
330 unknown = []
330 unknown = []
331
331
332 for x in files:
332 for x in files:
333 if x == '.':
333 if x == '.':
334 return self._map.copy()
334 return self._map.copy()
335 if x not in self._map:
335 if x not in self._map:
336 unknown.append(x)
336 unknown.append(x)
337 else:
337 else:
338 ret[x] = self._map[x]
338 ret[x] = self._map[x]
339
339
340 if not unknown:
340 if not unknown:
341 return ret
341 return ret
342
342
343 b = self._map.keys()
343 b = self._map.keys()
344 b.sort()
344 b.sort()
345 blen = len(b)
345 blen = len(b)
346
346
347 for x in unknown:
347 for x in unknown:
348 bs = bisect.bisect(b, "%s%s" % (x, '/'))
348 bs = bisect.bisect(b, "%s%s" % (x, '/'))
349 while bs < blen:
349 while bs < blen:
350 s = b[bs]
350 s = b[bs]
351 if len(s) > len(x) and s.startswith(x):
351 if len(s) > len(x) and s.startswith(x):
352 ret[s] = self._map[s]
352 ret[s] = self._map[s]
353 else:
353 else:
354 break
354 break
355 bs += 1
355 bs += 1
356 return ret
356 return ret
357
357
358 def _supported(self, f, mode, verbose=False):
358 def _supported(self, f, mode, verbose=False):
359 if stat.S_ISREG(mode) or stat.S_ISLNK(mode):
359 if stat.S_ISREG(mode) or stat.S_ISLNK(mode):
360 return True
360 return True
361 if verbose:
361 if verbose:
362 kind = 'unknown'
362 kind = 'unknown'
363 if stat.S_ISCHR(mode): kind = _('character device')
363 if stat.S_ISCHR(mode): kind = _('character device')
364 elif stat.S_ISBLK(mode): kind = _('block device')
364 elif stat.S_ISBLK(mode): kind = _('block device')
365 elif stat.S_ISFIFO(mode): kind = _('fifo')
365 elif stat.S_ISFIFO(mode): kind = _('fifo')
366 elif stat.S_ISSOCK(mode): kind = _('socket')
366 elif stat.S_ISSOCK(mode): kind = _('socket')
367 elif stat.S_ISDIR(mode): kind = _('directory')
367 elif stat.S_ISDIR(mode): kind = _('directory')
368 self._ui.warn(_('%s: unsupported file type (type is %s)\n')
368 self._ui.warn(_('%s: unsupported file type (type is %s)\n')
369 % (self.pathto(f), kind))
369 % (self.pathto(f), kind))
370 return False
370 return False
371
371
372 def _dirignore(self, f):
373 if self._ignore(f):
374 return True
375 for c in strutil.findall(f, '/'):
376 if self._ignore(f[:c]):
377 return True
378 return False
379
372 def walk(self, files=None, match=util.always, badmatch=None):
380 def walk(self, files=None, match=util.always, badmatch=None):
373 # filter out the stat
381 # filter out the stat
374 for src, f, st in self.statwalk(files, match, badmatch=badmatch):
382 for src, f, st in self.statwalk(files, match, badmatch=badmatch):
375 yield src, f
383 yield src, f
376
384
377 def statwalk(self, files=None, match=util.always, ignored=False,
385 def statwalk(self, files=None, match=util.always, ignored=False,
378 badmatch=None, directories=False):
386 badmatch=None, directories=False):
379 '''
387 '''
380 walk recursively through the directory tree, finding all files
388 walk recursively through the directory tree, finding all files
381 matched by the match function
389 matched by the match function
382
390
383 results are yielded in a tuple (src, filename, st), where src
391 results are yielded in a tuple (src, filename, st), where src
384 is one of:
392 is one of:
385 'f' the file was found in the directory tree
393 'f' the file was found in the directory tree
386 'd' the file is a directory of the tree
394 'd' the file is a directory of the tree
387 'm' the file was only in the dirstate and not in the tree
395 'm' the file was only in the dirstate and not in the tree
388 'b' file was not found and matched badmatch
396 'b' file was not found and matched badmatch
389
397
390 and st is the stat result if the file was found in the directory.
398 and st is the stat result if the file was found in the directory.
391 '''
399 '''
392
400
393 # walk all files by default
401 # walk all files by default
394 if not files:
402 if not files:
395 files = ['.']
403 files = ['.']
396 dc = self._map.copy()
404 dc = self._map.copy()
397 else:
405 else:
398 files = util.unique(files)
406 files = util.unique(files)
399 dc = self._filter(files)
407 dc = self._filter(files)
400
408
401 def imatch(file_):
409 def imatch(file_):
402 if file_ not in dc and self._ignore(file_):
410 if file_ not in dc and self._ignore(file_):
403 return False
411 return False
404 return match(file_)
412 return match(file_)
405
413
406 ignore = self._ignore
414 ignore = self._ignore
415 dirignore = self._dirignore
407 if ignored:
416 if ignored:
408 imatch = match
417 imatch = match
409 ignore = util.never
418 ignore = util.never
419 dirignore = util.never
410
420
411 # self._root may end with a path separator when self._root == '/'
421 # self._root may end with a path separator when self._root == '/'
412 common_prefix_len = len(self._root)
422 common_prefix_len = len(self._root)
413 if not self._root.endswith(os.sep):
423 if not self._root.endswith(os.sep):
414 common_prefix_len += 1
424 common_prefix_len += 1
415
425
416 normpath = util.normpath
426 normpath = util.normpath
417 listdir = osutil.listdir
427 listdir = osutil.listdir
418 lstat = os.lstat
428 lstat = os.lstat
419 bisect_left = bisect.bisect_left
429 bisect_left = bisect.bisect_left
420 isdir = os.path.isdir
430 isdir = os.path.isdir
421 pconvert = util.pconvert
431 pconvert = util.pconvert
422 join = os.path.join
432 join = os.path.join
423 s_isdir = stat.S_ISDIR
433 s_isdir = stat.S_ISDIR
424 supported = self._supported
434 supported = self._supported
425 _join = self._join
435 _join = self._join
426 known = {'.hg': 1}
436 known = {'.hg': 1}
427
437
428 # recursion free walker, faster than os.walk.
438 # recursion free walker, faster than os.walk.
429 def findfiles(s):
439 def findfiles(s):
430 work = [s]
440 work = [s]
431 wadd = work.append
441 wadd = work.append
432 found = []
442 found = []
433 add = found.append
443 add = found.append
434 if directories:
444 if directories:
435 add((normpath(s[common_prefix_len:]), 'd', lstat(s)))
445 add((normpath(s[common_prefix_len:]), 'd', lstat(s)))
436 while work:
446 while work:
437 top = work.pop()
447 top = work.pop()
438 entries = listdir(top, stat=True)
448 entries = listdir(top, stat=True)
439 # nd is the top of the repository dir tree
449 # nd is the top of the repository dir tree
440 nd = normpath(top[common_prefix_len:])
450 nd = normpath(top[common_prefix_len:])
441 if nd == '.':
451 if nd == '.':
442 nd = ''
452 nd = ''
443 else:
453 else:
444 # do not recurse into a repo contained in this
454 # do not recurse into a repo contained in this
445 # one. use bisect to find .hg directory so speed
455 # one. use bisect to find .hg directory so speed
446 # is good on big directory.
456 # is good on big directory.
447 names = [e[0] for e in entries]
457 names = [e[0] for e in entries]
448 hg = bisect_left(names, '.hg')
458 hg = bisect_left(names, '.hg')
449 if hg < len(names) and names[hg] == '.hg':
459 if hg < len(names) and names[hg] == '.hg':
450 if isdir(join(top, '.hg')):
460 if isdir(join(top, '.hg')):
451 continue
461 continue
452 for f, kind, st in entries:
462 for f, kind, st in entries:
453 np = pconvert(join(nd, f))
463 np = pconvert(join(nd, f))
454 if np in known:
464 if np in known:
455 continue
465 continue
456 known[np] = 1
466 known[np] = 1
457 p = join(top, f)
467 p = join(top, f)
458 # don't trip over symlinks
468 # don't trip over symlinks
459 if kind == stat.S_IFDIR:
469 if kind == stat.S_IFDIR:
460 if not ignore(np):
470 if not ignore(np):
461 wadd(p)
471 wadd(p)
462 if directories:
472 if directories:
463 add((np, 'd', st))
473 add((np, 'd', st))
464 if np in dc and match(np):
474 if np in dc and match(np):
465 add((np, 'm', st))
475 add((np, 'm', st))
466 elif imatch(np):
476 elif imatch(np):
467 if supported(np, st.st_mode):
477 if supported(np, st.st_mode):
468 add((np, 'f', st))
478 add((np, 'f', st))
469 elif np in dc:
479 elif np in dc:
470 add((np, 'm', st))
480 add((np, 'm', st))
471 found.sort()
481 found.sort()
472 return found
482 return found
473
483
474 # step one, find all files that match our criteria
484 # step one, find all files that match our criteria
475 files.sort()
485 files.sort()
476 for ff in files:
486 for ff in files:
477 nf = normpath(ff)
487 nf = normpath(ff)
478 f = _join(ff)
488 f = _join(ff)
479 try:
489 try:
480 st = lstat(f)
490 st = lstat(f)
481 except OSError, inst:
491 except OSError, inst:
482 found = False
492 found = False
483 for fn in dc:
493 for fn in dc:
484 if nf == fn or (fn.startswith(nf) and fn[len(nf)] == '/'):
494 if nf == fn or (fn.startswith(nf) and fn[len(nf)] == '/'):
485 found = True
495 found = True
486 break
496 break
487 if not found:
497 if not found:
488 if inst.errno != errno.ENOENT or not badmatch:
498 if inst.errno != errno.ENOENT or not badmatch:
489 self._ui.warn('%s: %s\n' %
499 self._ui.warn('%s: %s\n' %
490 (self.pathto(ff), inst.strerror))
500 (self.pathto(ff), inst.strerror))
491 elif badmatch and badmatch(ff) and imatch(nf):
501 elif badmatch and badmatch(ff) and imatch(nf):
492 yield 'b', ff, None
502 yield 'b', ff, None
493 continue
503 continue
494 if s_isdir(st.st_mode):
504 if s_isdir(st.st_mode):
495 for f, src, st in findfiles(f):
505 if not dirignore(nf):
496 yield src, f, st
506 for f, src, st in findfiles(f):
507 yield src, f, st
497 else:
508 else:
498 if nf in known:
509 if nf in known:
499 continue
510 continue
500 known[nf] = 1
511 known[nf] = 1
501 if match(nf):
512 if match(nf):
502 if supported(ff, st.st_mode, verbose=True):
513 if supported(ff, st.st_mode, verbose=True):
503 yield 'f', nf, st
514 yield 'f', nf, st
504 elif ff in dc:
515 elif ff in dc:
505 yield 'm', nf, st
516 yield 'm', nf, st
506
517
507 # step two run through anything left in the dc hash and yield
518 # step two run through anything left in the dc hash and yield
508 # if we haven't already seen it
519 # if we haven't already seen it
509 ks = dc.keys()
520 ks = dc.keys()
510 ks.sort()
521 ks.sort()
511 for k in ks:
522 for k in ks:
512 if k in known:
523 if k in known:
513 continue
524 continue
514 known[k] = 1
525 known[k] = 1
515 if imatch(k):
526 if imatch(k):
516 yield 'm', k, None
527 yield 'm', k, None
517
528
518 def status(self, files, match, list_ignored, list_clean):
529 def status(self, files, match, list_ignored, list_clean):
519 lookup, modified, added, unknown, ignored = [], [], [], [], []
530 lookup, modified, added, unknown, ignored = [], [], [], [], []
520 removed, deleted, clean = [], [], []
531 removed, deleted, clean = [], [], []
521
532
522 _join = self._join
533 _join = self._join
523 lstat = os.lstat
534 lstat = os.lstat
524 cmap = self._copymap
535 cmap = self._copymap
525 dmap = self._map
536 dmap = self._map
526 ladd = lookup.append
537 ladd = lookup.append
527 madd = modified.append
538 madd = modified.append
528 aadd = added.append
539 aadd = added.append
529 uadd = unknown.append
540 uadd = unknown.append
530 iadd = ignored.append
541 iadd = ignored.append
531 radd = removed.append
542 radd = removed.append
532 dadd = deleted.append
543 dadd = deleted.append
533 cadd = clean.append
544 cadd = clean.append
534
545
535 for src, fn, st in self.statwalk(files, match, ignored=list_ignored):
546 for src, fn, st in self.statwalk(files, match, ignored=list_ignored):
536 if fn in dmap:
547 if fn in dmap:
537 type_, mode, size, time, foo = dmap[fn]
548 type_, mode, size, time, foo = dmap[fn]
538 else:
549 else:
539 if list_ignored and self._ignore(fn):
550 if list_ignored and self._ignore(fn):
540 iadd(fn)
551 iadd(fn)
541 else:
552 else:
542 uadd(fn)
553 uadd(fn)
543 continue
554 continue
544 if src == 'm':
555 if src == 'm':
545 nonexistent = True
556 nonexistent = True
546 if not st:
557 if not st:
547 try:
558 try:
548 st = lstat(_join(fn))
559 st = lstat(_join(fn))
549 except OSError, inst:
560 except OSError, inst:
550 if inst.errno not in (errno.ENOENT, errno.ENOTDIR):
561 if inst.errno not in (errno.ENOENT, errno.ENOTDIR):
551 raise
562 raise
552 st = None
563 st = None
553 # We need to re-check that it is a valid file
564 # We need to re-check that it is a valid file
554 if st and self._supported(fn, st.st_mode):
565 if st and self._supported(fn, st.st_mode):
555 nonexistent = False
566 nonexistent = False
556 # XXX: what to do with file no longer present in the fs
567 # XXX: what to do with file no longer present in the fs
557 # who are not removed in the dirstate ?
568 # who are not removed in the dirstate ?
558 if nonexistent and type_ in "nm":
569 if nonexistent and type_ in "nm":
559 dadd(fn)
570 dadd(fn)
560 continue
571 continue
561 # check the common case first
572 # check the common case first
562 if type_ == 'n':
573 if type_ == 'n':
563 if not st:
574 if not st:
564 st = lstat(_join(fn))
575 st = lstat(_join(fn))
565 if (size >= 0 and (size != st.st_size
576 if (size >= 0 and (size != st.st_size
566 or (mode ^ st.st_mode) & 0100)
577 or (mode ^ st.st_mode) & 0100)
567 or size == -2
578 or size == -2
568 or fn in self._copymap):
579 or fn in self._copymap):
569 madd(fn)
580 madd(fn)
570 elif time != int(st.st_mtime):
581 elif time != int(st.st_mtime):
571 ladd(fn)
582 ladd(fn)
572 elif list_clean:
583 elif list_clean:
573 cadd(fn)
584 cadd(fn)
574 elif type_ == 'm':
585 elif type_ == 'm':
575 madd(fn)
586 madd(fn)
576 elif type_ == 'a':
587 elif type_ == 'a':
577 aadd(fn)
588 aadd(fn)
578 elif type_ == 'r':
589 elif type_ == 'r':
579 radd(fn)
590 radd(fn)
580
591
581 return (lookup, modified, added, removed, deleted, unknown, ignored,
592 return (lookup, modified, added, removed, deleted, unknown, ignored,
582 clean)
593 clean)
@@ -1,100 +1,107 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 debugwalk()
3 debugwalk()
4 {
4 {
5 echo "hg debugwalk $@"
5 echo "hg debugwalk $@"
6 hg debugwalk "$@"
6 hg debugwalk "$@"
7 echo
7 echo
8 }
8 }
9
9
10 chdir()
10 chdir()
11 {
11 {
12 echo "cd $@"
12 echo "cd $@"
13 cd "$@"
13 cd "$@"
14 echo
14 echo
15 }
15 }
16
16
17 mkdir t
17 mkdir t
18 cd t
18 cd t
19 hg init
19 hg init
20 mkdir -p beans
20 mkdir -p beans
21 for b in kidney navy turtle borlotti black pinto; do
21 for b in kidney navy turtle borlotti black pinto; do
22 echo $b > beans/$b
22 echo $b > beans/$b
23 done
23 done
24 mkdir -p mammals/Procyonidae
24 mkdir -p mammals/Procyonidae
25 for m in cacomistle coatimundi raccoon; do
25 for m in cacomistle coatimundi raccoon; do
26 echo $m > mammals/Procyonidae/$m
26 echo $m > mammals/Procyonidae/$m
27 done
27 done
28 echo skunk > mammals/skunk
28 echo skunk > mammals/skunk
29 echo fennel > fennel
29 echo fennel > fennel
30 echo fenugreek > fenugreek
30 echo fenugreek > fenugreek
31 echo fiddlehead > fiddlehead
31 echo fiddlehead > fiddlehead
32 echo glob:glob > glob:glob
32 echo glob:glob > glob:glob
33 hg addremove
33 hg addremove
34 hg commit -m "commit #0" -d "1000000 0"
34 hg commit -m "commit #0" -d "1000000 0"
35 debugwalk
35 debugwalk
36 debugwalk -I.
36 debugwalk -I.
37 chdir mammals
37 chdir mammals
38 debugwalk
38 debugwalk
39 debugwalk -X ../beans
39 debugwalk -X ../beans
40 debugwalk -I '*k'
40 debugwalk -I '*k'
41 debugwalk -I 'glob:*k'
41 debugwalk -I 'glob:*k'
42 debugwalk -I 'relglob:*k'
42 debugwalk -I 'relglob:*k'
43 debugwalk -I 'relglob:*k' .
43 debugwalk -I 'relglob:*k' .
44 debugwalk -I 're:.*k$'
44 debugwalk -I 're:.*k$'
45 debugwalk -I 'relre:.*k$'
45 debugwalk -I 'relre:.*k$'
46 debugwalk -I 'path:beans'
46 debugwalk -I 'path:beans'
47 debugwalk -I 'relpath:../beans'
47 debugwalk -I 'relpath:../beans'
48 debugwalk .
48 debugwalk .
49 debugwalk -I.
49 debugwalk -I.
50 debugwalk Procyonidae
50 debugwalk Procyonidae
51 chdir Procyonidae
51 chdir Procyonidae
52 debugwalk .
52 debugwalk .
53 debugwalk ..
53 debugwalk ..
54 chdir ..
54 chdir ..
55 debugwalk ../beans
55 debugwalk ../beans
56 debugwalk .
56 debugwalk .
57 debugwalk .hg
57 debugwalk .hg
58 debugwalk ../.hg
58 debugwalk ../.hg
59 chdir ..
59 chdir ..
60 debugwalk -Ibeans
60 debugwalk -Ibeans
61 debugwalk 'glob:mammals/../beans/b*'
61 debugwalk 'glob:mammals/../beans/b*'
62 debugwalk '-X*/Procyonidae' mammals
62 debugwalk '-X*/Procyonidae' mammals
63 debugwalk path:mammals
63 debugwalk path:mammals
64 debugwalk ..
64 debugwalk ..
65 debugwalk beans/../..
65 debugwalk beans/../..
66 debugwalk .hg
66 debugwalk .hg
67 debugwalk beans/../.hg
67 debugwalk beans/../.hg
68 debugwalk beans/../.hg/data
68 debugwalk beans/../.hg/data
69 debugwalk beans/.hg
69 debugwalk beans/.hg
70 # Don't know how to test absolute paths without always getting a false
70 # Don't know how to test absolute paths without always getting a false
71 # error.
71 # error.
72 #debugwalk `pwd`/beans
72 #debugwalk `pwd`/beans
73 #debugwalk `pwd`/..
73 #debugwalk `pwd`/..
74 debugwalk glob:\*
74 debugwalk glob:\*
75 debugwalk 'glob:**e'
75 debugwalk 'glob:**e'
76 debugwalk 're:.*[kb]$'
76 debugwalk 're:.*[kb]$'
77 debugwalk path:beans/black
77 debugwalk path:beans/black
78 debugwalk path:beans//black
78 debugwalk path:beans//black
79 debugwalk relglob:Procyonidae
79 debugwalk relglob:Procyonidae
80 debugwalk 'relglob:Procyonidae/**'
80 debugwalk 'relglob:Procyonidae/**'
81 debugwalk 'relglob:Procyonidae/**' fennel
81 debugwalk 'relglob:Procyonidae/**' fennel
82 debugwalk beans 'glob:beans/*'
82 debugwalk beans 'glob:beans/*'
83 debugwalk 'glob:mamm**'
83 debugwalk 'glob:mamm**'
84 debugwalk 'glob:mamm**' fennel
84 debugwalk 'glob:mamm**' fennel
85 debugwalk 'glob:j*'
85 debugwalk 'glob:j*'
86 debugwalk NOEXIST
86 debugwalk NOEXIST
87 mkfifo fifo
87 mkfifo fifo
88 debugwalk fifo
88 debugwalk fifo
89 rm fenugreek
89 rm fenugreek
90 debugwalk fenugreek
90 debugwalk fenugreek
91 hg rm fenugreek
91 hg rm fenugreek
92 debugwalk fenugreek
92 debugwalk fenugreek
93 touch new
93 touch new
94 debugwalk new
94 debugwalk new
95
96 mkdir ignored
97 touch ignored/file
98 echo '^ignored$' > .hgignore
99 debugwalk ignored
100 debugwalk ignored/file
101
95 chdir ..
102 chdir ..
96 debugwalk -R t t/mammals/skunk
103 debugwalk -R t t/mammals/skunk
97 mkdir t2
104 mkdir t2
98 chdir t2
105 chdir t2
99 debugwalk -R ../t ../t/mammals/skunk
106 debugwalk -R ../t ../t/mammals/skunk
100 debugwalk --cwd ../t mammals/skunk
107 debugwalk --cwd ../t mammals/skunk
@@ -1,293 +1,298 b''
1 adding beans/black
1 adding beans/black
2 adding beans/borlotti
2 adding beans/borlotti
3 adding beans/kidney
3 adding beans/kidney
4 adding beans/navy
4 adding beans/navy
5 adding beans/pinto
5 adding beans/pinto
6 adding beans/turtle
6 adding beans/turtle
7 adding fennel
7 adding fennel
8 adding fenugreek
8 adding fenugreek
9 adding fiddlehead
9 adding fiddlehead
10 adding glob:glob
10 adding glob:glob
11 adding mammals/Procyonidae/cacomistle
11 adding mammals/Procyonidae/cacomistle
12 adding mammals/Procyonidae/coatimundi
12 adding mammals/Procyonidae/coatimundi
13 adding mammals/Procyonidae/raccoon
13 adding mammals/Procyonidae/raccoon
14 adding mammals/skunk
14 adding mammals/skunk
15 hg debugwalk
15 hg debugwalk
16 f beans/black beans/black
16 f beans/black beans/black
17 f beans/borlotti beans/borlotti
17 f beans/borlotti beans/borlotti
18 f beans/kidney beans/kidney
18 f beans/kidney beans/kidney
19 f beans/navy beans/navy
19 f beans/navy beans/navy
20 f beans/pinto beans/pinto
20 f beans/pinto beans/pinto
21 f beans/turtle beans/turtle
21 f beans/turtle beans/turtle
22 f fennel fennel
22 f fennel fennel
23 f fenugreek fenugreek
23 f fenugreek fenugreek
24 f fiddlehead fiddlehead
24 f fiddlehead fiddlehead
25 f glob:glob glob:glob
25 f glob:glob glob:glob
26 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
26 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
27 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
27 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
28 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
28 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
29 f mammals/skunk mammals/skunk
29 f mammals/skunk mammals/skunk
30
30
31 hg debugwalk -I.
31 hg debugwalk -I.
32 f beans/black beans/black
32 f beans/black beans/black
33 f beans/borlotti beans/borlotti
33 f beans/borlotti beans/borlotti
34 f beans/kidney beans/kidney
34 f beans/kidney beans/kidney
35 f beans/navy beans/navy
35 f beans/navy beans/navy
36 f beans/pinto beans/pinto
36 f beans/pinto beans/pinto
37 f beans/turtle beans/turtle
37 f beans/turtle beans/turtle
38 f fennel fennel
38 f fennel fennel
39 f fenugreek fenugreek
39 f fenugreek fenugreek
40 f fiddlehead fiddlehead
40 f fiddlehead fiddlehead
41 f glob:glob glob:glob
41 f glob:glob glob:glob
42 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
42 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
43 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
43 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
44 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
44 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
45 f mammals/skunk mammals/skunk
45 f mammals/skunk mammals/skunk
46
46
47 cd mammals
47 cd mammals
48
48
49 hg debugwalk
49 hg debugwalk
50 f beans/black ../beans/black
50 f beans/black ../beans/black
51 f beans/borlotti ../beans/borlotti
51 f beans/borlotti ../beans/borlotti
52 f beans/kidney ../beans/kidney
52 f beans/kidney ../beans/kidney
53 f beans/navy ../beans/navy
53 f beans/navy ../beans/navy
54 f beans/pinto ../beans/pinto
54 f beans/pinto ../beans/pinto
55 f beans/turtle ../beans/turtle
55 f beans/turtle ../beans/turtle
56 f fennel ../fennel
56 f fennel ../fennel
57 f fenugreek ../fenugreek
57 f fenugreek ../fenugreek
58 f fiddlehead ../fiddlehead
58 f fiddlehead ../fiddlehead
59 f glob:glob ../glob:glob
59 f glob:glob ../glob:glob
60 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
60 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
61 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
61 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
62 f mammals/Procyonidae/raccoon Procyonidae/raccoon
62 f mammals/Procyonidae/raccoon Procyonidae/raccoon
63 f mammals/skunk skunk
63 f mammals/skunk skunk
64
64
65 hg debugwalk -X ../beans
65 hg debugwalk -X ../beans
66 f fennel ../fennel
66 f fennel ../fennel
67 f fenugreek ../fenugreek
67 f fenugreek ../fenugreek
68 f fiddlehead ../fiddlehead
68 f fiddlehead ../fiddlehead
69 f glob:glob ../glob:glob
69 f glob:glob ../glob:glob
70 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
70 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
71 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
71 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
72 f mammals/Procyonidae/raccoon Procyonidae/raccoon
72 f mammals/Procyonidae/raccoon Procyonidae/raccoon
73 f mammals/skunk skunk
73 f mammals/skunk skunk
74
74
75 hg debugwalk -I *k
75 hg debugwalk -I *k
76 f mammals/skunk skunk
76 f mammals/skunk skunk
77
77
78 hg debugwalk -I glob:*k
78 hg debugwalk -I glob:*k
79 f mammals/skunk skunk
79 f mammals/skunk skunk
80
80
81 hg debugwalk -I relglob:*k
81 hg debugwalk -I relglob:*k
82 f beans/black ../beans/black
82 f beans/black ../beans/black
83 f fenugreek ../fenugreek
83 f fenugreek ../fenugreek
84 f mammals/skunk skunk
84 f mammals/skunk skunk
85
85
86 hg debugwalk -I relglob:*k .
86 hg debugwalk -I relglob:*k .
87 f mammals/skunk skunk
87 f mammals/skunk skunk
88
88
89 hg debugwalk -I re:.*k$
89 hg debugwalk -I re:.*k$
90 f beans/black ../beans/black
90 f beans/black ../beans/black
91 f fenugreek ../fenugreek
91 f fenugreek ../fenugreek
92 f mammals/skunk skunk
92 f mammals/skunk skunk
93
93
94 hg debugwalk -I relre:.*k$
94 hg debugwalk -I relre:.*k$
95 f beans/black ../beans/black
95 f beans/black ../beans/black
96 f fenugreek ../fenugreek
96 f fenugreek ../fenugreek
97 f mammals/skunk skunk
97 f mammals/skunk skunk
98
98
99 hg debugwalk -I path:beans
99 hg debugwalk -I path:beans
100 f beans/black ../beans/black
100 f beans/black ../beans/black
101 f beans/borlotti ../beans/borlotti
101 f beans/borlotti ../beans/borlotti
102 f beans/kidney ../beans/kidney
102 f beans/kidney ../beans/kidney
103 f beans/navy ../beans/navy
103 f beans/navy ../beans/navy
104 f beans/pinto ../beans/pinto
104 f beans/pinto ../beans/pinto
105 f beans/turtle ../beans/turtle
105 f beans/turtle ../beans/turtle
106
106
107 hg debugwalk -I relpath:../beans
107 hg debugwalk -I relpath:../beans
108 f beans/black ../beans/black
108 f beans/black ../beans/black
109 f beans/borlotti ../beans/borlotti
109 f beans/borlotti ../beans/borlotti
110 f beans/kidney ../beans/kidney
110 f beans/kidney ../beans/kidney
111 f beans/navy ../beans/navy
111 f beans/navy ../beans/navy
112 f beans/pinto ../beans/pinto
112 f beans/pinto ../beans/pinto
113 f beans/turtle ../beans/turtle
113 f beans/turtle ../beans/turtle
114
114
115 hg debugwalk .
115 hg debugwalk .
116 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
116 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
117 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
117 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
118 f mammals/Procyonidae/raccoon Procyonidae/raccoon
118 f mammals/Procyonidae/raccoon Procyonidae/raccoon
119 f mammals/skunk skunk
119 f mammals/skunk skunk
120
120
121 hg debugwalk -I.
121 hg debugwalk -I.
122 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
122 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
123 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
123 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
124 f mammals/Procyonidae/raccoon Procyonidae/raccoon
124 f mammals/Procyonidae/raccoon Procyonidae/raccoon
125 f mammals/skunk skunk
125 f mammals/skunk skunk
126
126
127 hg debugwalk Procyonidae
127 hg debugwalk Procyonidae
128 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
128 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
129 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
129 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
130 f mammals/Procyonidae/raccoon Procyonidae/raccoon
130 f mammals/Procyonidae/raccoon Procyonidae/raccoon
131
131
132 cd Procyonidae
132 cd Procyonidae
133
133
134 hg debugwalk .
134 hg debugwalk .
135 f mammals/Procyonidae/cacomistle cacomistle
135 f mammals/Procyonidae/cacomistle cacomistle
136 f mammals/Procyonidae/coatimundi coatimundi
136 f mammals/Procyonidae/coatimundi coatimundi
137 f mammals/Procyonidae/raccoon raccoon
137 f mammals/Procyonidae/raccoon raccoon
138
138
139 hg debugwalk ..
139 hg debugwalk ..
140 f mammals/Procyonidae/cacomistle cacomistle
140 f mammals/Procyonidae/cacomistle cacomistle
141 f mammals/Procyonidae/coatimundi coatimundi
141 f mammals/Procyonidae/coatimundi coatimundi
142 f mammals/Procyonidae/raccoon raccoon
142 f mammals/Procyonidae/raccoon raccoon
143 f mammals/skunk ../skunk
143 f mammals/skunk ../skunk
144
144
145 cd ..
145 cd ..
146
146
147 hg debugwalk ../beans
147 hg debugwalk ../beans
148 f beans/black ../beans/black
148 f beans/black ../beans/black
149 f beans/borlotti ../beans/borlotti
149 f beans/borlotti ../beans/borlotti
150 f beans/kidney ../beans/kidney
150 f beans/kidney ../beans/kidney
151 f beans/navy ../beans/navy
151 f beans/navy ../beans/navy
152 f beans/pinto ../beans/pinto
152 f beans/pinto ../beans/pinto
153 f beans/turtle ../beans/turtle
153 f beans/turtle ../beans/turtle
154
154
155 hg debugwalk .
155 hg debugwalk .
156 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
156 f mammals/Procyonidae/cacomistle Procyonidae/cacomistle
157 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
157 f mammals/Procyonidae/coatimundi Procyonidae/coatimundi
158 f mammals/Procyonidae/raccoon Procyonidae/raccoon
158 f mammals/Procyonidae/raccoon Procyonidae/raccoon
159 f mammals/skunk skunk
159 f mammals/skunk skunk
160
160
161 hg debugwalk .hg
161 hg debugwalk .hg
162 .hg: No such file or directory
162 .hg: No such file or directory
163
163
164 hg debugwalk ../.hg
164 hg debugwalk ../.hg
165 abort: path contains illegal component: .hg
165 abort: path contains illegal component: .hg
166
166
167 cd ..
167 cd ..
168
168
169 hg debugwalk -Ibeans
169 hg debugwalk -Ibeans
170 f beans/black beans/black
170 f beans/black beans/black
171 f beans/borlotti beans/borlotti
171 f beans/borlotti beans/borlotti
172 f beans/kidney beans/kidney
172 f beans/kidney beans/kidney
173 f beans/navy beans/navy
173 f beans/navy beans/navy
174 f beans/pinto beans/pinto
174 f beans/pinto beans/pinto
175 f beans/turtle beans/turtle
175 f beans/turtle beans/turtle
176
176
177 hg debugwalk glob:mammals/../beans/b*
177 hg debugwalk glob:mammals/../beans/b*
178 f beans/black beans/black
178 f beans/black beans/black
179 f beans/borlotti beans/borlotti
179 f beans/borlotti beans/borlotti
180
180
181 hg debugwalk -X*/Procyonidae mammals
181 hg debugwalk -X*/Procyonidae mammals
182 f mammals/skunk mammals/skunk
182 f mammals/skunk mammals/skunk
183
183
184 hg debugwalk path:mammals
184 hg debugwalk path:mammals
185 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
185 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
186 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
186 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
187 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
187 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
188 f mammals/skunk mammals/skunk
188 f mammals/skunk mammals/skunk
189
189
190 hg debugwalk ..
190 hg debugwalk ..
191 abort: .. not under root
191 abort: .. not under root
192
192
193 hg debugwalk beans/../..
193 hg debugwalk beans/../..
194 abort: beans/../.. not under root
194 abort: beans/../.. not under root
195
195
196 hg debugwalk .hg
196 hg debugwalk .hg
197 abort: path contains illegal component: .hg
197 abort: path contains illegal component: .hg
198
198
199 hg debugwalk beans/../.hg
199 hg debugwalk beans/../.hg
200 abort: path contains illegal component: .hg
200 abort: path contains illegal component: .hg
201
201
202 hg debugwalk beans/../.hg/data
202 hg debugwalk beans/../.hg/data
203 abort: path contains illegal component: .hg/data
203 abort: path contains illegal component: .hg/data
204
204
205 hg debugwalk beans/.hg
205 hg debugwalk beans/.hg
206 beans/.hg: No such file or directory
206 beans/.hg: No such file or directory
207
207
208 hg debugwalk glob:*
208 hg debugwalk glob:*
209 f fennel fennel
209 f fennel fennel
210 f fenugreek fenugreek
210 f fenugreek fenugreek
211 f fiddlehead fiddlehead
211 f fiddlehead fiddlehead
212 f glob:glob glob:glob
212 f glob:glob glob:glob
213
213
214 hg debugwalk glob:**e
214 hg debugwalk glob:**e
215 f beans/turtle beans/turtle
215 f beans/turtle beans/turtle
216 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
216 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
217
217
218 hg debugwalk re:.*[kb]$
218 hg debugwalk re:.*[kb]$
219 f beans/black beans/black
219 f beans/black beans/black
220 f fenugreek fenugreek
220 f fenugreek fenugreek
221 f glob:glob glob:glob
221 f glob:glob glob:glob
222 f mammals/skunk mammals/skunk
222 f mammals/skunk mammals/skunk
223
223
224 hg debugwalk path:beans/black
224 hg debugwalk path:beans/black
225 f beans/black beans/black exact
225 f beans/black beans/black exact
226
226
227 hg debugwalk path:beans//black
227 hg debugwalk path:beans//black
228 f beans/black beans/black exact
228 f beans/black beans/black exact
229
229
230 hg debugwalk relglob:Procyonidae
230 hg debugwalk relglob:Procyonidae
231
231
232 hg debugwalk relglob:Procyonidae/**
232 hg debugwalk relglob:Procyonidae/**
233 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
233 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
234 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
234 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
235 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
235 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
236
236
237 hg debugwalk relglob:Procyonidae/** fennel
237 hg debugwalk relglob:Procyonidae/** fennel
238 f fennel fennel exact
238 f fennel fennel exact
239 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
239 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
240 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
240 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
241 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
241 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
242
242
243 hg debugwalk beans glob:beans/*
243 hg debugwalk beans glob:beans/*
244 f beans/black beans/black
244 f beans/black beans/black
245 f beans/borlotti beans/borlotti
245 f beans/borlotti beans/borlotti
246 f beans/kidney beans/kidney
246 f beans/kidney beans/kidney
247 f beans/navy beans/navy
247 f beans/navy beans/navy
248 f beans/pinto beans/pinto
248 f beans/pinto beans/pinto
249 f beans/turtle beans/turtle
249 f beans/turtle beans/turtle
250
250
251 hg debugwalk glob:mamm**
251 hg debugwalk glob:mamm**
252 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
252 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
253 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
253 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
254 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
254 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
255 f mammals/skunk mammals/skunk
255 f mammals/skunk mammals/skunk
256
256
257 hg debugwalk glob:mamm** fennel
257 hg debugwalk glob:mamm** fennel
258 f fennel fennel exact
258 f fennel fennel exact
259 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
259 f mammals/Procyonidae/cacomistle mammals/Procyonidae/cacomistle
260 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
260 f mammals/Procyonidae/coatimundi mammals/Procyonidae/coatimundi
261 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
261 f mammals/Procyonidae/raccoon mammals/Procyonidae/raccoon
262 f mammals/skunk mammals/skunk
262 f mammals/skunk mammals/skunk
263
263
264 hg debugwalk glob:j*
264 hg debugwalk glob:j*
265
265
266 hg debugwalk NOEXIST
266 hg debugwalk NOEXIST
267 NOEXIST: No such file or directory
267 NOEXIST: No such file or directory
268
268
269 hg debugwalk fifo
269 hg debugwalk fifo
270 fifo: unsupported file type (type is fifo)
270 fifo: unsupported file type (type is fifo)
271
271
272 hg debugwalk fenugreek
272 hg debugwalk fenugreek
273 m fenugreek fenugreek exact
273 m fenugreek fenugreek exact
274
274
275 hg debugwalk fenugreek
275 hg debugwalk fenugreek
276 m fenugreek fenugreek exact
276 m fenugreek fenugreek exact
277
277
278 hg debugwalk new
278 hg debugwalk new
279 f new new exact
279 f new new exact
280
280
281 hg debugwalk ignored
282
283 hg debugwalk ignored/file
284 f ignored/file ignored/file exact
285
281 cd ..
286 cd ..
282
287
283 hg debugwalk -R t t/mammals/skunk
288 hg debugwalk -R t t/mammals/skunk
284 f mammals/skunk t/mammals/skunk exact
289 f mammals/skunk t/mammals/skunk exact
285
290
286 cd t2
291 cd t2
287
292
288 hg debugwalk -R ../t ../t/mammals/skunk
293 hg debugwalk -R ../t ../t/mammals/skunk
289 f mammals/skunk ../t/mammals/skunk exact
294 f mammals/skunk ../t/mammals/skunk exact
290
295
291 hg debugwalk --cwd ../t mammals/skunk
296 hg debugwalk --cwd ../t mammals/skunk
292 f mammals/skunk mammals/skunk exact
297 f mammals/skunk mammals/skunk exact
293
298
General Comments 0
You need to be logged in to leave comments. Login now