174 |
174 |
175 actions = [] |
175 actions = [] |
176 state = branchmerge and 'r' or 'f' |
176 state = branchmerge and 'r' or 'f' |
177 for f in wctx.deleted(): |
177 for f in wctx.deleted(): |
178 if f not in mctx: |
178 if f not in mctx: |
179 actions.append((f, state)) |
179 actions.append((f, state, None)) |
180 |
180 |
181 if not branchmerge: |
181 if not branchmerge: |
182 for f in wctx.removed(): |
182 for f in wctx.removed(): |
183 if f not in mctx: |
183 if f not in mctx: |
184 actions.append((f, "f")) |
184 actions.append((f, "f", None)) |
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, overwrite, partial): |
189 """ |
189 """ |
193 partial = function to filter file lists |
193 partial = function to filter file lists |
194 """ |
194 """ |
195 |
195 |
196 def act(msg, m, f, *args): |
196 def act(msg, m, f, *args): |
197 repo.ui.debug(" %s: %s -> %s\n" % (f, msg, m)) |
197 repo.ui.debug(" %s: %s -> %s\n" % (f, msg, m)) |
198 actions.append((f, m) + args) |
198 actions.append((f, m, args)) |
199 |
199 |
200 actions, copy, movewithdir = [], {}, {} |
200 actions, copy, movewithdir = [], {}, {} |
201 |
201 |
202 if overwrite: |
202 if overwrite: |
203 pa = p1 |
203 pa = p1 |
372 audit(f) |
372 audit(f) |
373 util.unlinkpath(repo.wjoin(f)) |
373 util.unlinkpath(repo.wjoin(f)) |
374 |
374 |
375 numupdates = len(actions) |
375 numupdates = len(actions) |
376 for i, a in enumerate(actions): |
376 for i, a in enumerate(actions): |
377 f, m = a[:2] |
377 f, m, args = a |
378 repo.ui.progress(_('updating'), i + 1, item=f, total=numupdates, |
378 repo.ui.progress(_('updating'), i + 1, item=f, total=numupdates, |
379 unit=_('files')) |
379 unit=_('files')) |
380 if m == "r": # remove |
380 if m == "r": # remove |
381 repo.ui.note(_("removing %s\n") % f) |
381 repo.ui.note(_("removing %s\n") % f) |
382 audit(f) |
382 audit(f) |
391 elif m == "m": # merge |
391 elif m == "m": # merge |
392 if fd == '.hgsubstate': # subrepo states need updating |
392 if fd == '.hgsubstate': # subrepo states need updating |
393 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), |
393 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), |
394 overwrite) |
394 overwrite) |
395 continue |
395 continue |
396 f2, fd, move = a[2:] |
396 f2, fd, move = args |
397 audit(fd) |
397 audit(fd) |
398 r = ms.resolve(fd, wctx, mctx) |
398 r = ms.resolve(fd, wctx, mctx) |
399 if r is not None and r > 0: |
399 if r is not None and r > 0: |
400 unresolved += 1 |
400 unresolved += 1 |
401 else: |
401 else: |
402 if r is None: |
402 if r is None: |
403 updated += 1 |
403 updated += 1 |
404 else: |
404 else: |
405 merged += 1 |
405 merged += 1 |
406 elif m == "g": # get |
406 elif m == "g": # get |
407 flags = a[2] |
407 flags, = args |
408 repo.ui.note(_("getting %s\n") % f) |
408 repo.ui.note(_("getting %s\n") % f) |
409 repo.wwrite(f, mctx.filectx(f).data(), flags) |
409 repo.wwrite(f, mctx.filectx(f).data(), flags) |
410 updated += 1 |
410 updated += 1 |
411 if f == '.hgsubstate': # subrepo states need updating |
411 if f == '.hgsubstate': # subrepo states need updating |
412 subrepo.submerge(repo, wctx, mctx, wctx, overwrite) |
412 subrepo.submerge(repo, wctx, mctx, wctx, overwrite) |
413 elif m == "d": # directory rename |
413 elif m == "d": # directory rename |
414 f2, fd, flags = a[2:] |
414 f2, fd, flags = args |
415 if f: |
415 if f: |
416 repo.ui.note(_("moving %s to %s\n") % (f, fd)) |
416 repo.ui.note(_("moving %s to %s\n") % (f, fd)) |
417 audit(f) |
417 audit(f) |
418 repo.wwrite(fd, wctx.filectx(f).data(), flags) |
418 repo.wwrite(fd, wctx.filectx(f).data(), flags) |
419 util.unlinkpath(repo.wjoin(f)) |
419 util.unlinkpath(repo.wjoin(f)) |
420 if f2: |
420 if f2: |
421 repo.ui.note(_("getting %s to %s\n") % (f2, fd)) |
421 repo.ui.note(_("getting %s to %s\n") % (f2, fd)) |
422 repo.wwrite(fd, mctx.filectx(f2).data(), flags) |
422 repo.wwrite(fd, mctx.filectx(f2).data(), flags) |
423 updated += 1 |
423 updated += 1 |
424 elif m == "dr": # divergent renames |
424 elif m == "dr": # divergent renames |
425 fl = a[2] |
425 fl, = args |
426 repo.ui.warn(_("note: possible conflict - %s was renamed " |
426 repo.ui.warn(_("note: possible conflict - %s was renamed " |
427 "multiple times to:\n") % f) |
427 "multiple times to:\n") % f) |
428 for nf in fl: |
428 for nf in fl: |
429 repo.ui.warn(" %s\n" % nf) |
429 repo.ui.warn(" %s\n" % nf) |
430 elif m == "rd": # rename and delete |
430 elif m == "rd": # rename and delete |
431 fl = a[2] |
431 fl, = args |
432 repo.ui.warn(_("note: possible conflict - %s was deleted " |
432 repo.ui.warn(_("note: possible conflict - %s was deleted " |
433 "and renamed to:\n") % f) |
433 "and renamed to:\n") % f) |
434 for nf in fl: |
434 for nf in fl: |
435 repo.ui.warn(" %s\n" % nf) |
435 repo.ui.warn(" %s\n" % nf) |
436 elif m == "e": # exec |
436 elif m == "e": # exec |
437 flags = a[2] |
437 flags, = args |
438 audit(f) |
438 audit(f) |
439 util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags) |
439 util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags) |
440 updated += 1 |
440 updated += 1 |
441 ms.commit() |
441 ms.commit() |
442 repo.ui.progress(_('updating'), None, total=numupdates, unit=_('files')) |
442 repo.ui.progress(_('updating'), None, total=numupdates, unit=_('files')) |