comparison mercurial/merge.py @ 18611:18c2184c27dc

merge: rename p1 to wctx in manifestmerge This is always a workingctx, and this name is more in line with other functions in this module.
author Bryan O'Sullivan <bryano@fb.com>
date Sat, 09 Feb 2013 21:24:24 +0000
parents 95773237df7f
children 0b6e6eacc939
comparison
equal deleted inserted replaced
18610:46edbc49a9f2 18611:18c2184c27dc
183 if f not in mctx: 183 if f not in mctx:
184 actions.append((f, "f", None, "forget removed")) 184 actions.append((f, "f", None, "forget removed"))
185 185
186 return actions 186 return actions
187 187
188 def manifestmerge(repo, p1, p2, pa, branchmerge, force, partial): 188 def manifestmerge(repo, wctx, p2, pa, branchmerge, force, partial):
189 """ 189 """
190 Merge p1 and p2 with ancestor pa and generate merge action list 190 Merge p1 and p2 with ancestor pa and generate merge action list
191 191
192 branchmerge and force are as passed in to update 192 branchmerge and force are as passed in to update
193 partial = function to filter file lists 193 partial = function to filter file lists
195 195
196 overwrite = force and not branchmerge 196 overwrite = force and not branchmerge
197 actions, copy, movewithdir = [], {}, {} 197 actions, copy, movewithdir = [], {}, {}
198 198
199 if overwrite: 199 if overwrite:
200 pa = p1 200 pa = wctx
201 elif pa == p2: # backwards 201 elif pa == p2: # backwards
202 pa = p1.p1() 202 pa = wctx.p1()
203 elif pa and repo.ui.configbool("merge", "followcopies", True): 203 elif pa and repo.ui.configbool("merge", "followcopies", True):
204 ret = copies.mergecopies(repo, p1, p2, pa) 204 ret = copies.mergecopies(repo, wctx, p2, pa)
205 copy, movewithdir, diverge, renamedelete = ret 205 copy, movewithdir, diverge, renamedelete = ret
206 for of, fl in diverge.iteritems(): 206 for of, fl in diverge.iteritems():
207 actions.append((of, "dr", (fl,), "divergent renames")) 207 actions.append((of, "dr", (fl,), "divergent renames"))
208 for of, fl in renamedelete.iteritems(): 208 for of, fl in renamedelete.iteritems():
209 actions.append((of, "rd", (fl,), "rename and delete")) 209 actions.append((of, "rd", (fl,), "rename and delete"))
210 210
211 repo.ui.note(_("resolving manifests\n")) 211 repo.ui.note(_("resolving manifests\n"))
212 repo.ui.debug(" branchmerge: %s, force: %s, partial: %s\n" 212 repo.ui.debug(" branchmerge: %s, force: %s, partial: %s\n"
213 % (bool(branchmerge), bool(force), bool(partial))) 213 % (bool(branchmerge), bool(force), bool(partial)))
214 repo.ui.debug(" ancestor: %s, local: %s, remote: %s\n" % (pa, p1, p2)) 214 repo.ui.debug(" ancestor: %s, local: %s, remote: %s\n" % (pa, wctx, p2))
215 215
216 m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest() 216 m1, m2, ma = wctx.manifest(), p2.manifest(), pa.manifest()
217 copied = set(copy.values()) 217 copied = set(copy.values())
218 copied.update(movewithdir.values()) 218 copied.update(movewithdir.values())
219 219
220 if '.hgsubstate' in m1: 220 if '.hgsubstate' in m1:
221 # check whether sub state is modified 221 # check whether sub state is modified
222 for s in sorted(p1.substate): 222 for s in sorted(wctx.substate):
223 if p1.sub(s).dirty(): 223 if wctx.sub(s).dirty():
224 m1['.hgsubstate'] += "+" 224 m1['.hgsubstate'] += "+"
225 break 225 break
226 226
227 aborts, prompts = [], [] 227 aborts, prompts = [], []
228 # Compare manifests 228 # Compare manifests
298 # Checking whether the files are different is expensive, so we 298 # Checking whether the files are different is expensive, so we
299 # don't do that when we can avoid it. 299 # don't do that when we can avoid it.
300 if force and not branchmerge: 300 if force and not branchmerge:
301 actions.append((f, "g", (m2.flags(f),), "remote created")) 301 actions.append((f, "g", (m2.flags(f),), "remote created"))
302 else: 302 else:
303 different = _checkunknownfile(repo, p1, p2, f) 303 different = _checkunknownfile(repo, wctx, p2, f)
304 if force and branchmerge and different: 304 if force and branchmerge and different:
305 actions.append((f, "m", (f, f, False), 305 actions.append((f, "m", (f, f, False),
306 "remote differs from untracked local")) 306 "remote differs from untracked local"))
307 elif not force and different: 307 elif not force and different:
308 aborts.append((f, "ud")) 308 aborts.append((f, "ud"))