tests/test-push-checkheads-superceed-A3.t
author Martin von Zweigbergk <martinvonz@google.com>
Tue, 18 Jan 2022 13:05:21 -0800
changeset 48981 f3aafd785e65
parent 42893 34a46d48d24e
child 49168 5996640fc6fe
permissions -rw-r--r--
filemerge: add support for partial conflict resolution by external tool A common class of merge conflicts is in imports/#includes/etc. It's relatively easy to write a tool that can resolve these conflicts, perhaps by naively just unioning the statements and leaving any cleanup to other tools to do later [1]. Such specialized tools cannot generally resolve all conflicts in a file, of course. Let's therefore call them "partial merge tools". Note that the internal simplemerge algorithm is such a partial merge tool - one that only resolves trivial "conflicts" where one side is unchanged or both sides change in the same way. One can also imagine having smarter language-aware partial tools that merge the AST. It may be useful for such tools to interactively let the user resolve any conflicts it can't resolve itself. However, having the option of implementing it as a partial merge tool means that the developer doesn't *need* to create a UI for it. Instead, the user can resolve any remaining conflicts with their regular merge tool (e.g. `:merge3` or `meld). We don't currently have a way to let the user define such partial merge tools. That's what this patch addresses. It lets the user configure partial merge tools to run. Each tool can be configured to run only on files matching certain patterns (e.g. "*.py"). The tool takes three inputs (local, base, other) and resolves conflicts by updating these in place. For example, let's say the inputs are these: base: ``` import sys def main(): print('Hello') ``` local: ``` import os import sys def main(): print('Hi') ``` other: ``` import re import sys def main(): print('Howdy') ``` A partial merge tool could now resolve the conflicting imports by replacing the import statements in *all* files by the following snippet, while leaving the remainder of the files unchanged. ``` import os import re import sys ``` As a result, simplemerge and any regular merge tool that runs after the partial merge tool(s) will consider the imports to be non-conflicting and will only present the conflict in `main()` to the user. Differential Revision: https://phab.mercurial-scm.org/D12356
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31976
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     1
====================================
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     2
Testing head checking code: Case A-3
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     3
====================================
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     4
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     5
Mercurial checks for the introduction of new heads on push. Evolution comes
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     6
into play to detect if existing branches on the server are being replaced by
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     7
some of the new one we push.
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     8
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     9
This case is part of a series of tests checking this behavior.
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    10
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    11
Category A: simple case involving a branch being superceeded by another.
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    12
TestCase 3: multi-changeset branch with reordering
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    13
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    14
Push should be allowed
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    15
.. old-state:
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    16
..
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    17
.. * 2 changeset branch
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    18
..
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    19
.. new-state:
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    20
..
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    21
.. * 2 changeset branch succeeding the old one with reordering
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    22
..
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    23
.. expected-result:
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    24
..
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    25
.. * push allowed
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    26
..
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    27
.. graph-summary:
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    28
..
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    29
..   B ø⇠⇠
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    30
..     | ⇡
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    31
..   A ø⇠⇠⇠○ A'
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    32
..     | ⇡/
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    33
..     | ○ B'
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    34
..     |/
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    35
..     ●
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    36
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    37
  $ . $TESTDIR/testlib/push-checkheads-util.sh
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    38
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    39
Test setup
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    40
----------
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    41
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    42
  $ mkdir A3
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    43
  $ cd A3
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    44
  $ setuprepos
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    45
  creating basic server and client repo
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    46
  updating to branch default
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    47
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    48
  $ cd server
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    49
  $ mkcommit B0
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    50
  $ cd ../client
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    51
  $ hg pull
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34661
diff changeset
    52
  pulling from $TESTTMP/A3/server
31976
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    53
  searching for changes
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    54
  adding changesets
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    55
  adding manifests
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    56
  adding file changes
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    57
  added 1 changesets with 1 changes to 1 files
39480
89630d0b3e23 phase: report number of non-public changeset alongside the new range
Boris Feld <boris.feld@octobus.net>
parents: 35709
diff changeset
    58
  new changesets d73caddc5533 (1 drafts)
31976
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    59
  (run 'hg update' to get a working copy)
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    60
  $ hg up 0
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    61
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    62
  $ mkcommit B1
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    63
  created new head
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    64
  $ mkcommit A1
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    65
  $ hg debugobsolete `getid "desc(A0)" ` `getid "desc(A1)"`
42893
34a46d48d24e debugobsolete: also issue the "new obsmarkers" messsage
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 39480
diff changeset
    66
  1 new obsolescence markers
33542
b11e8c67fb0f debugobsolete: also report the number of obsoleted changesets
Boris Feld <boris.feld@octobus.net>
parents: 33252
diff changeset
    67
  obsoleted 1 changesets
35709
1a09dad8b85a evolution: report new unstable changesets
Martin von Zweigbergk <martinvonz@google.com>
parents: 35393
diff changeset
    68
  1 new orphan changesets
31976
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    69
  $ hg debugobsolete `getid "desc(B0)" ` `getid "desc(B1)"`
42893
34a46d48d24e debugobsolete: also issue the "new obsmarkers" messsage
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 39480
diff changeset
    70
  1 new obsolescence markers
33542
b11e8c67fb0f debugobsolete: also report the number of obsoleted changesets
Boris Feld <boris.feld@octobus.net>
parents: 33252
diff changeset
    71
  obsoleted 1 changesets
31976
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    72
  $ hg log -G --hidden
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    73
  @  c1c7524e9488 (draft): A1
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    74
  |
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    75
  o  25c56d33e4c4 (draft): B1
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    76
  |
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    77
  | x  d73caddc5533 (draft): B0
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    78
  | |
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    79
  | x  8aaa48160adc (draft): A0
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    80
  |/
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    81
  o  1e4be0697311 (public): root
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    82
  
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    83
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    84
Actual testing
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    85
--------------
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    86
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    87
  $ hg push
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34661
diff changeset
    88
  pushing to $TESTTMP/A3/server
31976
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    89
  searching for changes
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    90
  adding changesets
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    91
  adding manifests
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    92
  adding file changes
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    93
  added 2 changesets with 2 changes to 2 files (+1 heads)
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    94
  2 new obsolescence markers
33252
53b3a1968aa6 obsolete: reports the number of local changeset obsoleted when unbundling
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 31976
diff changeset
    95
  obsoleted 2 changesets
31976
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    96
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    97
  $ cd ../..