There's a certain kind of sharing I think we could do in the
repository, but I don't know if we are doing it or not.
In the following examples, "X:PATH" means PATH is it exists in
Assume that 7:A/B/foo.c is one "trunk" revision of foo.c. It gets
branched, so now there's 8:Q/R/W/foo.c, whose contents are the same as
7:A/B/foo.c. In the repository, these two directory entries are
pointing to the same node revision -- the storage is shared.
(I realize "trunk" and "branch" are arbitrary labels; I'm just using
them for convenience later on.)
Now someone modifies and commits their up-to-date copy of A/B/foo.c,
resulting in 9:A/B/foo.c. In the repository, 9:A/B/foo.c will be a
node revision storing the full text of foo.c, and 7:A/B/foo.c will
become a delta against 9:A/B/foo.c (call this "delta D"). Also in the
repository, 9:Q/R/W/foo.c still points at the node revision for
7:A/B/foo.c, which is fine, because its full text can be computed
against 9:A/B/foo.c when needed.
Next, someone with an up-to-date copy of Q/R/W/foo.c merges in the
trunk change -- that is, they patch Q/R/W/foo.c with the difference
between 7:A/B/foo.c and 9:A/B/foo.c. Let me hand-wave here and state
that this merge was done in some ancestry-sensitive way, so that the
repository is quite aware the merge sources share ancestry with the
Now, in the repository, 10:Q/R/W/foo.c is a new full-text exactly the
same as 10:A/B/foo.c, and 9:Q/R/W/foo.c is a forward-delta exactly the
same as our old friend, delta D.
So are we storing the same full text twice, and the same diff twice?
Or are diffs and texts stored in their own tables, and mentioned only
by reference from node revisions?
(Obviously, I'm ignoring the case where the target of the merge has
been modified since it branched off the common ancestor; in that case,
the the fulltexts and forward-deltas would be different. I don't know
if any sharing could be done then. However, sometimes merges make
exactly the same changes, to exactly the same file contents, as were
made in the merge source, and in those cases we could do sharing. Are
Received on Sat Oct 21 14:36:16 2006