comparison mercurial/merge.py @ 27087:98fc58378a3f

merge.recordupdates: don't require action keys to be present in dict We're going to use this function for a much smaller set of actions in the next patch. It's easier to do this than to backfill the dict we pass in.
author Siddharth Agarwal <sid0@fb.com>
date Sun, 15 Nov 2015 21:55:46 -0800
parents ae2d3782d818
children e2b79f57903a
comparison
equal deleted inserted replaced
27086:5f5c7d9f4a08 27087:98fc58378a3f
1129 return updated, merged, removed, unresolved 1129 return updated, merged, removed, unresolved
1130 1130
1131 def recordupdates(repo, actions, branchmerge): 1131 def recordupdates(repo, actions, branchmerge):
1132 "record merge actions to the dirstate" 1132 "record merge actions to the dirstate"
1133 # remove (must come first) 1133 # remove (must come first)
1134 for f, args, msg in actions['r']: 1134 for f, args, msg in actions.get('r', []):
1135 if branchmerge: 1135 if branchmerge:
1136 repo.dirstate.remove(f) 1136 repo.dirstate.remove(f)
1137 else: 1137 else:
1138 repo.dirstate.drop(f) 1138 repo.dirstate.drop(f)
1139 1139
1140 # forget (must come first) 1140 # forget (must come first)
1141 for f, args, msg in actions['f']: 1141 for f, args, msg in actions.get('f', []):
1142 repo.dirstate.drop(f) 1142 repo.dirstate.drop(f)
1143 1143
1144 # re-add 1144 # re-add
1145 for f, args, msg in actions['a']: 1145 for f, args, msg in actions.get('a', []):
1146 if not branchmerge: 1146 if not branchmerge:
1147 repo.dirstate.add(f) 1147 repo.dirstate.add(f)
1148 1148
1149 # exec change 1149 # exec change
1150 for f, args, msg in actions['e']: 1150 for f, args, msg in actions.get('e', []):
1151 repo.dirstate.normallookup(f) 1151 repo.dirstate.normallookup(f)
1152 1152
1153 # keep 1153 # keep
1154 for f, args, msg in actions['k']: 1154 for f, args, msg in actions.get('k', []):
1155 pass 1155 pass
1156 1156
1157 # get 1157 # get
1158 for f, args, msg in actions['g']: 1158 for f, args, msg in actions.get('g', []):
1159 if branchmerge: 1159 if branchmerge:
1160 repo.dirstate.otherparent(f) 1160 repo.dirstate.otherparent(f)
1161 else: 1161 else:
1162 repo.dirstate.normal(f) 1162 repo.dirstate.normal(f)
1163 1163
1164 # merge 1164 # merge
1165 for f, args, msg in actions['m']: 1165 for f, args, msg in actions.get('m', []):
1166 f1, f2, fa, move, anc = args 1166 f1, f2, fa, move, anc = args
1167 if branchmerge: 1167 if branchmerge:
1168 # We've done a branch merge, mark this file as merged 1168 # We've done a branch merge, mark this file as merged
1169 # so that we properly record the merger later 1169 # so that we properly record the merger later
1170 repo.dirstate.merge(f) 1170 repo.dirstate.merge(f)
1185 repo.dirstate.normallookup(f) 1185 repo.dirstate.normallookup(f)
1186 if move: 1186 if move:
1187 repo.dirstate.drop(f1) 1187 repo.dirstate.drop(f1)
1188 1188
1189 # directory rename, move local 1189 # directory rename, move local
1190 for f, args, msg in actions['dm']: 1190 for f, args, msg in actions.get('dm', []):
1191 f0, flag = args 1191 f0, flag = args
1192 if branchmerge: 1192 if branchmerge:
1193 repo.dirstate.add(f) 1193 repo.dirstate.add(f)
1194 repo.dirstate.remove(f0) 1194 repo.dirstate.remove(f0)
1195 repo.dirstate.copy(f0, f) 1195 repo.dirstate.copy(f0, f)
1196 else: 1196 else:
1197 repo.dirstate.normal(f) 1197 repo.dirstate.normal(f)
1198 repo.dirstate.drop(f0) 1198 repo.dirstate.drop(f0)
1199 1199
1200 # directory rename, get 1200 # directory rename, get
1201 for f, args, msg in actions['dg']: 1201 for f, args, msg in actions.get('dg', []):
1202 f0, flag = args 1202 f0, flag = args
1203 if branchmerge: 1203 if branchmerge:
1204 repo.dirstate.add(f) 1204 repo.dirstate.add(f)
1205 repo.dirstate.copy(f0, f) 1205 repo.dirstate.copy(f0, f)
1206 else: 1206 else: