tests/test-close-head.t
author Pulkit Goyal <pulkit@yandex-team.ru>
Sat, 27 Apr 2019 14:43:43 +0300
changeset 42216 d0e773ad9077
parent 40096 12a72729678e
child 42294 c51b103220c7
permissions -rw-r--r--
discovery: only calculate closed branches if required The number of new closed branches is required for printing in error message. So let's only calculate them if we need to print error about new branches. Differential Revision: https://phab.mercurial-scm.org/D6314
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
40096
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
     3
  $ hg debugbuilddag '+2*2*3*4+7'
39993
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}'
40096
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
     6
  o  11:1d876b1f862c
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
     7
  |
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
     8
  o  10:ea5f71948eb8
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
     9
  |
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    10
  o  9:f1b0356d867a
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    11
  |
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    12
  o  8:e8d1253fb0d7
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    13
  |
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    14
  o  7:d423bbba4459
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    15
  |
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    16
  o  6:a2f58e9c1e56
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    17
  |
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    18
  o  5:3a367db1fabc
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    19
  |
39993
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    20
  o  4:e7bd5218ca15
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    21
  |
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    22
  | o  3:6100d3090acf
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    23
  |/
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    24
  | o  2:fa942426a6fd
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    25
  |/
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    26
  | o  1:66f7d451a68b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    27
  |/
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    28
  o  0:1ea73414a91b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    29
  
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    30
  $ 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
    31
  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
    32
  [255]
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    33
  $ 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
    34
  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
    35
  [255]
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    36
  $ 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
    37
  $ hg bookmark
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    38
     @                         1:66f7d451a68b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    39
  $ hg heads
40096
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    40
  changeset:   11:1d876b1f862c
39993
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    41
  user:        debugbuilddag
40096
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    42
  date:        Thu Jan 01 00:00:11 1970 +0000
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    43
  summary:     r11
39993
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    44
  
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    45
  changeset:   3:6100d3090acf
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    46
  parent:      0:1ea73414a91b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    47
  user:        debugbuilddag
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    48
  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
    49
  summary:     r3
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    50
  
40096
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    51
  $ hg --config extensions.closehead= close-head -m 'Close more old heads' -r 11
39993
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    52
  $ hg heads
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    53
  changeset:   3:6100d3090acf
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    54
  parent:      0:1ea73414a91b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    55
  user:        debugbuilddag
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    56
  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
    57
  summary:     r3
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 'Not a head' 0
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    60
  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
    61
  [255]
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    62
  $ 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
    63
  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
    64
  [255]
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    65
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    66
  $ hg init ../test-empty
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    67
  $ cd ../test-empty
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    68
  $ hg debugbuilddag '+1'
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    69
  $ hg log -G --template '{rev}:{node|short}'
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    70
  o  0:1ea73414a91b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    71
  
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    72
  $ 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
    73
  $ hg heads
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    74
  [1]