Mercurial > hg
changeset 6827:c978d6752dbb
dirstate.walk: push sorting up
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 22 Jul 2008 13:03:19 -0500 |
parents | eca20fee0728 |
children | 55d65a33da52 |
files | mercurial/context.py mercurial/dirstate.py mercurial/localrepo.py tests/test-addremove-similar.out tests/test-addremove.out |
diffstat | 5 files changed, 13 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/context.py Tue Jul 22 13:03:18 2008 -0500 +++ b/mercurial/context.py Tue Jul 22 13:03:19 2008 -0500 @@ -598,7 +598,7 @@ return self._parents[0].ancestor(c2) # punt on two parents for now def walk(self, match): - for fn, st in self._repo.dirstate.walk(match, True, False): + for fn, st in util.sort(self._repo.dirstate.walk(match, True, False)): yield fn class workingfilectx(filectx):
--- a/mercurial/dirstate.py Tue Jul 22 13:03:18 2008 -0500 +++ b/mercurial/dirstate.py Tue Jul 22 13:03:19 2008 -0500 @@ -469,8 +469,6 @@ _join = self._join work = [] wadd = work.append - found = [] - add = found.append seen = {'.hg': 1} @@ -532,14 +530,12 @@ if not ignore(nf): wadd(nf) if nf in dmap and match(nf): - add((nf, None)) + yield nf, None elif imatch(nf): if supported(nf, st.st_mode): - add((nf, st)) + yield nf, st elif nf in dmap: - add((nf, None)) - for e in util.sort(found): - yield e + yield nf, None # step 3: report unseen items in the dmap hash for f in util.sort(dmap):
--- a/mercurial/localrepo.py Tue Jul 22 13:03:18 2008 -0500 +++ b/mercurial/localrepo.py Tue Jul 22 13:03:19 2008 -0500 @@ -968,8 +968,6 @@ if working: # we need to scan the working dir s = self.dirstate.status(match, listignored, listclean, listunknown) cmp, modified, added, removed, deleted, unknown, ignored, clean = s - removed.sort() - deleted.sort() # check for any possibly clean files if parentworking and cmp: @@ -982,9 +980,8 @@ else: fixup.append(f) - modified.sort() if listclean: - clean = util.sort(clean + fixup) + clean += fixup # update dirstate for files that are actually clean if fixup: @@ -1017,7 +1014,7 @@ mf2 = mfmatches(ctx2) modified, added, clean = [], [], [] - for fn in util.sort(mf2): + for fn in mf2: if fn in mf1: if (mf1.flags(fn) != mf2.flags(fn) or (mf1[fn] != mf2[fn] and @@ -1028,9 +1025,11 @@ del mf1[fn] else: added.append(fn) - removed = util.sort(mf1.keys()) + removed = mf1.keys() - return modified, added, removed, deleted, unknown, ignored, clean + r = modified, added, removed, deleted, unknown, ignored, clean + [l.sort() for l in r] + return r def add(self, list): wlock = self.wlock()
--- a/tests/test-addremove-similar.out Tue Jul 22 13:03:18 2008 -0500 +++ b/tests/test-addremove-similar.out Tue Jul 22 13:03:19 2008 -0500 @@ -10,8 +10,8 @@ removing empty-file adding large-file adding tiny-file +removing large-file adding small-file -removing large-file removing tiny-file recording removal of tiny-file as rename to small-file (82% similar) % should all fail