tests/test-rebase-emptycommit.t
author Manuel Jacob <me@manueljacob.de>
Fri, 10 Jul 2020 00:44:18 +0200
changeset 45084 07b3166e94ca
parent 40865 4edd427f34c1
child 45771 f90a5c211251
permissions -rw-r--r--
commit: check branch change on to-be-committed changeset This makes a difference when a branch name is passed via the `extra` argument, which will be used as the branch name for the created changeset. The empty commit check should use that branch name instead of whatever was set on the working directory. Besides fixing the bug for which a test case was extended, it enables to remove a workaround in the rebase extension, which will be done in a follow-up patch (D8725). Differential Revision: https://phab.mercurial-scm.org/D8724
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33590
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
     1
  $ cat >> $HGRCPATH<<EOF
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
     2
  > [extensions]
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
     3
  > rebase=
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
     4
  > drawdag=$TESTDIR/drawdag.py
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
     5
  > EOF
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
     6
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
     7
  $ hg init non-merge
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
     8
  $ cd non-merge
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
     9
  $ hg debugdrawdag<<'EOS'
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    10
  >   F
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    11
  >   |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    12
  >   E
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    13
  >   |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    14
  >   D
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    15
  >   |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    16
  > B C
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    17
  > |/
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    18
  > A
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    19
  > EOS
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    20
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    21
  $ for i in C D E F; do
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    22
  >   hg bookmark -r $i -i BOOK-$i
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    23
  > done
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    24
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    25
  $ hg debugdrawdag<<'EOS'
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    26
  > E
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    27
  > |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    28
  > D
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    29
  > |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    30
  > B
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    31
  > EOS
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    32
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    33
  $ hg log -G -T '{rev} {desc} {bookmarks}'
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    34
  o  7 E
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    35
  |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    36
  o  6 D
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    37
  |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    38
  | o  5 F BOOK-F
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    39
  | |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    40
  | o  4 E BOOK-E
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    41
  | |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    42
  | o  3 D BOOK-D
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    43
  | |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    44
  | o  2 C BOOK-C
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    45
  | |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    46
  o |  1 B
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    47
  |/
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    48
  o  0 A
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    49
  
34354
2f427b57bf90 rebase: move bookmarks with --keep (issue5682)
Jun Wu <quark@fb.com>
parents: 33590
diff changeset
    50
With --keep, bookmark should move
33590
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    51
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    52
  $ hg rebase -r 3+4 -d E --keep
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    53
  rebasing 3:e7b3f00ed42e "D" (BOOK-D)
40865
4edd427f34c1 rebase: clarify that commits that become empty are skipped
Martin von Zweigbergk <martinvonz@google.com>
parents: 40864
diff changeset
    54
  note: not rebasing 3:e7b3f00ed42e "D" (BOOK-D), its destination already has all its changes
33590
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    55
  rebasing 4:69a34c08022a "E" (BOOK-E)
40865
4edd427f34c1 rebase: clarify that commits that become empty are skipped
Martin von Zweigbergk <martinvonz@google.com>
parents: 40864
diff changeset
    56
  note: not rebasing 4:69a34c08022a "E" (BOOK-E), its destination already has all its changes
33590
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    57
  $ hg log -G -T '{rev} {desc} {bookmarks}'
34354
2f427b57bf90 rebase: move bookmarks with --keep (issue5682)
Jun Wu <quark@fb.com>
parents: 33590
diff changeset
    58
  o  7 E BOOK-D BOOK-E
33590
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    59
  |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    60
  o  6 D
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    61
  |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    62
  | o  5 F BOOK-F
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    63
  | |
34354
2f427b57bf90 rebase: move bookmarks with --keep (issue5682)
Jun Wu <quark@fb.com>
parents: 33590
diff changeset
    64
  | o  4 E
33590
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    65
  | |
34354
2f427b57bf90 rebase: move bookmarks with --keep (issue5682)
Jun Wu <quark@fb.com>
parents: 33590
diff changeset
    66
  | o  3 D
33590
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    67
  | |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    68
  | o  2 C BOOK-C
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    69
  | |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    70
  o |  1 B
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    71
  |/
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    72
  o  0 A
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    73
  
34354
2f427b57bf90 rebase: move bookmarks with --keep (issue5682)
Jun Wu <quark@fb.com>
parents: 33590
diff changeset
    74
Move D and E back for the next test
2f427b57bf90 rebase: move bookmarks with --keep (issue5682)
Jun Wu <quark@fb.com>
parents: 33590
diff changeset
    75
2f427b57bf90 rebase: move bookmarks with --keep (issue5682)
Jun Wu <quark@fb.com>
parents: 33590
diff changeset
    76
  $ hg bookmark BOOK-D -fqir 3
2f427b57bf90 rebase: move bookmarks with --keep (issue5682)
Jun Wu <quark@fb.com>
parents: 33590
diff changeset
    77
  $ hg bookmark BOOK-E -fqir 4
2f427b57bf90 rebase: move bookmarks with --keep (issue5682)
Jun Wu <quark@fb.com>
parents: 33590
diff changeset
    78
33590
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    79
Bookmark is usually an indication of a head. For changes that are introduced by
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    80
an ancestor of bookmark B, after moving B to B-NEW, the changes are ideally
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    81
still introduced by an ancestor of changeset on B-NEW. In the below case,
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    82
"BOOK-D", and "BOOK-E" include changes introduced by "C".
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    83
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    84
  $ hg rebase -s 2 -d E
34290
4f969b9e0cf5 rebase: also include other namespaces in changeset description
Martin von Zweigbergk <martinvonz@google.com>
parents: 33590
diff changeset
    85
  rebasing 2:dc0947a82db8 "C" (BOOK-C C)
33590
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    86
  rebasing 3:e7b3f00ed42e "D" (BOOK-D)
40865
4edd427f34c1 rebase: clarify that commits that become empty are skipped
Martin von Zweigbergk <martinvonz@google.com>
parents: 40864
diff changeset
    87
  note: not rebasing 3:e7b3f00ed42e "D" (BOOK-D), its destination already has all its changes
33590
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    88
  rebasing 4:69a34c08022a "E" (BOOK-E)
40865
4edd427f34c1 rebase: clarify that commits that become empty are skipped
Martin von Zweigbergk <martinvonz@google.com>
parents: 40864
diff changeset
    89
  note: not rebasing 4:69a34c08022a "E" (BOOK-E), its destination already has all its changes
34290
4f969b9e0cf5 rebase: also include other namespaces in changeset description
Martin von Zweigbergk <martinvonz@google.com>
parents: 33590
diff changeset
    90
  rebasing 5:6b2aeab91270 "F" (BOOK-F F)
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34367
diff changeset
    91
  saved backup bundle to $TESTTMP/non-merge/.hg/strip-backup/dc0947a82db8-52bb4973-rebase.hg
33590
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    92
  $ hg log -G -T '{rev} {desc} {bookmarks}'
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    93
  o  5 F BOOK-F
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    94
  |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    95
  o  4 C BOOK-C BOOK-D BOOK-E
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    96
  |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    97
  o  3 E
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    98
  |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
    99
  o  2 D
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   100
  |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   101
  o  1 B
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   102
  |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   103
  o  0 A
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   104
  
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   105
Merge and its ancestors all become empty
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   106
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   107
  $ hg init $TESTTMP/merge1
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   108
  $ cd $TESTTMP/merge1
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   109
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   110
  $ hg debugdrawdag<<'EOS'
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   111
  >     E
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   112
  >    /|
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   113
  > B C D
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   114
  >  \|/
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   115
  >   A
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   116
  > EOS
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   117
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   118
  $ for i in C D E; do
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   119
  >   hg bookmark -r $i -i BOOK-$i
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   120
  > done
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   121
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   122
  $ hg debugdrawdag<<'EOS'
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   123
  > H
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   124
  > |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   125
  > D
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   126
  > |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   127
  > C
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   128
  > |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   129
  > B
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   130
  > EOS
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   131
45084
07b3166e94ca commit: check branch change on to-be-committed changeset
Manuel Jacob <me@manueljacob.de>
parents: 40865
diff changeset
   132
Previously, there was a bug where the empty commit check compared the parent
07b3166e94ca commit: check branch change on to-be-committed changeset
Manuel Jacob <me@manueljacob.de>
parents: 40865
diff changeset
   133
branch name with the wdir branch name instead of the actual branch name (which
07b3166e94ca commit: check branch change on to-be-committed changeset
Manuel Jacob <me@manueljacob.de>
parents: 40865
diff changeset
   134
should stay unchanged if --keepbranches is passed), and erroneously assumed
07b3166e94ca commit: check branch change on to-be-committed changeset
Manuel Jacob <me@manueljacob.de>
parents: 40865
diff changeset
   135
that an otherwise empty changeset should be created because of the incorrectly
07b3166e94ca commit: check branch change on to-be-committed changeset
Manuel Jacob <me@manueljacob.de>
parents: 40865
diff changeset
   136
assumed branch name change.
07b3166e94ca commit: check branch change on to-be-committed changeset
Manuel Jacob <me@manueljacob.de>
parents: 40865
diff changeset
   137
07b3166e94ca commit: check branch change on to-be-committed changeset
Manuel Jacob <me@manueljacob.de>
parents: 40865
diff changeset
   138
  $ hg update H -q
07b3166e94ca commit: check branch change on to-be-committed changeset
Manuel Jacob <me@manueljacob.de>
parents: 40865
diff changeset
   139
  $ hg branch foo -q
07b3166e94ca commit: check branch change on to-be-committed changeset
Manuel Jacob <me@manueljacob.de>
parents: 40865
diff changeset
   140
07b3166e94ca commit: check branch change on to-be-committed changeset
Manuel Jacob <me@manueljacob.de>
parents: 40865
diff changeset
   141
  $ hg rebase -r '(A::)-(B::)-A' -d H --keepbranches
33590
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   142
  rebasing 2:dc0947a82db8 "C" (BOOK-C)
40865
4edd427f34c1 rebase: clarify that commits that become empty are skipped
Martin von Zweigbergk <martinvonz@google.com>
parents: 40864
diff changeset
   143
  note: not rebasing 2:dc0947a82db8 "C" (BOOK-C), its destination already has all its changes
33590
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   144
  rebasing 3:b18e25de2cf5 "D" (BOOK-D)
40865
4edd427f34c1 rebase: clarify that commits that become empty are skipped
Martin von Zweigbergk <martinvonz@google.com>
parents: 40864
diff changeset
   145
  note: not rebasing 3:b18e25de2cf5 "D" (BOOK-D), its destination already has all its changes
34290
4f969b9e0cf5 rebase: also include other namespaces in changeset description
Martin von Zweigbergk <martinvonz@google.com>
parents: 33590
diff changeset
   146
  rebasing 4:86a1f6686812 "E" (BOOK-E E)
40865
4edd427f34c1 rebase: clarify that commits that become empty are skipped
Martin von Zweigbergk <martinvonz@google.com>
parents: 40864
diff changeset
   147
  note: not rebasing 4:86a1f6686812 "E" (BOOK-E E), its destination already has all its changes
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34367
diff changeset
   148
  saved backup bundle to $TESTTMP/merge1/.hg/strip-backup/b18e25de2cf5-1fd0a4ba-rebase.hg
45084
07b3166e94ca commit: check branch change on to-be-committed changeset
Manuel Jacob <me@manueljacob.de>
parents: 40865
diff changeset
   149
  $ hg update null -q
33590
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   150
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   151
  $ hg log -G -T '{rev} {desc} {bookmarks}'
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   152
  o  4 H BOOK-C BOOK-D BOOK-E
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   153
  |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   154
  o  3 D
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   155
  |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   156
  o  2 C
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   157
  |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   158
  o  1 B
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   159
  |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   160
  o  0 A
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   161
  
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   162
Part of ancestors of a merge become empty
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   163
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   164
  $ hg init $TESTTMP/merge2
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   165
  $ cd $TESTTMP/merge2
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   166
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   167
  $ hg debugdrawdag<<'EOS'
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   168
  >     G
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   169
  >    /|
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   170
  >   E F
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   171
  >   | |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   172
  > B C D
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   173
  >  \|/
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   174
  >   A
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   175
  > EOS
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   176
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   177
  $ for i in C D E F G; do
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   178
  >   hg bookmark -r $i -i BOOK-$i
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   179
  > done
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   180
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   181
  $ hg debugdrawdag<<'EOS'
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   182
  > H
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   183
  > |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   184
  > F
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   185
  > |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   186
  > C
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   187
  > |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   188
  > B
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   189
  > EOS
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   190
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   191
  $ hg rebase -r '(A::)-(B::)-A' -d H
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   192
  rebasing 2:dc0947a82db8 "C" (BOOK-C)
40865
4edd427f34c1 rebase: clarify that commits that become empty are skipped
Martin von Zweigbergk <martinvonz@google.com>
parents: 40864
diff changeset
   193
  note: not rebasing 2:dc0947a82db8 "C" (BOOK-C), its destination already has all its changes
34290
4f969b9e0cf5 rebase: also include other namespaces in changeset description
Martin von Zweigbergk <martinvonz@google.com>
parents: 33590
diff changeset
   194
  rebasing 3:b18e25de2cf5 "D" (BOOK-D D)
4f969b9e0cf5 rebase: also include other namespaces in changeset description
Martin von Zweigbergk <martinvonz@google.com>
parents: 33590
diff changeset
   195
  rebasing 4:03ca77807e91 "E" (BOOK-E E)
33590
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   196
  rebasing 5:ad6717a6a58e "F" (BOOK-F)
40865
4edd427f34c1 rebase: clarify that commits that become empty are skipped
Martin von Zweigbergk <martinvonz@google.com>
parents: 40864
diff changeset
   197
  note: not rebasing 5:ad6717a6a58e "F" (BOOK-F), its destination already has all its changes
34290
4f969b9e0cf5 rebase: also include other namespaces in changeset description
Martin von Zweigbergk <martinvonz@google.com>
parents: 33590
diff changeset
   198
  rebasing 6:c58e8bdac1f4 "G" (BOOK-G G)
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34367
diff changeset
   199
  saved backup bundle to $TESTTMP/merge2/.hg/strip-backup/b18e25de2cf5-2d487005-rebase.hg
33590
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   200
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   201
  $ hg log -G -T '{rev} {desc} {bookmarks}'
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   202
  o    7 G BOOK-G
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   203
  |\
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   204
  | o  6 E BOOK-E
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   205
  | |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   206
  o |  5 D BOOK-D BOOK-F
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   207
  |/
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   208
  o  4 H BOOK-C
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   209
  |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   210
  o  3 F
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   211
  |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   212
  o  2 C
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   213
  |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   214
  o  1 B
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   215
  |
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   216
  o  0 A
52f82e7d6a7e rebase: move bookmark to destination for commits becoming empty (issue5627)
Jun Wu <quark@fb.com>
parents:
diff changeset
   217