Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 18364:6252b4f1c4b4
subrepos: process subrepos in sorted order
Add sorted() in places found by testing with PYTHONHASHSEED=random and code
inspection.
An alternative to sprinkling sorted() all over would be to change substate to a
custom dict with sorted iterators...
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Wed, 12 Dec 2012 02:38:14 +0100 |
parents | 3f1552c6bf71 |
children | f3b21beb9802 |
comparison
equal
deleted
inserted
replaced
18363:c6e033a7dd38 | 18364:6252b4f1c4b4 |
---|---|
1033 def ancestor(self, c2): | 1033 def ancestor(self, c2): |
1034 """return the ancestor context of self and c2""" | 1034 """return the ancestor context of self and c2""" |
1035 return self._parents[0].ancestor(c2) # punt on two parents for now | 1035 return self._parents[0].ancestor(c2) # punt on two parents for now |
1036 | 1036 |
1037 def walk(self, match): | 1037 def walk(self, match): |
1038 return sorted(self._repo.dirstate.walk(match, self.substate.keys(), | 1038 return sorted(self._repo.dirstate.walk(match, sorted(self.substate), |
1039 True, False)) | 1039 True, False)) |
1040 | 1040 |
1041 def dirty(self, missing=False, merge=True, branch=True): | 1041 def dirty(self, missing=False, merge=True, branch=True): |
1042 "check whether a working directory is modified" | 1042 "check whether a working directory is modified" |
1043 # check subrepos first | 1043 # check subrepos first |
1044 for s in self.substate: | 1044 for s in sorted(self.substate): |
1045 if self.sub(s).dirty(): | 1045 if self.sub(s).dirty(): |
1046 return True | 1046 return True |
1047 # check current working dir | 1047 # check current working dir |
1048 return ((merge and self.p2()) or | 1048 return ((merge and self.p2()) or |
1049 (branch and self.branch() != self.p1().branch()) or | 1049 (branch and self.branch() != self.p1().branch()) or |