Mercurial > hg
comparison mercurial/merge.py @ 18605:bcf29565d89f
manifestmerge: pass in branchmerge and force separately
This will be used in an upcoming patch.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Fri, 08 Feb 2013 15:23:23 +0000 |
parents | d0a8f09a22eb |
children | 95773237df7f |
comparison
equal
deleted
inserted
replaced
18604:a1141f04e368 | 18605:bcf29565d89f |
---|---|
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, overwrite, partial): | 188 def manifestmerge(repo, p1, 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 overwrite = whether we clobber working files | 192 branchmerge and force are as passed in to update |
193 partial = function to filter file lists | 193 partial = function to filter file lists |
194 """ | 194 """ |
195 | 195 |
196 overwrite = force and not branchmerge | |
196 actions, copy, movewithdir = [], {}, {} | 197 actions, copy, movewithdir = [], {}, {} |
197 | 198 |
198 if overwrite: | 199 if overwrite: |
199 pa = p1 | 200 pa = p1 |
200 elif pa == p2: # backwards | 201 elif pa == p2: # backwards |
206 actions.append((of, "dr", (fl,), "divergent renames")) | 207 actions.append((of, "dr", (fl,), "divergent renames")) |
207 for of, fl in renamedelete.iteritems(): | 208 for of, fl in renamedelete.iteritems(): |
208 actions.append((of, "rd", (fl,), "rename and delete")) | 209 actions.append((of, "rd", (fl,), "rename and delete")) |
209 | 210 |
210 repo.ui.note(_("resolving manifests\n")) | 211 repo.ui.note(_("resolving manifests\n")) |
211 repo.ui.debug(" overwrite: %s, partial: %s\n" | 212 repo.ui.debug(" branchmerge: %s, force: %s, partial: %s\n" |
212 % (bool(overwrite), bool(partial))) | 213 % (bool(branchmerge), bool(force), bool(partial))) |
213 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, p1, p2)) |
214 | 215 |
215 m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest() | 216 m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest() |
216 copied = set(copy.values()) | 217 copied = set(copy.values()) |
217 copied.update(movewithdir.values()) | 218 copied.update(movewithdir.values()) |
450 _checkunknown(repo, tctx, mctx) | 451 _checkunknown(repo, tctx, mctx) |
451 if tctx.rev() is None: | 452 if tctx.rev() is None: |
452 actions += _forgetremoved(tctx, mctx, branchmerge) | 453 actions += _forgetremoved(tctx, mctx, branchmerge) |
453 actions += manifestmerge(repo, tctx, mctx, | 454 actions += manifestmerge(repo, tctx, mctx, |
454 ancestor, | 455 ancestor, |
455 force and not branchmerge, | 456 branchmerge, force, |
456 partial) | 457 partial) |
457 return actions | 458 return actions |
458 | 459 |
459 def recordupdates(repo, actions, branchmerge): | 460 def recordupdates(repo, actions, branchmerge): |
460 "record merge actions to the dirstate" | 461 "record merge actions to the dirstate" |