comparison mercurial/localrepo.py @ 13929:cff56a0ed18e

localrepo: don't add deleted files to list of modified/added files (issue2761) If a file is deleted (rm, not 'hg rm') from the working dir an attempt to run 'hg diff -r X', with the file being present in X will cause an abort. We didn't check if the file has been deleted from the working dir and later on tried to open it to compare with the one from X, causing the abort. This fix adds that check. Consequently, no output will be returned.
author Idan Kamara <idankk86@gmail.com>
date Mon, 11 Apr 2011 21:44:22 +0300
parents 184cf2fa1046
children 141f88ae5276
comparison
equal deleted inserted replaced
13928:155d2e17884e 13929:cff56a0ed18e
1223 mf2 = mfmatches(ctx2) 1223 mf2 = mfmatches(ctx2)
1224 1224
1225 modified, added, clean = [], [], [] 1225 modified, added, clean = [], [], []
1226 for fn in mf2: 1226 for fn in mf2:
1227 if fn in mf1: 1227 if fn in mf1:
1228 if (mf1.flags(fn) != mf2.flags(fn) or 1228 if (fn not in deleted and
1229 (mf1[fn] != mf2[fn] and 1229 (mf1.flags(fn) != mf2.flags(fn) or
1230 (mf2[fn] or ctx1[fn].cmp(ctx2[fn])))): 1230 (mf1[fn] != mf2[fn] and
1231 (mf2[fn] or ctx1[fn].cmp(ctx2[fn]))))):
1231 modified.append(fn) 1232 modified.append(fn)
1232 elif listclean: 1233 elif listclean:
1233 clean.append(fn) 1234 clean.append(fn)
1234 del mf1[fn] 1235 del mf1[fn]
1235 else: 1236 elif fn not in deleted:
1236 added.append(fn) 1237 added.append(fn)
1237 removed = mf1.keys() 1238 removed = mf1.keys()
1238 1239
1239 r = modified, added, removed, deleted, unknown, ignored, clean 1240 r = modified, added, removed, deleted, unknown, ignored, clean
1240 1241