Mercurial > hg
changeset 30060:a145161debed
merge: use labels in subrepo merge
This is the last place that doesn't respect conflict labels in merge output.
Teach subrepos to use subrepo merge output too.
author | Simon Farnsworth <simonfar@fb.com> |
---|---|
date | Sat, 08 Oct 2016 01:25:28 -0700 |
parents | 6ffb7e0249f4 |
children | 8e805cf27caa |
files | mercurial/merge.py mercurial/subrepo.py tests/test-largefiles-update.t tests/test-subrepo-git.t tests/test-subrepo-svn.t tests/test-subrepo.t |
diffstat | 6 files changed, 46 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/merge.py Fri Oct 07 08:32:18 2016 -0400 +++ b/mercurial/merge.py Sat Oct 08 01:25:28 2016 -0700 @@ -1150,7 +1150,7 @@ numupdates = sum(len(l) for m, l in actions.items() if m != 'k') if [a for a in actions['r'] if a[0] == '.hgsubstate']: - subrepo.submerge(repo, wctx, mctx, wctx, overwrite) + subrepo.submerge(repo, wctx, mctx, wctx, overwrite, labels) # remove in parallel (must come first) z = 0 @@ -1168,7 +1168,7 @@ updated = len(actions['g']) if [a for a in actions['g'] if a[0] == '.hgsubstate']: - subrepo.submerge(repo, wctx, mctx, wctx, overwrite) + subrepo.submerge(repo, wctx, mctx, wctx, overwrite, labels) # forget (manifest only, just log it) (must come first) for f, args, msg in actions['f']: @@ -1253,7 +1253,7 @@ progress(_updating, z, item=f, total=numupdates, unit=_files) if f == '.hgsubstate': # subrepo states need updating subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), - overwrite) + overwrite, labels) continue audit(f) complete, r = ms.preresolve(f, wctx)
--- a/mercurial/subrepo.py Fri Oct 07 08:32:18 2016 -0400 +++ b/mercurial/subrepo.py Sat Oct 08 01:25:28 2016 -0700 @@ -26,6 +26,7 @@ config, error, exchange, + filemerge, match as matchmod, node, pathutil, @@ -174,7 +175,7 @@ if state[s][1] != nullstate[1]] repo.wwrite('.hgsubstate', ''.join(lines), '') -def submerge(repo, wctx, mctx, actx, overwrite): +def submerge(repo, wctx, mctx, actx, overwrite, labels=None): """delegated from merge.applyupdates: merging of .hgsubstate file in working context, merging context and ancestor context""" if mctx == actx: # backwards? @@ -200,6 +201,8 @@ a = ld if s in s2: + prompts = filemerge.partextras(labels) + prompts['s'] = s r = s2[s] if ld == r or r == a: # no change or local is newer sm[s] = l @@ -209,10 +212,13 @@ wctx.sub(s).get(r, overwrite) sm[s] = r elif ld[0] != r[0]: # sources differ + prompts['lo'] = l[0] + prompts['ro'] = r[0] if repo.ui.promptchoice( - _(' subrepository sources for %s differ\n' - 'use (l)ocal source (%s) or (r)emote source (%s)?' - '$$ &Local $$ &Remote') % (s, l[0], r[0]), 0): + _(' subrepository sources for %(s)s differ\n' + 'use (l)ocal%(l)s source (%(lo)s)' + ' or (r)emote%(o)s source (%(ro)s)?' + '$$ &Local $$ &Remote') % prompts, 0): debug(s, "prompt changed, get", r) wctx.sub(s).get(r, overwrite) sm[s] = r @@ -223,12 +229,14 @@ else: debug(s, "both sides changed") srepo = wctx.sub(s) + prompts['sl'] = srepo.shortid(l[1]) + prompts['sr'] = srepo.shortid(r[1]) option = repo.ui.promptchoice( - _(' subrepository %s diverged (local revision: %s, ' - 'remote revision: %s)\n' - '(M)erge, keep (l)ocal or keep (r)emote?' + _(' subrepository %(s)s diverged (local revision: %(sl)s, ' + 'remote revision: %(sr)s)\n' + '(M)erge, keep (l)ocal%(l)s or keep (r)emote%(o)s?' '$$ &Merge $$ &Local $$ &Remote') - % (s, srepo.shortid(l[1]), srepo.shortid(r[1])), 0) + % prompts, 0) if option == 0: wctx.sub(s).merge(r) sm[s] = l @@ -249,9 +257,10 @@ continue else: if repo.ui.promptchoice( - _(' local changed subrepository %s which remote removed\n' + _(' local%(l)s changed subrepository %(s)s' + ' which remote%(o)s removed\n' 'use (c)hanged version or (d)elete?' - '$$ &Changed $$ &Delete') % s, 0): + '$$ &Changed $$ &Delete') % prompts, 0): debug(s, "prompt remove") wctx.sub(s).remove() @@ -264,9 +273,10 @@ sm[s] = r elif r != sa[s]: if repo.ui.promptchoice( - _(' remote changed subrepository %s which local removed\n' + _(' remote%(o)s changed subrepository %(s)s' + ' which local%(l)s removed\n' 'use (c)hanged version or (d)elete?' - '$$ &Changed $$ &Delete') % s, 0) == 0: + '$$ &Changed $$ &Delete') % prompts, 0) == 0: debug(s, "prompt recreate", r) mctx.sub(s).get(r) sm[s] = r
--- a/tests/test-largefiles-update.t Fri Oct 07 08:32:18 2016 -0400 +++ b/tests/test-largefiles-update.t Sat Oct 08 01:25:28 2016 -0700 @@ -546,7 +546,7 @@ > l > EOF subrepository sub diverged (local revision: f74e50bd9e55, remote revision: d65e59e952a9) - (M)erge, keep (l)ocal or keep (r)emote? m + (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m subrepository sources for sub differ (in checked out version) use (l)ocal source (f74e50bd9e55) or (r)emote source (d65e59e952a9)? r remote turned local largefile large2 into a normal file
--- a/tests/test-subrepo-git.t Fri Oct 07 08:32:18 2016 -0400 +++ b/tests/test-subrepo-git.t Sat Oct 08 01:25:28 2016 -0700 @@ -507,7 +507,7 @@ $ cd .. $ hg update 4 subrepository s diverged (local revision: da5f5b1, remote revision: aa84837) - (M)erge, keep (l)ocal or keep (r)emote? m + (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m subrepository sources for s differ use (l)ocal source (da5f5b1) or (r)emote source (aa84837)? l 0 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -533,7 +533,7 @@ $ cd .. $ hg update 1 subrepository s diverged (local revision: 32a3438, remote revision: da5f5b1) - (M)erge, keep (l)ocal or keep (r)emote? m + (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m subrepository sources for s differ (in checked out version) use (l)ocal source (32a3438) or (r)emote source (da5f5b1)? l 1 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -555,7 +555,7 @@ 1+ $ hg update 7 subrepository s diverged (local revision: 32a3438, remote revision: 32a3438) - (M)erge, keep (l)ocal or keep (r)emote? m + (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m subrepository sources for s differ use (l)ocal source (32a3438) or (r)emote source (32a3438)? l 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-subrepo-svn.t Fri Oct 07 08:32:18 2016 -0400 +++ b/tests/test-subrepo-svn.t Sat Oct 08 01:25:28 2016 -0700 @@ -310,7 +310,7 @@ $ cd .. $ hg update tip subrepository s diverged (local revision: 2, remote revision: 3) - (M)erge, keep (l)ocal or keep (r)emote? m + (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m subrepository sources for s differ use (l)ocal source (2) or (r)emote source (3)? l 1 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -341,7 +341,7 @@ $ cd .. $ hg update 1 subrepository s diverged (local revision: 3, remote revision: 2) - (M)erge, keep (l)ocal or keep (r)emote? m + (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m subrepository sources for s differ (in checked out version) use (l)ocal source (1) or (r)emote source (2)? l 1 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -364,7 +364,7 @@ 1+ $ hg update tip subrepository s diverged (local revision: 3, remote revision: 3) - (M)erge, keep (l)ocal or keep (r)emote? m + (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m subrepository sources for s differ use (l)ocal source (1) or (r)emote source (3)? l 1 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -398,7 +398,7 @@ $ cd .. $ hg update 1 subrepository s diverged (local revision: 3, remote revision: 2) - (M)erge, keep (l)ocal or keep (r)emote? m + (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg id -n 1+
--- a/tests/test-subrepo.t Fri Oct 07 08:32:18 2016 -0400 +++ b/tests/test-subrepo.t Sat Oct 08 01:25:28 2016 -0700 @@ -303,6 +303,7 @@ subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4 subrepo t: both sides changed subrepository t diverged (local revision: 20a0db6fbf6c, remote revision: 7af322bc1198) + starting 4 threads for background file closing (?) (M)erge, keep (l)ocal or keep (r)emote? m merging subrepo t searching for copies back to rev 2 @@ -310,7 +311,6 @@ branchmerge: True, force: False, partial: False ancestor: 6747d179aa9a, local: 20a0db6fbf6c+, remote: 7af322bc1198 preserving t for resolve of t - starting 4 threads for background file closing (?) t: versions differ -> m (premerge) picked tool ':merge' for t (binary False symlink False changedelete False) merging t @@ -349,7 +349,7 @@ local removed, remote changed, keep changed $ hg merge 6 - remote changed subrepository t which local removed + remote changed subrepository s which local removed use (c)hanged version or (d)elete? c 0 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -380,7 +380,7 @@ $ hg merge --config ui.interactive=true 6 <<EOF > d > EOF - remote changed subrepository t which local removed + remote changed subrepository s which local removed use (c)hanged version or (d)elete? d 0 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -404,7 +404,7 @@ $ hg co -C 6 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg merge 11 - local changed subrepository t which remote removed + local changed subrepository s which remote removed use (c)hanged version or (d)elete? c 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -436,7 +436,7 @@ $ hg merge --config ui.interactive=true 11 <<EOF > d > EOF - local changed subrepository t which remote removed + local changed subrepository s which remote removed use (c)hanged version or (d)elete? d 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -1129,7 +1129,7 @@ adding file changes added 1 changesets with 2 changes to 2 files subrepository sub/repo diverged (local revision: f42d5c7504a8, remote revision: 46cd4aac504c) - (M)erge, keep (l)ocal or keep (r)emote? m + (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m pulling subrepo sub/repo from $TESTTMP/issue1852a/sub/repo (glob) searching for changes adding changesets @@ -1238,11 +1238,11 @@ e95bcfa18a35+ $ hg update tip subrepository s diverged (local revision: fc627a69481f, remote revision: 12a213df6fa9) - (M)erge, keep (l)ocal or keep (r)emote? m + (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m subrepository sources for s differ use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)? l subrepository t diverged (local revision: e95bcfa18a35, remote revision: 52c0adc0515a) - (M)erge, keep (l)ocal or keep (r)emote? m + (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m subrepository sources for t differ use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)? l 0 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -1271,9 +1271,9 @@ $ cd .. $ hg update 10 subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f) - (M)erge, keep (l)ocal or keep (r)emote? m + (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m subrepository t diverged (local revision: 52c0adc0515a, remote revision: 20a0db6fbf6c) - (M)erge, keep (l)ocal or keep (r)emote? m + (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m subrepository sources for t differ (in checked out version) use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)? l 0 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -1297,11 +1297,11 @@ 7af322bc1198+ $ hg update tip subrepository s diverged (local revision: 12a213df6fa9, remote revision: 12a213df6fa9) - (M)erge, keep (l)ocal or keep (r)emote? m + (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m subrepository sources for s differ use (l)ocal source (02dcf1d70411) or (r)emote source (12a213df6fa9)? l subrepository t diverged (local revision: 52c0adc0515a, remote revision: 52c0adc0515a) - (M)erge, keep (l)ocal or keep (r)emote? m + (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m subrepository sources for t differ use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)? l 0 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -1329,7 +1329,7 @@ $ cd .. $ hg update 11 subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f) - (M)erge, keep (l)ocal or keep (r)emote? m + (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg id -n