tests/test-close-head.t
author Joerg Sonnenberger <joerg@bec.de>
Mon, 14 May 2018 00:43:07 +0200
changeset 39993 cd5f2e615262
child 40096 12a72729678e
permissions -rw-r--r--
extensions: new closehead module for closing arbitrary heads ``hg close-head`` allows closing arbitrary heads. It is equivalent to checking out the given revisions and commit an empty change with ``hg commit --close-branch``. Differential Revision: https://phab.mercurial-scm.org/D3557
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
39993
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     1
  $ hg init test-content
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     2
  $ cd test-content
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     3
  $ hg debugbuilddag '+2*2*3*4'
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     4
  $ hg bookmark -r 1 @
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     5
  $ hg log -G --template '{rev}:{node|short}'
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     6
  o  4:e7bd5218ca15
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     7
  |
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     8
  | o  3:6100d3090acf
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     9
  |/
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    10
  | o  2:fa942426a6fd
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    11
  |/
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    12
  | o  1:66f7d451a68b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    13
  |/
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    14
  o  0:1ea73414a91b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    15
  
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    16
  $ hg --config extensions.closehead= close-head -m 'Not a head' 0 1
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    17
  abort: revision is not an open head: 0
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    18
  [255]
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    19
  $ hg --config extensions.closehead= close-head -m 'Not a head' -r 0 1
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    20
  abort: revision is not an open head: 0
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    21
  [255]
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    22
  $ hg --config extensions.closehead= close-head -m 'Close old heads' -r 1 2
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    23
  $ hg bookmark
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    24
     @                         1:66f7d451a68b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    25
  $ hg heads
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    26
  changeset:   4:e7bd5218ca15
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    27
  parent:      0:1ea73414a91b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    28
  user:        debugbuilddag
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    29
  date:        Thu Jan 01 00:00:04 1970 +0000
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    30
  summary:     r4
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    31
  
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    32
  changeset:   3:6100d3090acf
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    33
  parent:      0:1ea73414a91b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    34
  user:        debugbuilddag
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    35
  date:        Thu Jan 01 00:00:03 1970 +0000
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    36
  summary:     r3
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    37
  
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    38
  $ hg --config extensions.closehead= close-head -m 'Close more old heads' 4
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    39
  $ hg heads
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    40
  changeset:   3:6100d3090acf
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    41
  parent:      0:1ea73414a91b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    42
  user:        debugbuilddag
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    43
  date:        Thu Jan 01 00:00:03 1970 +0000
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    44
  summary:     r3
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    45
  
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    46
  $ hg --config extensions.closehead= close-head -m 'Not a head' 0
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    47
  abort: revision is not an open head: 0
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    48
  [255]
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    49
  $ hg --config extensions.closehead= close-head -m 'Already closed head' 1
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    50
  abort: revision is not an open head: 1
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    51
  [255]
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    52
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    53
  $ hg init ../test-empty
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    54
  $ cd ../test-empty
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    55
  $ hg debugbuilddag '+1'
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    56
  $ hg log -G --template '{rev}:{node|short}'
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    57
  o  0:1ea73414a91b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    58
  
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    59
  $ hg --config extensions.closehead= close-head -m 'Close initial revision' 0
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    60
  $ hg heads
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    61
  [1]