Skip to content
Snippets Groups Projects
Commit 43eecb4e23f8 authored by Mads Kiilerich's avatar Mads Kiilerich
Browse files

merge: use separate lists for each action type

This replaces the grand unified action list that had multiple action types as
tuples in one big list. That list was iterated multiple times just to find
actions of a specific type. This data model also made some code more
convoluted than necessary.

Instead we now store actions as a tuple of lists. Using multiple lists gives a
bit of cut'n'pasted code but also enables other optimizations.

This patch uses 'if True:' to preserve indentations and help reviewing. It also
limits the number of conflicts with other pending patches. It can trivially be
cleaned up later.
parent 6062593d8b06
No related branches found
No related tags found
No related merge requests found
......@@ -410,6 +410,5 @@
if overwrite:
return actions
removes = set(a[0] for a in actions if a[1] == 'r')
processed = []
removes = set(a[0] for a in actions['r'])
......@@ -415,5 +414,5 @@
for action in actions:
f, m, args, msg = action
newglist = []
for action in actions['g']:
f, args, msg = action
splitstandin = f and lfutil.splitstandin(f)
......@@ -419,5 +418,5 @@
splitstandin = f and lfutil.splitstandin(f)
if (m == "g" and splitstandin is not None and
if (splitstandin is not None and
splitstandin in p1 and splitstandin not in removes):
# Case 1: normal file in the working copy, largefile in
# the second parent
......@@ -427,6 +426,6 @@
'use (l)argefile or keep (n)ormal file?'
'$$ &Largefile $$ &Normal file') % lfile
if repo.ui.promptchoice(msg, 0) == 0:
processed.append((lfile, "r", None, msg))
processed.append((standin, "g", (p2.flags(standin),), msg))
actions['r'].append((lfile, None, msg))
newglist.append((standin, (p2.flags(standin),), msg))
else:
......@@ -432,7 +431,6 @@
else:
processed.append((standin, "r", None, msg))
elif (m == "g" and
lfutil.standin(f) in p1 and lfutil.standin(f) not in removes):
actions['r'].append((standin, None, msg))
elif lfutil.standin(f) in p1 and lfutil.standin(f) not in removes:
# Case 2: largefile in the working copy, normal file in
# the second parent
standin = lfutil.standin(f)
......@@ -441,5 +439,5 @@
'keep (l)argefile or use (n)ormal file?'
'$$ &Largefile $$ &Normal file') % lfile
if repo.ui.promptchoice(msg, 0) == 0:
processed.append((lfile, "r", None, msg))
actions['r'].append((lfile, None, msg))
else:
......@@ -445,4 +443,4 @@
else:
processed.append((standin, "r", None, msg))
processed.append((lfile, "g", (p2.flags(lfile),), msg))
actions['r'].append((standin, None, msg))
newglist.append((lfile, (p2.flags(lfile),), msg))
else:
......@@ -448,3 +446,3 @@
else:
processed.append(action)
newglist.append(action)
......@@ -450,5 +448,8 @@
return processed
newglist.sort()
actions['g'] = newglist
return actions
# Override filemerge to prompt the user about how they wish to merge
# largefiles. This will handle identical edits without prompting the user.
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment