comparison mercurial/context.py @ 23731:ccbaa2ed11a4

status: don't list files as both clean and deleted Tracked files that are deleted should always be reported as such, no matter what their state was in earlier revisions. This is encoded in in two conditions in the loop in basectx._buildstatus() for modified and added files, but the check is missing for clean files. We should check for clean files too, but instead of adding the check in a third place, move it earlier and skip most of the loop body for deleted files.
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 05 Jan 2015 17:12:04 -0800
parents 4b56219a5ac2
children d43948a910a5
comparison
equal deleted inserted replaced
23730:4b56219a5ac2 23731:ccbaa2ed11a4
138 modified, added, clean = [], [], [] 138 modified, added, clean = [], [], []
139 deleted, unknown, ignored = s.deleted, s.unknown, s.ignored 139 deleted, unknown, ignored = s.deleted, s.unknown, s.ignored
140 deletedset = set(deleted) 140 deletedset = set(deleted)
141 withflags = mf1.withflags() | mf2.withflags() 141 withflags = mf1.withflags() | mf2.withflags()
142 for fn, mf2node in mf2.iteritems(): 142 for fn, mf2node in mf2.iteritems():
143 if fn in deletedset:
144 continue
143 if fn in mf1: 145 if fn in mf1:
144 if (fn not in deletedset and 146 if ((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or
145 ((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or
146 (mf1[fn] != mf2node and 147 (mf1[fn] != mf2node and
147 (mf2node != _newnode or self[fn].cmp(other[fn]))))): 148 (mf2node != _newnode or self[fn].cmp(other[fn])))):
148 modified.append(fn) 149 modified.append(fn)
149 elif listclean: 150 elif listclean:
150 clean.append(fn) 151 clean.append(fn)
151 del mf1[fn] 152 del mf1[fn]
152 elif fn not in deletedset: 153 else:
153 added.append(fn) 154 added.append(fn)
154 removed = mf1.keys() 155 removed = mf1.keys()
155 if removed: 156 if removed:
156 # need to filter files if they are already reported as removed 157 # need to filter files if they are already reported as removed
157 unknown = [fn for fn in unknown if fn not in mf1] 158 unknown = [fn for fn in unknown if fn not in mf1]