Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 23524:a1a7c94def6d
merge: don't report progress for dr/rd actions
It is easier to reason about certain algorithms in terms of a
file->action mapping than the current action->list-of-files. Bid merge
is already written this way (but with a list of actions per file), and
largefiles' overridecalculateupdates() will also benefit. However,
that requires us to have at most one action per file. That requirement
is currently violated by 'dr' (divergent rename) and 'rd' (rename and
delete) actions, which can exist for the same file as some other
action.
These actions are only used for displaying warnings to the user; they
don't change anything in the working copy or the dirstate. In this
way, they are similar to the 'k' (keep) action. However, they are even
less action-like than 'k' is: 'k' at least describes what to do with
the file ("do nothing"), while 'dr' and 'rd' or only annotations for
files for which there may exist other, "real" actions.
As a first step towards separating these acitons out, stop including
them in the progress output, just like we already exclude the 'k'
action.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 05 Dec 2014 16:13:26 -0800 |
parents | 208ec8ca7c79 |
children | 5126d7718d7c |
comparison
equal
deleted
inserted
replaced
23523:01a8dfc79cdc | 23524:a1a7c94def6d |
---|---|
740 if os.path.lexists(repo.wjoin(f)): | 740 if os.path.lexists(repo.wjoin(f)): |
741 repo.ui.debug("removing %s\n" % f) | 741 repo.ui.debug("removing %s\n" % f) |
742 audit(f) | 742 audit(f) |
743 util.unlinkpath(repo.wjoin(f)) | 743 util.unlinkpath(repo.wjoin(f)) |
744 | 744 |
745 numupdates = sum(len(l) for m, l in actions.items() if m != 'k') | 745 numupdates = sum(len(l) for m, l in actions.items() |
746 if m not in ('k', 'dr', 'rd')) | |
746 | 747 |
747 if [a for a in actions['r'] if a[0] == '.hgsubstate']: | 748 if [a for a in actions['r'] if a[0] == '.hgsubstate']: |
748 subrepo.submerge(repo, wctx, mctx, wctx, overwrite) | 749 subrepo.submerge(repo, wctx, mctx, wctx, overwrite) |
749 | 750 |
750 # remove in parallel (must come first) | 751 # remove in parallel (must come first) |
823 repo.wwrite(f, mctx.filectx(f0).data(), flags) | 824 repo.wwrite(f, mctx.filectx(f0).data(), flags) |
824 updated += 1 | 825 updated += 1 |
825 | 826 |
826 # divergent renames | 827 # divergent renames |
827 for f, args, msg in actions['dr']: | 828 for f, args, msg in actions['dr']: |
828 repo.ui.debug(" %s: %s -> dr\n" % (f, msg)) | |
829 z += 1 | |
830 progress(_updating, z, item=f, total=numupdates, unit=_files) | |
831 fl, = args | 829 fl, = args |
832 repo.ui.warn(_("note: possible conflict - %s was renamed " | 830 repo.ui.warn(_("note: possible conflict - %s was renamed " |
833 "multiple times to:\n") % f) | 831 "multiple times to:\n") % f) |
834 for nf in fl: | 832 for nf in fl: |
835 repo.ui.warn(" %s\n" % nf) | 833 repo.ui.warn(" %s\n" % nf) |
836 | 834 |
837 # rename and delete | 835 # rename and delete |
838 for f, args, msg in actions['rd']: | 836 for f, args, msg in actions['rd']: |
839 repo.ui.debug(" %s: %s -> rd\n" % (f, msg)) | |
840 z += 1 | |
841 progress(_updating, z, item=f, total=numupdates, unit=_files) | |
842 fl, = args | 837 fl, = args |
843 repo.ui.warn(_("note: possible conflict - %s was deleted " | 838 repo.ui.warn(_("note: possible conflict - %s was deleted " |
844 "and renamed to:\n") % f) | 839 "and renamed to:\n") % f) |
845 for nf in fl: | 840 for nf in fl: |
846 repo.ui.warn(" %s\n" % nf) | 841 repo.ui.warn(" %s\n" % nf) |