# HG changeset patch # User Simon Farnsworth # Date 2017-03-20 11:36:55 # Node ID 2915cc1d3429f9b11c9cf48d45990f982fff8e7a # Parent 10c0ee33853539bd2721a05d4753785c2494d243 subrepo: move prompts out of the if (issue5505) Prompts weren't available in the else clause diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -194,7 +194,9 @@ def submerge(repo, wctx, mctx, actx, ove r = "%s:%s:%s" % r repo.ui.debug(" subrepo %s: %s %s\n" % (s, msg, r)) + promptssrc = filemerge.partextras(labels) for s, l in sorted(s1.iteritems()): + prompts = None a = sa.get(s, nullstate) ld = l # local state with possible dirty flag for compares if wctx.sub(s).dirty(): @@ -202,9 +204,9 @@ def submerge(repo, wctx, mctx, actx, ove if wctx == actx: # overwrite a = ld + prompts = promptssrc.copy() + prompts['s'] = s 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 @@ -267,6 +269,7 @@ def submerge(repo, wctx, mctx, actx, ove wctx.sub(s).remove() for s, r in sorted(s2.items()): + prompts = None if s in s1: continue elif s not in sa: @@ -274,6 +277,8 @@ def submerge(repo, wctx, mctx, actx, ove mctx.sub(s).get(r) sm[s] = r elif r != sa[s]: + prompts = promptssrc.copy() + prompts['s'] = s if repo.ui.promptchoice( _(' remote%(o)s changed subrepository %(s)s' ' which local%(l)s removed\n' diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t --- a/tests/test-subrepo.t +++ b/tests/test-subrepo.t @@ -349,7 +349,7 @@ 11: remove subrepo t local removed, remote changed, keep changed $ hg merge 6 - remote [merge rev] changed subrepository s which local [working copy] removed + remote [merge rev] changed subrepository t which local [working copy] 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 @@ local removed, remote changed, keep remo $ hg merge --config ui.interactive=true 6 < d > EOF - remote [merge rev] changed subrepository s which local [working copy] removed + remote [merge rev] changed subrepository t which local [working copy] 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 @@ local changed, remote removed, keep chan $ hg co -C 6 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg merge 11 - local [working copy] changed subrepository s which remote [merge rev] removed + local [working copy] changed subrepository t which remote [merge rev] 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 @@ local changed, remote removed, keep remo $ hg merge --config ui.interactive=true 11 < d > EOF - local [working copy] changed subrepository s which remote [merge rev] removed + local [working copy] changed subrepository t which remote [merge rev] 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)