diff tests/test-subrepo.t @ 13417:0748e18be470

subrepos: prompt on conflicts on update with dirty subrepos Consider a repository with a single subrepository. The changesets in the main repository reference the subrepository changesets like this: m0 -> s0 m1 -> s1 m2 -> s2 Starting from a state (m1, s0), doing 'hg update m2' in the main repository will yield a conflict: the subrepo is at revision s0 but the target revision says it should be at revision s2. Before this change, Mercurial would do (m1, s0) -> (m2, s2) and thus ignore the conflict between the working copy and the target revision. With this change, the user is prompted to resolve the conflict by choosing which revision he wants. This is consistent with 'hg merge', which also prompts the user when it detects conflicts in the merged .hgsubstate files. The prompt looks like this: $ hg update tip subrepository sources for my-subrepo differ use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)?
author Erik Zielke <ez@aragost.com>
date Wed, 09 Feb 2011 10:53:09 +0100
parents d4de90a612f7
children ccb7240acf32 ab687820c4cc
line wrap: on
line diff
--- a/tests/test-subrepo.t	Wed Feb 16 01:29:26 2011 +0100
+++ b/tests/test-subrepo.t	Wed Feb 09 10:53:09 2011 +0100
@@ -706,3 +706,125 @@
   $ hg status -S
   ? s/b
   ? s/c
+
+Sticky subrepositories, no changes
+  $ cd $TESTTMP/sub/t
+  $ hg id
+  925c17564ef8 tip
+  $ hg -R s id
+  12a213df6fa9 tip
+  $ hg -R t id  
+  52c0adc0515a tip
+  $ hg update 11
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg id
+  365661e5936a
+  $ hg -R s id
+  fc627a69481f
+  $ hg -R t id  
+  e95bcfa18a35
+
+Sticky subrepositorys, file changes
+  $ touch s/f1
+  $ touch t/f1
+  $ hg add -S s/f1
+  $ hg add -S t/f1
+  $ hg id
+  365661e5936a
+  $ hg -R s id
+  fc627a69481f+
+  $ hg -R t id  
+  e95bcfa18a35+
+  $ hg update tip
+   subrepository sources for s differ
+  use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)?
+   l
+   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
+  $ hg id
+  925c17564ef8+ tip
+  $ hg -R s id
+  fc627a69481f+
+  $ hg -R t id  
+  e95bcfa18a35+
+  $ hg update --clean tip
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Sticky subrepository, revision updates
+  $ hg id
+  925c17564ef8 tip
+  $ hg -R s id
+  12a213df6fa9 tip
+  $ hg -R t id  
+  52c0adc0515a tip
+  $ cd s
+  $ hg update -r -2
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd ../t
+  $ hg update -r 2
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd ..
+  $ hg update 10
+   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
+  $ hg id
+  e45c8b14af55+
+  $ hg -R s id
+  1c833a7a9e3a
+  $ hg -R t id  
+  7af322bc1198
+
+Sticky subrepository, file changes and revision updates
+  $ touch s/f1
+  $ touch t/f1
+  $ hg add -S s/f1
+  $ hg add -S t/f1
+  $ hg id
+  e45c8b14af55+
+  $ hg -R s id
+  1c833a7a9e3a+
+  $ hg -R t id  
+  7af322bc1198+
+  $ hg update tip
+   subrepository sources for s differ
+  use (l)ocal source (1c833a7a9e3a) or (r)emote source (12a213df6fa9)?
+   l
+   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
+  $ hg id
+  925c17564ef8 tip
+  $ hg -R s id
+  1c833a7a9e3a+
+  $ hg -R t id  
+  7af322bc1198+
+
+Sticky repository, update --clean
+  $ hg update --clean tip
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg id
+  925c17564ef8 tip
+  $ hg -R s id
+  12a213df6fa9 tip
+  $ hg -R t id  
+  52c0adc0515a tip
+
+Test subrepo already at intended revision:
+  $ cd s
+  $ hg update fc627a69481f
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd ..
+  $ hg update 11
+  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
+  11+
+  $ hg -R s id
+  fc627a69481f
+  $ hg -R t id 
+  e95bcfa18a35