tests/test-evolve-content-divergent-meta.t
author Martin von Zweigbergk <martinvonz@google.com>
Fri, 19 Apr 2019 09:41:39 -0700
changeset 4607 d314deb12f08
parent 4577 bcd52ce0916d
child 4625 a4fde4e3e763
permissions -rw-r--r--
evolve: run in a single transaction This speeds up `hg evolve --all` of a stack of 24 commits in the hg repo from 11.5s to 3.7s (3x). As can be seen in the tests, it also avoid some warnings about transiently unstable commits.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4482
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
     1
+====================================================
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
     2
+Tests the resolution of content divergence: metadata
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
     3
+====================================================
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
     4
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
     5
This file intend to cover cases focused around meta data merging.
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
     6
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
     7
Setup
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
     8
-----
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
     9
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    10
  $ cat >> $HGRCPATH <<EOF
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    11
  > [alias]
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    12
  > glog = log -GT "{rev}:{node|short} {desc|firstline}\n {phase} {troubles}\n\n"
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    13
  > [phases]
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    14
  > publish = False
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    15
  > [extensions]
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    16
  > rebase =
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    17
  > EOF
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    18
  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    19
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    20
Check we preserve the author properly
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    21
-------------------------------------
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    22
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    23
Testing issue6113 to make sure that content-divergence resolution don't
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    24
replace initial author with the user running the resolution command:
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    25
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    26
  $ hg init userfoo
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    27
  $ cd userfoo
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    28
  $ unset HGUSER
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    29
  $ echo "[ui]" >> ./.hg/hgrc
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    30
  $ echo "username = foo <foo@test.com>" >> ./.hg/hgrc
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    31
  $ for ch in a b c; do
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    32
  > echo $ch > $ch;
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    33
  > hg add $ch;
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    34
  > hg ci -m "added "$ch;
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    35
  > done;
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    36
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    37
  $ cd ..
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    38
  $ hg init userbar
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    39
  $ cd userbar
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    40
  $ unset HGUSER
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    41
  $ echo "[ui]" >> ./.hg/hgrc
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    42
  $ echo "username = bar <bar@test.com>" >> ./.hg/hgrc
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    43
  $ hg pull ./../userfoo -q
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    44
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    45
  $ cd ../userfoo
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    46
  $ hg up -r "desc('added b')"
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    47
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    48
  $ echo c > c
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    49
  $ echo e > e
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    50
  $ hg add c e
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    51
  $ hg ci -m "added c e"
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    52
  created new head
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    53
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    54
  $ hg up -r "desc('added b')"
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    55
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    56
  $ echo cc > c
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    57
  $ hg add c
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    58
  $ hg ci -m "added c"
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    59
  created new head
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    60
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    61
  $ hg prune -r "min(desc('added c'))" -s "desc('added c e')"
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    62
  1 changesets pruned
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    63
  $ hg prune -r "min(desc('added c'))" -s "max(desc('added c'))" --hidden
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    64
  1 changesets pruned
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    65
  2 new content-divergent changesets
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    66
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    67
  $ hg glog
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    68
  @  4:6c06cda6dc99 added c
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    69
  |   draft content-divergent
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    70
  |
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    71
  | *  3:0c9267e23c9d added c e
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    72
  |/    draft content-divergent
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    73
  |
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    74
  o  1:1740ad2a1eda added b
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    75
  |   draft
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    76
  |
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    77
  o  0:f863f39764c4 added a
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    78
      draft
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    79
  
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    80
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    81
  $ cd ../userbar
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    82
  $ hg pull ./../userfoo -q
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    83
  2 new content-divergent changesets
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    84
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    85
  $ hg evolve --content-divergent --any
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    86
  merge:[3] added c e
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    87
  with: [4] added c
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    88
  base: [2] added c
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    89
  updating to "local" side of the conflict: 0c9267e23c9d
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    90
  merging "other" content-divergent changeset '6c06cda6dc99'
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    91
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    92
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    93
Make sure resultant cset don't replace the initial user with user running the command:
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    94
  $ hg log -r tip
4483
7978230faa32 evolve: make sure div resolution don't replace the initial author (issue6113)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4482
diff changeset
    95
  changeset:   5:443bd2972210
4482
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    96
  tag:         tip
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    97
  parent:      1:1740ad2a1eda
4483
7978230faa32 evolve: make sure div resolution don't replace the initial author (issue6113)
Sushil khanchi <sushilkhanchi97@gmail.com>
parents: 4482
diff changeset
    98
  user:        foo <foo@test.com>
4482
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
    99
  date:        Thu Jan 01 00:00:00 1970 +0000
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
   100
  summary:     added c e
ee7e4e05ce44 evolve: add test which demonstrate issue6113
Sushil khanchi <sushilkhanchi97@gmail.com>
parents:
diff changeset
   101