tests/test-bundle-phases.t
author Martin von Zweigbergk <martinvonz@google.com>
Thu, 22 Jun 2017 10:10:02 -0700
changeset 33031 e8c8d81eb864
child 33032 8e3021fd1a44
permissions -rw-r--r--
bundle: add config option to include phases This adds an experimental.bundle-phases config option to include phase information in bundles. As with the recently added support for bundling obsmarkers, the support for bundling phases is hidden behind the config option until we decide to make a bundlespec v3 that includes phases (and obsmarkers and ...). We could perhaps use the listkeys format for this, but that's considered obsolete according to Pierre-Yves. Instead, we introduce a new "phase-heads" bundle part. The new part contains the phase heads among the set of bundled revisions. It does not include those in secret phase; any head in the bundle that is not mentioned in the phase-heads part is assumed to be secret. As a special case, an empty phase-heads part thus means that any changesets should be added in secret phase. (If we ever add a fourth phase, we'll include secret in the part and we'll add a version number.) For now, phases are only included by "hg bundle", and not by e.g. strip and rebase.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33031
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     1
  $ cat >> $HGRCPATH <<EOF
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     2
  > [experimental]
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     3
  > bundle-phases=yes
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     4
  > [extensions]
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     5
  > strip=
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     6
  > drawdag=$TESTDIR/drawdag.py
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     7
  > EOF
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     8
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     9
Set up repo with linear history
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    10
  $ hg init linear
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    11
  $ cd linear
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    12
  $ hg debugdrawdag <<'EOF'
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    13
  > E
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    14
  > |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    15
  > D
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    16
  > |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    17
  > C
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    18
  > |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    19
  > B
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    20
  > |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    21
  > A
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    22
  > EOF
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    23
  $ hg phase --public A
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    24
  $ hg phase --force --secret D
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    25
  $ hg log -G -T '{desc} {phase}\n'
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    26
  o  E secret
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    27
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    28
  o  D secret
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    29
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    30
  o  C draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    31
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    32
  o  B draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    33
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    34
  o  A public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    35
  
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    36
Phases are restored when unbundling
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    37
  $ hg bundle --base B -r E bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    38
  3 changesets found
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    39
  $ hg debugbundle bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    40
  Stream params: sortdict([('Compression', 'BZ')])
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    41
  changegroup -- "sortdict([('version', '02'), ('nbchanges', '3')])"
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    42
      26805aba1e600a82e93661149f2313866a221a7b
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    43
      f585351a92f85104bff7c284233c338b10eb1df7
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    44
      9bc730a19041f9ec7cb33c626e811aa233efb18c
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    45
  phase-heads -- 'sortdict()'
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    46
      26805aba1e600a82e93661149f2313866a221a7b draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    47
  $ hg strip --no-backup C
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    48
  $ hg unbundle -q bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    49
  $ rm bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    50
  $ hg log -G -T '{desc} {phase}\n'
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    51
  o  E secret
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    52
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    53
  o  D secret
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    54
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    55
  o  C draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    56
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    57
  o  B draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    58
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    59
  o  A public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    60
  
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    61
Root revision's phase is preserved
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    62
  $ hg bundle -a bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    63
  5 changesets found
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    64
  $ hg strip --no-backup A
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    65
  $ hg unbundle -q bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    66
  $ rm bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    67
  $ hg log -G -T '{desc} {phase}\n'
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    68
  o  E secret
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    69
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    70
  o  D secret
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    71
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    72
  o  C draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    73
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    74
  o  B draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    75
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    76
  o  A public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    77
  
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    78
Completely public history can be restored
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    79
  $ hg phase --public E
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    80
  $ hg bundle -a bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    81
  5 changesets found
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    82
  $ hg strip --no-backup A
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    83
  $ hg unbundle -q bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    84
  $ rm bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    85
  $ hg log -G -T '{desc} {phase}\n'
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    86
  o  E public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    87
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    88
  o  D public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    89
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    90
  o  C public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    91
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    92
  o  B public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    93
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    94
  o  A public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    95
  
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    96
Direct transition from public to secret can be restored
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    97
  $ hg phase --secret --force D
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    98
  $ hg bundle -a bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    99
  5 changesets found
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   100
  $ hg strip --no-backup A
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   101
  $ hg unbundle -q bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   102
  $ rm bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   103
  $ hg log -G -T '{desc} {phase}\n'
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   104
  o  E secret
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   105
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   106
  o  D secret
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   107
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   108
  o  C public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   109
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   110
  o  B public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   111
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   112
  o  A public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   113
  
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   114
Revisions within bundle preserve their phase even if parent changes its phase
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   115
  $ hg phase --draft --force B
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   116
  $ hg bundle --base B -r E bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   117
  3 changesets found
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   118
  $ hg strip --no-backup C
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   119
  $ hg phase --public B
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   120
  $ hg unbundle -q bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   121
  $ rm bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   122
  $ hg log -G -T '{desc} {phase}\n'
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   123
  o  E secret
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   124
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   125
  o  D secret
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   126
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   127
  o  C draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   128
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   129
  o  B public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   130
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   131
  o  A public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   132
  
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   133
Phase of ancestors of stripped node get advanced to accommodate child
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   134
  $ hg bundle --base B -r E bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   135
  3 changesets found
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   136
  $ hg strip --no-backup C
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   137
  $ hg phase --force --secret B
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   138
  $ hg unbundle -q bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   139
  $ rm bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   140
  $ hg log -G -T '{desc} {phase}\n'
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   141
  o  E secret
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   142
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   143
  o  D secret
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   144
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   145
  o  C draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   146
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   147
  o  B draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   148
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   149
  o  A public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   150
  
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   151
Unbundling advances phases of changesets even if they were already in the repo.
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   152
To test that, create a bundle of everything in draft phase and then unbundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   153
to see that secret becomes draft, but public remains public.
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   154
  $ hg phase --draft --force A
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   155
  $ hg phase --draft E
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   156
  $ hg bundle -a bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   157
  5 changesets found
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   158
  $ hg phase --public A
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   159
  $ hg phase --secret --force E
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   160
  $ hg unbundle -q bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   161
  $ rm bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   162
  $ hg log -G -T '{desc} {phase}\n'
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   163
  o  E draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   164
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   165
  o  D draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   166
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   167
  o  C draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   168
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   169
  o  B draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   170
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   171
  o  A public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   172
  
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   173
  $ cd ..
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   174
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   175
Set up repo with non-linear history
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   176
  $ hg init non-linear
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   177
  $ cd non-linear
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   178
  $ hg debugdrawdag <<'EOF'
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   179
  > D E
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   180
  > |\|
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   181
  > B C
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   182
  > |/
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   183
  > A
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   184
  > EOF
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   185
  $ hg phase --public C
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   186
  $ hg phase --force --secret B
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   187
  $ hg log -G -T '{node|short} {desc} {phase}\n'
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   188
  o  03ca77807e91 E draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   189
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   190
  | o  215e7b0814e1 D secret
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   191
  |/|
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   192
  o |  dc0947a82db8 C public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   193
  | |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   194
  | o  112478962961 B secret
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   195
  |/
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   196
  o  426bada5c675 A public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   197
  
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   198
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   199
Restore bundle of entire repo
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   200
  $ hg bundle -a bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   201
  5 changesets found
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   202
  $ hg debugbundle bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   203
  Stream params: sortdict([('Compression', 'BZ')])
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   204
  changegroup -- "sortdict([('version', '02'), ('nbchanges', '5')])"
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   205
      426bada5c67598ca65036d57d9e4b64b0c1ce7a0
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   206
      112478962961147124edd43549aedd1a335e44bf
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   207
      dc0947a82db884575bb76ea10ac97b08536bfa03
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   208
      215e7b0814e1cac8e2614e7284f2a5dc266b4323
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   209
      03ca77807e919db8807c3749086dc36fb478cac0
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   210
  phase-heads -- 'sortdict()'
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   211
      dc0947a82db884575bb76ea10ac97b08536bfa03 public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   212
      03ca77807e919db8807c3749086dc36fb478cac0 draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   213
  $ hg strip --no-backup A
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   214
  $ hg unbundle -q bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   215
  $ rm bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   216
  $ hg log -G -T '{node|short} {desc} {phase}\n'
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   217
  o  03ca77807e91 E draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   218
  |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   219
  | o  215e7b0814e1 D secret
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   220
  |/|
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   221
  o |  dc0947a82db8 C public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   222
  | |
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   223
  | o  112478962961 B secret
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   224
  |/
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   225
  o  426bada5c675 A public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   226
  
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   227
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   228
  $ hg bundle --base 'A + C' -r D bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   229
  2 changesets found
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   230
  $ hg debugbundle bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   231
  Stream params: sortdict([('Compression', 'BZ')])
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   232
  changegroup -- "sortdict([('version', '02'), ('nbchanges', '2')])"
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   233
      112478962961147124edd43549aedd1a335e44bf
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   234
      215e7b0814e1cac8e2614e7284f2a5dc266b4323
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   235
  phase-heads -- 'sortdict()'
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   236
  $ rm bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   237
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   238
  $ hg bundle --base A -r D bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   239
  3 changesets found
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   240
  $ hg debugbundle bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   241
  Stream params: sortdict([('Compression', 'BZ')])
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   242
  changegroup -- "sortdict([('version', '02'), ('nbchanges', '3')])"
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   243
      112478962961147124edd43549aedd1a335e44bf
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   244
      dc0947a82db884575bb76ea10ac97b08536bfa03
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   245
      215e7b0814e1cac8e2614e7284f2a5dc266b4323
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   246
  phase-heads -- 'sortdict()'
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   247
      dc0947a82db884575bb76ea10ac97b08536bfa03 public
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   248
  $ rm bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   249
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   250
  $ hg bundle --base 'B + C' -r 'D + E' bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   251
  2 changesets found
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   252
  $ hg debugbundle bundle
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   253
  Stream params: sortdict([('Compression', 'BZ')])
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   254
  changegroup -- "sortdict([('version', '02'), ('nbchanges', '2')])"
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   255
      215e7b0814e1cac8e2614e7284f2a5dc266b4323
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   256
      03ca77807e919db8807c3749086dc36fb478cac0
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   257
  phase-heads -- 'sortdict()'
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   258
      03ca77807e919db8807c3749086dc36fb478cac0 draft
e8c8d81eb864 bundle: add config option to include phases
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   259
  $ rm bundle