diff tests/test-subrepo-git.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 9f2c6892e004
children 5ef29e0dd418
line wrap: on
line diff
--- a/tests/test-subrepo-git.t	Wed Feb 16 01:29:26 2011 +0100
+++ b/tests/test-subrepo-git.t	Wed Feb 09 10:53:09 2011 +0100
@@ -329,3 +329,117 @@
   f1
   f2
   g
+
+Sticky subrepositories, no changes
+  $ cd $TESTTMP/ta
+  $ hg id -n
+  7
+  $ cd s
+  $ git rev-parse HEAD
+  32a343883b74769118bb1d3b4b1fbf9156f4dddc
+  $ cd ..
+  $ hg update 1 > /dev/null 2>&1
+  $ hg id -n
+  1
+  $ cd s
+  $ git rev-parse HEAD
+  da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
+  $ cd ..
+
+Sticky subrepositorys, file changes
+  $ touch s/f1
+  $ cd s
+  $ git add f1
+  $ cd ..
+  $ hg id -n
+  1
+  $ cd s
+  $ git rev-parse HEAD
+  da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
+  $ cd ..
+  $ hg update 4
+   subrepository sources for s differ
+  use (l)ocal source (da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7) or (r)emote source (aa84837ccfbdfedcdcdeeedc309d73e6eb069edc)?
+   l
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg id -n
+  4+
+  $ cd s
+  $ git rev-parse HEAD
+  da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
+  $ cd ..
+  $ hg update --clean tip > /dev/null 2>&1 
+
+Sticky subrepository, revision updates
+  $ hg id -n
+  7
+  $ cd s
+  $ git rev-parse HEAD
+  32a343883b74769118bb1d3b4b1fbf9156f4dddc
+  $ cd ..
+  $ cd s
+  $ git checkout aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
+  Previous HEAD position was 32a3438... fff
+  HEAD is now at aa84837... f
+  $ cd ..
+  $ hg update 1
+   subrepository sources for s differ (in checked out version)
+  use (l)ocal source (32a343883b74769118bb1d3b4b1fbf9156f4dddc) or (r)emote source (da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7)?
+   l
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg id -n
+  1+
+  $ cd s
+  $ git rev-parse HEAD
+  aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
+  $ cd ..
+
+Sticky subrepository, file changes and revision updates
+  $ touch s/f1
+  $ cd s
+  $ git add f1
+  $ git rev-parse HEAD
+  aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
+  $ cd ..
+  $ hg id -n
+  1+
+  $ hg update 7
+   subrepository sources for s differ
+  use (l)ocal source (32a343883b74769118bb1d3b4b1fbf9156f4dddc) or (r)emote source (32a343883b74769118bb1d3b4b1fbf9156f4dddc)?
+   l
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg id -n
+  7
+  $ cd s
+  $ git rev-parse HEAD
+  aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
+  $ cd ..
+
+Sticky repository, update --clean
+  $ hg update --clean tip
+  Previous HEAD position was aa84837... f
+  HEAD is now at 32a3438... fff
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg id -n
+  7
+  $ cd s
+  $ git rev-parse HEAD
+  32a343883b74769118bb1d3b4b1fbf9156f4dddc
+  $ cd ..
+
+Test subrepo already at intended revision:
+  $ cd s
+  $ git checkout 32a343883b74769118bb1d3b4b1fbf9156f4dddc
+  HEAD is now at 32a3438... fff
+  $ cd ..
+  $ hg update 1
+  Previous HEAD position was 32a3438... fff
+  HEAD is now at da5f5b1... g
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg id -n
+  1
+  $ cd s
+  $ git rev-parse HEAD
+  da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7
+  $ cd ..
+