comparison mercurial/merge.py @ 29831:1316c7cccc76

merge: remove files with extra actions from merge action list See the comment for a detailed explanation why. Even though this is a bug, I've sent it to 'default' rather than 'stable' because it isn't triggered in any code paths in stock Mercurial, just with the merge driver included. For the same reason I haven't included any tests here -- the merge driver is getting a new test.
author Siddharth Agarwal <sid0@fb.com>
date Tue, 23 Aug 2016 17:58:53 -0700
parents 978b907d9b36
children 6f447b9ec263
comparison
equal deleted inserted replaced
29830:92ac2baaea86 29831:1316c7cccc76
1284 updated += msupdated 1284 updated += msupdated
1285 merged += msmerged 1285 merged += msmerged
1286 removed += msremoved 1286 removed += msremoved
1287 1287
1288 extraactions = ms.actions() 1288 extraactions = ms.actions()
1289 for k, acts in extraactions.iteritems(): 1289 if extraactions:
1290 actions[k].extend(acts) 1290 mfiles = set(a[0] for a in actions['m'])
1291 for k, acts in extraactions.iteritems():
1292 actions[k].extend(acts)
1293 # Remove these files from actions['m'] as well. This is important
1294 # because in recordupdates, files in actions['m'] are processed
1295 # after files in other actions, and the merge driver might add
1296 # files to those actions via extraactions above. This can lead to a
1297 # file being recorded twice, with poor results. This is especially
1298 # problematic for actions['r'] (currently only possible with the
1299 # merge driver in the initial merge process; interrupted merges
1300 # don't go through this flow).
1301 #
1302 # The real fix here is to have indexes by both file and action so
1303 # that when the action for a file is changed it is automatically
1304 # reflected in the other action lists. But that involves a more
1305 # complex data structure, so this will do for now.
1306 #
1307 # We don't need to do the same operation for 'dc' and 'cd' because
1308 # those lists aren't consulted again.
1309 mfiles.difference_update(a[0] for a in acts)
1310
1311 actions['m'] = [a for a in actions['m'] if a[0] in mfiles]
1291 1312
1292 progress(_updating, None, total=numupdates, unit=_files) 1313 progress(_updating, None, total=numupdates, unit=_files)
1293 1314
1294 return updated, merged, removed, unresolved 1315 return updated, merged, removed, unresolved
1295 1316