Show More
@@ -174,11 +174,16 b' def findcopies(repo, m1, m2, limit):' | |||||
174 |
|
174 | |||
175 | return copy |
|
175 | return copy | |
176 |
|
176 | |||
177 |
def manifestmerge( |
|
177 | def manifestmerge(repo, p1, p2, pa, overwrite, partial): | |
178 | """ |
|
178 | """ | |
179 | Merge manifest m1 with m2 using ancestor ma and generate merge action list |
|
179 | Merge manifest m1 with m2 using ancestor ma and generate merge action list | |
180 | """ |
|
180 | """ | |
181 |
|
181 | |||
|
182 | m1 = p1.manifest() | |||
|
183 | m2 = p2.manifest() | |||
|
184 | ma = pa.manifest() | |||
|
185 | backwards = (pa == p2) | |||
|
186 | ||||
182 | def fmerge(f, f2=None, fa=None): |
|
187 | def fmerge(f, f2=None, fa=None): | |
183 | """merge executable flags""" |
|
188 | """merge executable flags""" | |
184 | if not f2: |
|
189 | if not f2: | |
@@ -190,9 +195,13 b' def manifestmerge(ui, m1, m2, ma, copy, ' | |||||
190 | action = [] |
|
195 | action = [] | |
191 |
|
196 | |||
192 | def act(msg, f, m, *args): |
|
197 | def act(msg, f, m, *args): | |
193 | ui.debug(" %s: %s -> %s\n" % (f, msg, m)) |
|
198 | repo.ui.debug(" %s: %s -> %s\n" % (f, msg, m)) | |
194 | action.append((f, m) + args) |
|
199 | action.append((f, m) + args) | |
195 |
|
200 | |||
|
201 | copy = {} | |||
|
202 | if not (backwards or overwrite): | |||
|
203 | copy = findcopies(repo, m1, m2, pa.rev()) | |||
|
204 | ||||
196 | # Compare manifests |
|
205 | # Compare manifests | |
197 | for f, n in m1.iteritems(): |
|
206 | for f, n in m1.iteritems(): | |
198 | if partial and not partial(f): |
|
207 | if partial and not partial(f): | |
@@ -230,7 +239,7 b' def manifestmerge(ui, m1, m2, ma, copy, ' | |||||
230 | f, "c", f2, f, m1[f], m2[f2], fmerge(f, f2, f2), False) |
|
239 | f, "c", f2, f, m1[f], m2[f2], fmerge(f, f2, f2), False) | |
231 | elif f in ma: |
|
240 | elif f in ma: | |
232 | if n != ma[f] and not overwrite: |
|
241 | if n != ma[f] and not overwrite: | |
233 | if ui.prompt( |
|
242 | if repo.ui.prompt( | |
234 | (_(" local changed %s which remote deleted\n") % f) + |
|
243 | (_(" local changed %s which remote deleted\n") % f) + | |
235 | _("(k)eep or (d)elete?"), _("[kd]"), _("k")) == _("d"): |
|
244 | _("(k)eep or (d)elete?"), _("[kd]"), _("k")) == _("d"): | |
236 | act("prompt delete", f, "r") |
|
245 | act("prompt delete", f, "r") | |
@@ -257,7 +266,7 b' def manifestmerge(ui, m1, m2, ma, copy, ' | |||||
257 | if overwrite or backwards: |
|
266 | if overwrite or backwards: | |
258 | act("recreating", f, "g", m2.execf(f), n) |
|
267 | act("recreating", f, "g", m2.execf(f), n) | |
259 | elif n != ma[f]: |
|
268 | elif n != ma[f]: | |
260 | if ui.prompt( |
|
269 | if repo.ui.prompt( | |
261 | (_("remote changed %s which local deleted\n") % f) + |
|
270 | (_("remote changed %s which local deleted\n") % f) + | |
262 | _("(k)eep or (d)elete?"), _("[kd]"), _("k")) == _("k"): |
|
271 | _("(k)eep or (d)elete?"), _("[kd]"), _("k")) == _("k"): | |
263 | act("prompt recreating", f, "g", m2.execf(f), n) |
|
272 | act("prompt recreating", f, "g", m2.execf(f), n) | |
@@ -381,9 +390,6 b' def update(repo, node, branchmerge=False' | |||||
381 | p1, p2 = pl[0], repo.changectx(node) |
|
390 | p1, p2 = pl[0], repo.changectx(node) | |
382 | pa = p1.ancestor(p2) |
|
391 | pa = p1.ancestor(p2) | |
383 |
|
392 | |||
384 | # are we going backwards? |
|
|||
385 | backwards = (pa == p2) |
|
|||
386 |
|
||||
387 | # is there a linear path from p1 to p2? |
|
393 | # is there a linear path from p1 to p2? | |
388 | if pa == p1 or pa == p2: |
|
394 | if pa == p1 or pa == p2: | |
389 | if branchmerge: |
|
395 | if branchmerge: | |
@@ -399,7 +405,6 b' def update(repo, node, branchmerge=False' | |||||
399 |
|
405 | |||
400 | m1 = wc.manifest() |
|
406 | m1 = wc.manifest() | |
401 | m2 = p2.manifest() |
|
407 | m2 = p2.manifest() | |
402 | ma = pa.manifest() |
|
|||
403 |
|
408 | |||
404 | # resolve the manifest to determine which files |
|
409 | # resolve the manifest to determine which files | |
405 | # we care about merging |
|
410 | # we care about merging | |
@@ -409,17 +414,13 b' def update(repo, node, branchmerge=False' | |||||
409 | repo.ui.debug(_(" ancestor %s local %s remote %s\n") % (p1, p2, pa)) |
|
414 | repo.ui.debug(_(" ancestor %s local %s remote %s\n") % (p1, p2, pa)) | |
410 |
|
415 | |||
411 | action = [] |
|
416 | action = [] | |
412 | copy = {} |
|
|||
413 |
|
417 | |||
414 | if not force: |
|
418 | if not force: | |
415 | checkunknown(repo, m2, wc) |
|
419 | checkunknown(repo, m2, wc) | |
416 | if not branchmerge: |
|
420 | if not branchmerge: | |
417 | action += forgetremoved(m2, wc) |
|
421 | action += forgetremoved(m2, wc) | |
418 | if not (backwards or overwrite): |
|
|||
419 | copy = findcopies(repo, m1, m2, pa.rev()) |
|
|||
420 |
|
422 | |||
421 |
action += manifestmerge(repo |
|
423 | action += manifestmerge(repo, wc, p2, pa, overwrite, partial) | |
422 | overwrite, backwards, partial) |
|
|||
423 |
|
424 | |||
424 | ### apply phase |
|
425 | ### apply phase | |
425 |
|
426 |
General Comments 0
You need to be logged in to leave comments.
Login now