tests/test-push-checkheads-pruned-B7.t
author Kyle Lippincott <spectral@google.com>
Mon, 16 Sep 2019 12:44:38 -0700
changeset 4848 535ab2609e45
parent 4840 62b60fc1983d
child 4860 015cdd3fa469
permissions -rw-r--r--
cmdstate: introduce a "saver" contextmanager and use it in place of save() Previously, the state was only saved in some paths out of these functions. This can be problematic, if the user ctrl-c's (or `kill -9`'s) the process, or we exit out of `relocate` for anything besides the "expected" reason, we won't record that we were in the middle of an evolve. One of our users has discovered that this leaves hg in a weird state; the user did something like this: ``` $ hg evolve <something goes wrong with the merge tool, hits ctrl-c> <deals with the merge conflicts> $ hg evolve --continue abort: no interrupted evolve to continue $ hg evolve abort: uncommitted changes # Note: commands.status.verbose=True is set. $ hg status M foo # The repository is in an unfinished *update* state. # No unresolved merge conflicts # To continue: hg update ``` The user did an `hg update`, but it didn't actually do anything besides take it out of the unfinished update state (the files were still dirty in the working directory).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     1
====================================
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     2
Testing head checking code: Case B-7
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     3
====================================
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     4
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
     5
Mercurial checks for the introduction of new heads on push. Evolution comes
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
     6
into play to detect if existing branches on the server are being replaced by
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
     7
some of the new one we push.
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     8
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
     9
This case is part of a series of tests checking this behavior.
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    10
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
    11
Category B: simple case involving pruned changesets
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    12
TestCase 7: single changesets, pruned then superseeded (on an existing changeset)
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    13
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    14
.. old-state:
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    15
..
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    16
.. * 1 changeset branch
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    17
..
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    18
.. new-state:
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    19
..
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    20
.. * old branch is rewritten onto the common set,
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    21
.. * the new version is then pruned.
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    22
..
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    23
.. expected-result:
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    24
..
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    25
.. * push allowed
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    26
..
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    27
.. graph-summary:
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    28
..
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    29
..   A ø⇠⊗ A'
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    30
.. B ◔ | |
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    31
..    \|/
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    32
..     ●
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    33
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
    34
  $ . $TESTDIR/testlib/push-checkheads-util.sh
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    35
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    36
Test setup
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    37
----------
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    38
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
    39
  $ mkdir B7
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
    40
  $ cd B7
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    41
  $ setuprepos
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    42
  creating basic server and client repo
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    43
  updating to branch default
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    44
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    45
  $ cd client
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    46
  $ hg up 0
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    47
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    48
  $ mkcommit B0
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    49
  created new head
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    50
  $ mkcommit A1
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    51
  $ hg up 'desc(B0)'
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    52
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    53
  $ hg debugobsolete `getid "desc(A0)"` `getid "desc(A1)"`
4840
62b60fc1983d test: change to output around transaction timing
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2754
diff changeset
    54
  1 new obsolescence markers
2754
21f06d932231 test: update test output to match b11e8c67fb0f
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2710
diff changeset
    55
  obsoleted 1 changesets
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    56
  $ hg debugobsolete --record-parents `getid "desc(A1)"`
4840
62b60fc1983d test: change to output around transaction timing
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2754
diff changeset
    57
  1 new obsolescence markers
2754
21f06d932231 test: update test output to match b11e8c67fb0f
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2710
diff changeset
    58
  obsoleted 1 changesets
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    59
  $ hg log -G --hidden
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    60
  x  ba93660aff8d (draft): A1
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    61
  |
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    62
  @  74ff5441d343 (draft): B0
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    63
  |
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    64
  | x  8aaa48160adc (draft): A0
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    65
  |/
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    66
  o  1e4be0697311 (public): root
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    67
  
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    68
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    69
Actual testing
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    70
--------------
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    71
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    72
  $ hg push
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
    73
  pushing to $TESTTMP/B7/server (glob)
2254
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    74
  searching for changes
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    75
  adding changesets
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    76
  adding manifests
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    77
  adding file changes
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    78
  added 1 changesets with 1 changes to 1 files (+1 heads)
446ed4c21bf6 check-heads: add tests about old heads indirectly pruned
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    79
  2 new obsolescence markers
2710
e22de367fc74 compat: adapt to change in 53b3a1968aa6-core
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2277
diff changeset
    80
  obsoleted 1 changesets
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
    81
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2254
diff changeset
    82
  $ cd ../..