##// END OF EJS Templates
dirstate.walk: push sorting up
Matt Mackall -
r6827:c978d675 default
parent child Browse files
Show More
@@ -598,7 +598,7 b' class workingctx(changectx):'
598 return self._parents[0].ancestor(c2) # punt on two parents for now
598 return self._parents[0].ancestor(c2) # punt on two parents for now
599
599
600 def walk(self, match):
600 def walk(self, match):
601 for fn, st in self._repo.dirstate.walk(match, True, False):
601 for fn, st in util.sort(self._repo.dirstate.walk(match, True, False)):
602 yield fn
602 yield fn
603
603
604 class workingfilectx(filectx):
604 class workingfilectx(filectx):
@@ -469,8 +469,6 b' class dirstate(object):'
469 _join = self._join
469 _join = self._join
470 work = []
470 work = []
471 wadd = work.append
471 wadd = work.append
472 found = []
473 add = found.append
474
472
475 seen = {'.hg': 1}
473 seen = {'.hg': 1}
476
474
@@ -532,14 +530,12 b' class dirstate(object):'
532 if not ignore(nf):
530 if not ignore(nf):
533 wadd(nf)
531 wadd(nf)
534 if nf in dmap and match(nf):
532 if nf in dmap and match(nf):
535 add((nf, None))
533 yield nf, None
536 elif imatch(nf):
534 elif imatch(nf):
537 if supported(nf, st.st_mode):
535 if supported(nf, st.st_mode):
538 add((nf, st))
536 yield nf, st
539 elif nf in dmap:
537 elif nf in dmap:
540 add((nf, None))
538 yield nf, None
541 for e in util.sort(found):
542 yield e
543
539
544 # step 3: report unseen items in the dmap hash
540 # step 3: report unseen items in the dmap hash
545 for f in util.sort(dmap):
541 for f in util.sort(dmap):
@@ -968,8 +968,6 b' class localrepository(repo.repository):'
968 if working: # we need to scan the working dir
968 if working: # we need to scan the working dir
969 s = self.dirstate.status(match, listignored, listclean, listunknown)
969 s = self.dirstate.status(match, listignored, listclean, listunknown)
970 cmp, modified, added, removed, deleted, unknown, ignored, clean = s
970 cmp, modified, added, removed, deleted, unknown, ignored, clean = s
971 removed.sort()
972 deleted.sort()
973
971
974 # check for any possibly clean files
972 # check for any possibly clean files
975 if parentworking and cmp:
973 if parentworking and cmp:
@@ -982,9 +980,8 b' class localrepository(repo.repository):'
982 else:
980 else:
983 fixup.append(f)
981 fixup.append(f)
984
982
985 modified.sort()
986 if listclean:
983 if listclean:
987 clean = util.sort(clean + fixup)
984 clean += fixup
988
985
989 # update dirstate for files that are actually clean
986 # update dirstate for files that are actually clean
990 if fixup:
987 if fixup:
@@ -1017,7 +1014,7 b' class localrepository(repo.repository):'
1017 mf2 = mfmatches(ctx2)
1014 mf2 = mfmatches(ctx2)
1018
1015
1019 modified, added, clean = [], [], []
1016 modified, added, clean = [], [], []
1020 for fn in util.sort(mf2):
1017 for fn in mf2:
1021 if fn in mf1:
1018 if fn in mf1:
1022 if (mf1.flags(fn) != mf2.flags(fn) or
1019 if (mf1.flags(fn) != mf2.flags(fn) or
1023 (mf1[fn] != mf2[fn] and
1020 (mf1[fn] != mf2[fn] and
@@ -1028,9 +1025,11 b' class localrepository(repo.repository):'
1028 del mf1[fn]
1025 del mf1[fn]
1029 else:
1026 else:
1030 added.append(fn)
1027 added.append(fn)
1031 removed = util.sort(mf1.keys())
1028 removed = mf1.keys()
1032
1029
1033 return modified, added, removed, deleted, unknown, ignored, clean
1030 r = modified, added, removed, deleted, unknown, ignored, clean
1031 [l.sort() for l in r]
1032 return r
1034
1033
1035 def add(self, list):
1034 def add(self, list):
1036 wlock = self.wlock()
1035 wlock = self.wlock()
@@ -10,8 +10,8 b' adding another-empty-file'
10 removing empty-file
10 removing empty-file
11 adding large-file
11 adding large-file
12 adding tiny-file
12 adding tiny-file
13 removing large-file
13 adding small-file
14 adding small-file
14 removing large-file
15 removing tiny-file
15 removing tiny-file
16 recording removal of tiny-file as rename to small-file (82% similar)
16 recording removal of tiny-file as rename to small-file (82% similar)
17 % should all fail
17 % should all fail
@@ -8,8 +8,8 b' dir/bar_2'
8 foo_2
8 foo_2
9 adding a
9 adding a
10 adding c
10 adding c
11 removing a
11 adding b
12 adding b
13 removing c
12 adding d
14 adding d
13 removing a
14 removing c
15 recording removal of a as rename to b (100% similar)
15 recording removal of a as rename to b (100% similar)
General Comments 0
You need to be logged in to leave comments. Login now