Show More
@@ -363,35 +363,46 b' class dirstate(object):' | |||
|
363 | 363 | common_prefix_len = len(self._root) |
|
364 | 364 | if not self._root.endswith(os.sep): |
|
365 | 365 | common_prefix_len += 1 |
|
366 | ||
|
366 | 367 | # recursion free walker, faster than os.walk. |
|
368 | normpath = util.normpath | |
|
369 | listdir = os.listdir | |
|
370 | lstat = os.lstat | |
|
371 | bisect_left = bisect.bisect_left | |
|
372 | isdir = os.path.isdir | |
|
373 | pconvert = util.pconvert | |
|
374 | join = os.path.join | |
|
375 | s_isdir = stat.S_ISDIR | |
|
376 | supported = self._supported | |
|
377 | ||
|
367 | 378 | def findfiles(s): |
|
368 | 379 | work = [s] |
|
369 | 380 | if directories: |
|
370 |
yield 'd', |
|
|
381 | yield 'd', normpath(s[common_prefix_len:]), os.lstat(s) | |
|
371 | 382 | while work: |
|
372 | 383 | top = work.pop() |
|
373 |
names = |
|
|
384 | names = listdir(top) | |
|
374 | 385 | names.sort() |
|
375 | 386 | # nd is the top of the repository dir tree |
|
376 |
nd = |
|
|
387 | nd = normpath(top[common_prefix_len:]) | |
|
377 | 388 | if nd == '.': |
|
378 | 389 | nd = '' |
|
379 | 390 | else: |
|
380 | 391 | # do not recurse into a repo contained in this |
|
381 | 392 | # one. use bisect to find .hg directory so speed |
|
382 | 393 | # is good on big directory. |
|
383 |
hg = |
|
|
394 | hg = bisect_left(names, '.hg') | |
|
384 | 395 | if hg < len(names) and names[hg] == '.hg': |
|
385 |
if |
|
|
396 | if isdir(join(top, '.hg')): | |
|
386 | 397 | continue |
|
387 | 398 | for f in names: |
|
388 |
np = |
|
|
399 | np = pconvert(os.path.join(nd, f)) | |
|
389 | 400 | if seen(np): |
|
390 | 401 | continue |
|
391 |
p = |
|
|
402 | p = join(top, f) | |
|
392 | 403 | # don't trip over symlinks |
|
393 |
st = |
|
|
394 |
if s |
|
|
404 | st = lstat(p) | |
|
405 | if s_isdir(st.st_mode): | |
|
395 | 406 | if not ignore(np): |
|
396 | 407 | work.append(p) |
|
397 | 408 | if directories: |
@@ -399,7 +410,7 b' class dirstate(object):' | |||
|
399 | 410 | if imatch(np) and np in dc: |
|
400 | 411 | yield 'm', np, st |
|
401 | 412 | elif imatch(np): |
|
402 |
if |
|
|
413 | if supported(np, st): | |
|
403 | 414 | yield 'f', np, st |
|
404 | 415 | elif np in dc: |
|
405 | 416 | yield 'm', np, st |
@@ -412,10 +423,10 b' class dirstate(object):' | |||
|
412 | 423 | # step one, find all files that match our criteria |
|
413 | 424 | files.sort() |
|
414 | 425 | for ff in files: |
|
415 |
nf = |
|
|
426 | nf = normpath(ff) | |
|
416 | 427 | f = self._join(ff) |
|
417 | 428 | try: |
|
418 |
st = |
|
|
429 | st = lstat(f) | |
|
419 | 430 | except OSError, inst: |
|
420 | 431 | found = False |
|
421 | 432 | for fn in dc: |
@@ -429,7 +440,7 b' class dirstate(object):' | |||
|
429 | 440 | elif badmatch and badmatch(ff) and imatch(nf): |
|
430 | 441 | yield 'b', ff, None |
|
431 | 442 | continue |
|
432 |
if s |
|
|
443 | if s_isdir(st.st_mode): | |
|
433 | 444 | cmp1 = (lambda x, y: cmp(x[1], y[1])) |
|
434 | 445 | sorted_ = [ x for x in findfiles(f) ] |
|
435 | 446 | sorted_.sort(cmp1) |
@@ -437,7 +448,7 b' class dirstate(object):' | |||
|
437 | 448 | yield e |
|
438 | 449 | else: |
|
439 | 450 | if not seen(nf) and match(nf): |
|
440 |
if |
|
|
451 | if supported(ff, st, verbose=True): | |
|
441 | 452 | yield 'f', nf, st |
|
442 | 453 | elif ff in dc: |
|
443 | 454 | yield 'm', nf, st |
General Comments 0
You need to be logged in to leave comments.
Login now