tests: demonstrate hg pick forgetting files after conflicts stable
authorAnton Shestakov <av6@dwimlabs.net>
Sun, 23 Dec 2018 01:02:36 +0800
branchstable
changeset 4686 f1466f5ffbf5
parent 4685 5ca2da538689
child 4687 313565dd75e3
tests: demonstrate hg pick forgetting files after conflicts This test currently passes to show that pick is behaving incorrectly.
tests/test-pick.t
--- a/tests/test-pick.t	Thu Jun 13 13:27:26 2019 +0800
+++ b/tests/test-pick.t	Sun Dec 23 01:02:36 2018 +0800
@@ -3,6 +3,7 @@
   $ cat >> $HGRCPATH <<EOF
   > [alias]
   > glog = log -G -T "{rev}:{node|short} {desc}\n"
+  > glf = log -GT "{rev}: {desc} ({files})\n"
   > [extensions]
   > EOF
   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
@@ -386,3 +387,62 @@
   o  d03a6bcc83cd: default
   
   $ cd ..
+
+Check that pick doesn't drop files after conflicts occur (issue6037)
+--------------------------------------------------------------------
+
+  $ hg init issue6037
+  $ cd issue6037
+
+  $ echo apple > a
+  $ hg ci -qAm 'apple'
+
+  $ echo apricot > a
+  $ echo banana > b
+  $ hg ci -qAm 'apricot and banana'
+
+  $ echo avocado > a
+  $ hg ci -m 'avocado'
+
+  $ hg glf
+  @  2: avocado (a)
+  |
+  o  1: apricot and banana (a b)
+  |
+  o  0: apple (a)
+  
+Now let's change order of 1 and 2 using pick command
+
+  $ hg up -r 0
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+We avoid merge conflict here just to make the test shorter
+
+  $ hg pick -r 2 --tool :other
+  picking 2:f08a1e4a33c4 "avocado"
+
+Now we pick revision 1 that touches two files (a and b), merge conflict is expected
+
+  $ hg pick -r 1
+  picking 1:892e123ebf62 "apricot and banana"
+  merging a
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  unresolved merge conflicts (see hg help resolve)
+  [1]
+  $ hg resolve -t :other a
+  (no more unresolved files)
+  continue: hg pick --continue
+  $ hg pick --continue
+
+But what's this? b was forgotten and is not in the picked changeset!
+
+  $ hg status b
+  ? b
+  $ hg glf
+  @  4: apricot and banana (a)
+  |
+  o  3: avocado (a)
+  |
+  o  0: apple (a)
+  
+  $ cd ..