tests/test-close-head.t
author Gregory Szorc <gregory.szorc@gmail.com>
Mon, 10 Dec 2018 18:04:12 +0000
changeset 40923 3ed77780f4a6
parent 40096 12a72729678e
child 42294 c51b103220c7
permissions -rw-r--r--
wireprotov2: send linknodes to emitfilerevisions() Previously, linknodes were calculated within emitfilerevisions() by using filectx.introrev(), which would always use the linkrev/linknode as recorded by storage. This is wrong for cases where the receiver doesn't have the changeset the linknode refers to. This commit changes the logic for linknode emission so the mapping of filenode to linknode is computed by the caller and passed into emitfilerevisions(). As part of the change, linknodes for "filesdata" in the haveparents=False case are now correct: the existing code performed a manifest walk and it was trivial to plug in the correct linknode. However, behavior for the haveparents=True case is still wrong because it relies on filtering linkrevs against the outgoing set in order to determine what to send. This will be fixed in a subsequent commit. The change test test-wireproto-exchangev2-shallow.t is a bit wonky. The test repo has 6 revisions. The changed test is performing a shallow clone with depth=1. So, only file data for revision 5 is present locally. So, the new behavior of associating the linknode with revision 5 for every file revision seems correct. Of course, when backfilling old revisions, we'll want to update the linknode. But this problem requires wire protocol support and we'll cross that bridge later. Differential Revision: https://phab.mercurial-scm.org/D5405
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]