Mercurial > hg
diff tests/test-copies.t @ 42406:f385ba70e4af
changelog: optionally store added and removed files in changeset extras
As mentioned in an earlier patch, copies._chain() is used a lot in the
changeset-centric version of pathcopies(). It is expensive because it
needs to look at the manifest in order to filter out copies whose
target file has since been removed. I want to store the sets of added
and removed files in the changeset in order to speed that up. This
patch does the writing part of that. It could easily be a separate
config, but it's currently tied to experimental.copies.write-to since
that's the only real use case (it will also make the {file_*} template
keywords faster, but I doubt that anyone cares enough about those to
write extra metadata for them).
The new information is stored in the changeset extras. Since they're
always subsets of the changeset's "files" list, they're stored as
indexes into that list. I've stored the indexes as stringified ints
separated by NUL bytes. The size of 00changelog.d for the hg repo
increased in size by 0.28% percent (compared to the size with only
copy information in the changesets, which in turn is 0.17% larger than
without copy information). We could store only the delta between the
indexes and we could store them in binary, but the chosen format is
more readable.
We could also have implemented this as a cache outside the
changelog. One advantage of doing it that way is that we would get the
speedups from the {file_*} template keywords also on old
repos. Another advantage is that it we can rewrite the cache if we
find a bug in how we calculate the set of files. A disadvantage is
that it would be more complex. Another is that it would surely use
more space. We already write the copy information to the changeset
extras, so it seems like a small step to also write these file sets.
Differential Revision: https://phab.mercurial-scm.org/D6416
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 14 May 2019 22:19:51 -0700 |
parents | cbff7f996dc4 |
children | a1f87294471f |
line wrap: on
line diff
--- a/tests/test-copies.t Thu Apr 18 13:35:02 2019 -0700 +++ b/tests/test-copies.t Tue May 14 22:19:51 2019 -0700 @@ -551,14 +551,15 @@ $ hg up 2 -q $ hg graft -r 4 --base 3 --hidden - grafting 4:af28412ec03c "added d, modified b" (tip) + grafting 4:af28412ec03c "added d, modified b" (tip) (no-changeset !) + grafting 4:6325ca0b7a1c "added d, modified b" (tip) (changeset !) merging b1 and b to b1 $ hg l -l1 -p @ 5 added d, modified b | b1 ~ diff -r 5a4825cc2926 -r 94a2f1a0e8e2 b1 (no-changeset !) - ~ diff -r f5474f5023a8 -r ef7c02d69f3d b1 (changeset !) + ~ diff -r df722b7fe2d5 -r ba3ddbbdfd96 b1 (changeset !) --- a/b1 Thu Jan 01 00:00:00 1970 +0000 +++ b/b1 Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +1,2 @@ @@ -618,7 +619,8 @@ a $ hg rebase -r . -d 2 -t :other - rebasing 5:5018b1509e94 "added willconflict and d" (tip) + rebasing 5:5018b1509e94 "added willconflict and d" (tip) (no-changeset !) + rebasing 5:619047c26bf8 "added willconflict and d" (tip) (changeset !) $ hg up 3 -q $ hg l --hidden @@ -641,4 +643,5 @@ neither of the merging csets will be a descendant of the base revision: $ hg graft -r 6 --base 4 --hidden -t :other - grafting 6:99802e4f1e46 "added willconflict and d" (tip) + grafting 6:99802e4f1e46 "added willconflict and d" (tip) (no-changeset !) + grafting 6:9ddc6fb3b691 "added willconflict and d" (tip) (changeset !)