[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

text and diff sharing in the repository

From: Karl Fogel <kfogel_at_galois.collab.net>
Date: 2000-12-08 00:20:26 CET

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
revision X.

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
target.

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
we, though?)

-Karl
Received on Sat Oct 21 14:36:16 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.