annotate tests/test-close-head.t @ 46846:2819df466cae

tests: add test-remotefilelog-strip.t to demonstrate an issue with linknodes ### Background Every time a commit is modified, remotefilelog updates the metadata for the file object to point to the new commit (I believe that this is different from non-remotefilelog hg, which leaves the linkrevs pointing to the obsolete commits; doing otherwise would involve changing data in the middle of revlogs). With `hg strip` (or other things that use repair.strip()), when you strip a commit that's not the tip of the revlog, there may be commits after it in revnum order that aren't descended from it and don't need to be (and shouldn't be) stripped. These are "saved" by strip in a bundle, and that bundle is reapplied after truncating the relevant revlogs. ### The problem Remotefilelog generally avoids being involved at all in strip. Currently, that includes even providing file contents to this backup bundle. This can cause the linknode to point to a changeset that is no longer in the repository. Example: ``` @ 3 df91f74b871e | | x 2 70494d7ec5ef |/ | x 1 1e423846dde0 |/ o 0 b292c1e3311f ``` Commits 1, 2, and 3 are related via obsolescence, and are description-only changes. The linknode for the file in these commits changed each time we updated the description, so it's currently df91f7. If I strip commits 1 and 3, however, the linknode *remains* df91f7, which no longer exists in the repository. Commit 70494d was "saved", stripped, and then reapplied, so it is in the repository (as revision 1 instead of 2 now), and was unobsoleted since the obsmarker was stripped as well. The linknode for the file should point to 70494d, the most recent commit that is in the repository that modified the file. Remotefilelog has some logic to handle broken linknodes, but it can be slow. We have actually disabled it internally because it's too slow for our purposes. Differential Revision: https://phab.mercurial-scm.org/D10319
author Kyle Lippincott <spectral@google.com>
date Tue, 06 Apr 2021 15:38:33 -0700
parents fdd4d668ceb5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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]
42294
c51b103220c7 tests: demonstrate that close-head command updates working copy
Martin von Zweigbergk <martinvonz@google.com>
parents: 40096
diff changeset
36 $ hg id
c51b103220c7 tests: demonstrate that close-head command updates working copy
Martin von Zweigbergk <martinvonz@google.com>
parents: 40096
diff changeset
37 000000000000
39993
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 old heads' -r 1 2
42294
c51b103220c7 tests: demonstrate that close-head command updates working copy
Martin von Zweigbergk <martinvonz@google.com>
parents: 40096
diff changeset
39 $ hg id
42295
fdd4d668ceb5 context: move contents of committablectx.markcommitted() to workingctx
Martin von Zweigbergk <martinvonz@google.com>
parents: 42294
diff changeset
40 000000000000
39993
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
41 $ hg bookmark
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
42 @ 1:66f7d451a68b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
43 $ hg heads
40096
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
44 changeset: 11:1d876b1f862c
39993
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
45 user: debugbuilddag
40096
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
46 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
47 summary: r11
39993
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
48
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
49 changeset: 3:6100d3090acf
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
50 parent: 0:1ea73414a91b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
51 user: debugbuilddag
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
52 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
53 summary: r3
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
54
40096
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
55 $ 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
56 $ hg heads
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
57 changeset: 3:6100d3090acf
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
58 parent: 0:1ea73414a91b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
59 user: debugbuilddag
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
60 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
61 summary: r3
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
62
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
63 $ 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
64 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
65 [255]
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
66 $ 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
67 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
68 [255]
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
69
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
70 $ hg init ../test-empty
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
71 $ cd ../test-empty
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
72 $ hg debugbuilddag '+1'
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
73 $ hg log -G --template '{rev}:{node|short}'
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
74 o 0:1ea73414a91b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
75
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
76 $ 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
77 $ hg heads
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
78 [1]