tests/test-evolve-issue5967.t
author Martin von Zweigbergk <martinvonz@google.com>
Thu, 30 Apr 2020 10:05:14 -0700
changeset 5341 13376ca93fa3
parent 5323 417503ef667d
child 5349 e8660b28bfee
permissions -rw-r--r--
evolve: always create commit when resolving divergence When resolving content-divergence, the final commit we create may end up empty (which means that Mercurial won't even create it). We've had code for handling that in evolve ever since 41bf6c27a122 (evolve: stabilize now handle conflicting changeset, 2012-08-23). However, that resolved the issue by marking on the divergent commits as successor. As Pierre-Yves has pointed out (in other code reviews), we should instead be creating a new successor. So that's what this patch does. It does that by setting `ui.allowemptycommit` while creating the final commit. However, that is not enough, because we may end up creating the same nodeid as already existed (we'd then end up trying to mark the "new" commit a successor of itself). To solve that, we add some salt to the commit extras. That salt affects lots of tests.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4688
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     1
hg evolve --continue and obsmarkers after conflict resolution with no changes to commit (issue5967)
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     2
https://bz.mercurial-scm.org/show_bug.cgi?id=5967
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     3
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     4
  $ . $TESTDIR/testlib/common.sh
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     5
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     6
  $ hg init issue5967
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     7
  $ cd issue5967
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     8
  $ cat > .hg/hgrc << EOF
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
     9
  > [alias]
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    10
  > glog = log -GT "{rev}: {desc}"
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    11
  > [extensions]
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    12
  > evolve=
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    13
  > EOF
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    14
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    15
  $ echo apple > a
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    16
  $ hg ci -qAm 'apple'
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    17
  $ echo banana > a
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    18
  $ hg ci -m 'banana'
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    19
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    20
Amending revision 0 in a way that causes conflicts
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    21
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    22
  $ hg prev
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    23
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    24
  [0] apple
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    25
  $ echo apricot > a
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    26
  $ hg amend -m 'apricot'
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    27
  1 new orphan changesets
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    28
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    29
  $ hg glog
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    30
  @  2: apricot
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    31
  
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    32
  *  1: banana
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    33
  |
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    34
  x  0: apple
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    35
  
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    36
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    37
Trying to evolve, then manually discarding changes from revision 1
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    38
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    39
  $ hg evolve
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    40
  move:[1] banana
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    41
  atop:[2] apricot
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    42
  merging a
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    43
  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
4706
de194ed973ba branching: merge with stable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4689
diff changeset
    44
  unresolved merge conflicts
de194ed973ba branching: merge with stable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4689
diff changeset
    45
  (see 'hg help evolve.interrupted')
4688
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    46
  [1]
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    47
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    48
  $ echo apricot > a
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    49
  $ hg resolve --mark a
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    50
  (no more unresolved files)
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    51
  continue: hg evolve --continue
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    52
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    53
This will correctly notice that revision 1 can be dropped
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    54
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    55
  $ hg evolve --continue
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    56
  evolving 1:dd9b5dd30cd6 "banana"
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    57
  evolution of 1:dd9b5dd30cd6 created no changes to commit
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    58
  working directory is now at 4d6fec23dcc4
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    59
  $ hg glog
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    60
  @  2: apricot
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    61
  
4689
27947b17cfaf evolve: orphans that evolve into nothing don't need successors (issue5967)
Anton Shestakov <av6@dwimlabs.net>
parents: 4688
diff changeset
    62
27947b17cfaf evolve: orphans that evolve into nothing don't need successors (issue5967)
Anton Shestakov <av6@dwimlabs.net>
parents: 4688
diff changeset
    63
This is important: 1 should not have a successor (especially not revision 2)
27947b17cfaf evolve: orphans that evolve into nothing don't need successors (issue5967)
Anton Shestakov <av6@dwimlabs.net>
parents: 4688
diff changeset
    64
5323
417503ef667d tests: add debugobsolete calls before many obslog calls
Martin von Zweigbergk <martinvonz@google.com>
parents: 5175
diff changeset
    65
  $ hg debugobsolete
417503ef667d tests: add debugobsolete calls before many obslog calls
Martin von Zweigbergk <martinvonz@google.com>
parents: 5175
diff changeset
    66
  3ba7db0ce860a189d1fd1fd7675f0e871652ed16 4d6fec23dcc4c3e4ccce8b1d3b79f62ee927c2be 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'amend', 'user': 'test'}
417503ef667d tests: add debugobsolete calls before many obslog calls
Martin von Zweigbergk <martinvonz@google.com>
parents: 5175
diff changeset
    67
  dd9b5dd30cd6b703d126d55b34165fd6ec5717c9 0 {3ba7db0ce860a189d1fd1fd7675f0e871652ed16} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'evolve', 'user': 'test'}
4688
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    68
  $ hg olog --all
4689
27947b17cfaf evolve: orphans that evolve into nothing don't need successors (issue5967)
Anton Shestakov <av6@dwimlabs.net>
parents: 4688
diff changeset
    69
  @  4d6fec23dcc4 (2) apricot
4688
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    70
  |
4689
27947b17cfaf evolve: orphans that evolve into nothing don't need successors (issue5967)
Anton Shestakov <av6@dwimlabs.net>
parents: 4688
diff changeset
    71
  x  3ba7db0ce860 (0) apple
27947b17cfaf evolve: orphans that evolve into nothing don't need successors (issue5967)
Anton Shestakov <av6@dwimlabs.net>
parents: 4688
diff changeset
    72
       rewritten(description, content) as 4d6fec23dcc4 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
4688
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    73
  
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    74
  $ hg olog --hidden --all 1
5175
307bb57ff2ce tests: adapt now that Mercurial clears the merge state for empty wdir
Martin von Zweigbergk <martinvonz@google.com>
parents: 5151
diff changeset
    75
  x  dd9b5dd30cd6 (1) banana
4689
27947b17cfaf evolve: orphans that evolve into nothing don't need successors (issue5967)
Anton Shestakov <av6@dwimlabs.net>
parents: 4688
diff changeset
    76
       pruned using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
4688
75329efe56a9 tests: demonstrate obsmarker creation after discarding conflicting changes
Anton Shestakov <av6@dwimlabs.net>
parents:
diff changeset
    77