changeset 31516:2915cc1d3429 stable

subrepo: move prompts out of the if (issue5505) Prompts weren't available in the else clause
author Simon Farnsworth <simonfar@fb.com>
date Mon, 20 Mar 2017 04:36:55 -0700
parents 10c0ee338535
children f97e90fa5ad7 ed5b25874d99
files mercurial/subrepo.py tests/test-subrepo.t
diffstat 2 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/subrepo.py	Thu Mar 16 12:33:15 2017 -0700
+++ b/mercurial/subrepo.py	Mon Mar 20 04:36:55 2017 -0700
@@ -194,7 +194,9 @@
             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 @@
         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 @@
                 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 @@
             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'
--- a/tests/test-subrepo.t	Thu Mar 16 12:33:15 2017 -0700
+++ b/tests/test-subrepo.t	Mon Mar 20 04:36:55 2017 -0700
@@ -349,7 +349,7 @@
 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 @@
   $ hg merge --config ui.interactive=true 6 <<EOF
   > 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 @@
   $ 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 @@
   $ hg merge --config ui.interactive=true 11 <<EOF
   > 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)