comparison mercurial/localrepo.py @ 14500:e880433a2e00 stable

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 a281981e2033
children 4f695345979c
comparison
equal deleted inserted replaced
14499:a281981e2033 14500:e880433a2e00
1231 mf2 = mfmatches(ctx2) 1231 mf2 = mfmatches(ctx2)
1232 1232
1233 modified, added, clean = [], [], [] 1233 modified, added, clean = [], [], []
1234 for fn in mf2: 1234 for fn in mf2:
1235 if fn in mf1: 1235 if fn in mf1:
1236 if (mf1.flags(fn) != mf2.flags(fn) or 1236 if (fn not in deleted and
1237 (mf1[fn] != mf2[fn] and 1237 (mf1.flags(fn) != mf2.flags(fn) or
1238 (mf2[fn] or ctx1[fn].cmp(ctx2[fn])))): 1238 (mf1[fn] != mf2[fn] and
1239 (mf2[fn] or ctx1[fn].cmp(ctx2[fn]))))):
1239 modified.append(fn) 1240 modified.append(fn)
1240 elif listclean: 1241 elif listclean:
1241 clean.append(fn) 1242 clean.append(fn)
1242 del mf1[fn] 1243 del mf1[fn]
1243 else: 1244 elif fn not in deleted:
1244 added.append(fn) 1245 added.append(fn)
1245 removed = mf1.keys() 1246 removed = mf1.keys()
1246 1247
1247 r = modified, added, removed, deleted, unknown, ignored, clean 1248 r = modified, added, removed, deleted, unknown, ignored, clean
1248 1249