You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Ben Collins-Sussman <su...@collab.net> on 2002/01/23 23:37:58 UTC
merging and switching
At this point, I'm sure everyone saw the power-plant that was just
checked into notes. Karl is going to add some further thoughts.
Everybody take your time to digest that doc. :-)
But to start some conversation (assuming you've *read* the doc first),
here are a couple of questions on the table:
1. In order to do a merge, the client must create two sets of
fulltexts in some temporary area. It then makes context diffs
between the fulltexts, and applies the diffs to your working
copy as local mods. We've talked about just asking for the 2
sets of fulltexts directly; we've also talked about doing fancy
things to make the 2 sets of fulltexts "materialize" via binary
diffs over the wire.
Given how rarely merges occur, is it worth jumping through hoops
to reconstruct the fulltexts? Maybe it's just simpler to have
the client grab the fulltexts directly. What do people think?
2. Last night Karl realized that we could just run
'svn diff -r X:Y URL'
and apply the context diffs right to our wc! In other words,
Philip's fancy new diff-editor is already doing what we want.
Cmpilato points out, however, that a *true* merge should be able
to generate context diffs between any 2 arbitrary urls, which
Philip's system can't yet do. Kfogel counters with the notion
that for 99% of all merges, the two urls are identical anyway.
So, what method to use? And, do we need to stay flexible and
accept 2 different urls?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: merging and switching
Posted by Scott Lenser <sl...@gs104.sp.cs.cmu.edu>.
> Given how rarely merges occur, is it worth jumping through hoops
> to reconstruct the fulltexts? Maybe it's just simpler to have
> the client grab the fulltexts directly. What do people think?
>
I don't think merges are all that rare of an event, or at least won't be
after not having to jump through the hoops that CVS makes you go through.
Consider a project consisting of several modules each with a team of people
working on the module. The teams all work on branches so that they can check
in code that is still buggy and get help from the other members of the module
team. The modules are tightly interrelated such that the API between modules
changes frequently. Then each module team needs to frequently merge changes
from the other modules in when they need new features and they may not be able
to simply commit a new version to the trunk if they are in the middle of
changes. I've seen development that worked something like this done to produce
VLSI CAD software for automated layout (the different parts of the problem
interact heavily but can be factored into modules enough to be useful).
Since CVS was being used, the way this was done at the time was through people
manually copying changes from working copy to working copy to share within a
team and checking in working stuff to the trunk. Branches would have provided
a much cleaner model and merges would have been common.
Just my 2 cents.
- Scott Lenser
PS: Thanks for producing a replacement for the heinousness of CVS! I look
forward to using it.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: merging and switching
Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On Thu, Jan 24, 2002 at 01:54:11PM -0600, Jay Freeman (saurik) wrote:
> I branch the main line of Optasia away from the code that Jake and Tony are
> working on so I can get ATI Radeon 8500 support in without destroying what
> they are doing. I branch from an existing tag. I figure to do this I'm
> doing:
>
> svn cp http://svn.ninetjer.org/svn/optasia/tags/optasia-gdc_2001
> http://svn.ninetjer.org/svn/optasia/branches/optasia-radeon_8500
>
> (please god all mighty don't tell me I need to check out either repository
> to do this...)
don't worry, that can all be done from outside a working copy (that's
how the recent tag was laid down for 0.8, the one that sent us all 8
meg emails ;-) )
> OK, so now Jake is working on the next major milestone (the E3 game demo).
> Let's say he finishes that (dedicated worker he is), but I've been spending
> so much time fighting with our old CVS repository that I'm _still_ working
> on Radeon support. So, I want to do the following merge to get the new
> updates to my working copy:
>
> svn merge http://svn.ninetjer.org/svn/optasia/tags/optasia-gdc_2001
> http://svn.ninetjer.org/svn/optasia/tags/optasia-e3_2001
i can see why one would want to do this (easier to think it terms of
tags than revs), but if you know the revision that was tagged as
optasia-e3_2001, you could just do:
svn merge http://svn.ninetjer.org/svn/optasia/trunk -r 100:200
(assuming 100 is when you branched from trunk, and 200 is when
optasia-e3_2001 was tagged)
that would be the same thing, right?
perhaps we just need to provide an easy way to get that revision
number...
(part of my problem here is that i am used to thinking in revisions,
not in branches and tags, so perhaps we should be doing more for those
people out there who are used to branches and tags.)
-garrett
--
garrett rooney Unix was not designed to stop you from
rooneg@electricjellyfish.net doing stupid things, because that would
http://electricjellyfish.net/ stop you from doing clever things.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: merging and switching
Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Yep, yep -- "svn merge" needs to be able to take two distinct paths.
I stand [well, sit] corrected, thanks for the quick responses.
-K
"Jay Freeman \(saurik\)" <sa...@saurik.com> writes:
> Subversion's architecture shoots itself in the foot here. Because there is
> no difference between a "branch" and a "tag", I can rewrite your sentence
> like this:
>
> "well, as i said on IRC earlier, i can't come up with a use case that would
> involve diffing two different _tags_ and applying the results to a third."
>
> Well, I sure can :).
>
> I branch the main line of Optasia away from the code that Jake and Tony are
> working on so I can get ATI Radeon 8500 support in without destroying what
> they are doing. I branch from an existing tag. I figure to do this I'm
> doing:
>
> svn cp http://svn.ninetjer.org/svn/optasia/tags/optasia-gdc_2001
> http://svn.ninetjer.org/svn/optasia/branches/optasia-radeon_8500
>
> (please god all mighty don't tell me I need to check out either repository
> to do this...)
>
> OK, so now Jake is working on the next major milestone (the E3 game demo).
> Let's say he finishes that (dedicated worker he is), but I've been spending
> so much time fighting with our old CVS repository that I'm _still_ working
> on Radeon support. So, I want to do the following merge to get the new
> updates to my working copy:
>
> svn merge http://svn.ninetjer.org/svn/optasia/tags/optasia-gdc_2001
> http://svn.ninetjer.org/svn/optasia/tags/optasia-e3_2001
>
> I figure merging diffs between two tags will be the 99% case, diffing
> between arbitrary revisions sounds like something only a developer who is
> really pissed off is going to do (as in my description of that scenario a
> week or two ago).
>
> Sincerely,
> Jay Freeman (saurik)
> saurik@saurik.com
>
> ----- Original Message -----
> From: "Garrett Rooney" <ro...@electricjellyfish.net>
> To: "Ben Collins-Sussman" <su...@collab.net>
> Cc: "SVN Dev List" <de...@subversion.tigris.org>
> Sent: Wednesday, January 23, 2002 7:15 PM
> Subject: Re: merging and switching
>
>
> > On Wed, Jan 23, 2002 at 05:37:58PM -0600, Ben Collins-Sussman wrote:
> > > So, what method to use? And, do we need to stay flexible and
> > > accept 2 different urls?
> >
> > well, as i said on IRC earlier, i can't come up with a use case that
> > would involve diffing two different branches and applying the results
> > to a third. it seems like two of the three things involved would just
> > be different revs of the same branch, and you'd be applying the
> > difference between them to another branch. (apply the difference
> > between rev 6 and 7 of branch foo to the trunk, since we fixed a bug
> > in that commit that still exists in the truck...)
> >
> > even if we can come up with a use case for this, we should ask
> > ourselves 'how common is this', and 'how hard will it be to write'.
> > if it'll be difficult and not commonly used, then i don't see why we
> > shouldn't put it off until after 1.0.
> >
> ...
> >
> > looking forward to hearing everyone else's opinions on the matter,
> >
> > -garrett
> >
> > --
> > garrett rooney Unix was not designed to stop you from
> > rooneg@electricjellyfish.net doing stupid things, because that would
> > http://electricjellyfish.net/ stop you from doing clever things.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: merging and switching
Posted by "Jay Freeman (saurik)" <sa...@saurik.com>.
Garrett:
Subversion's architecture shoots itself in the foot here. Because there is
no difference between a "branch" and a "tag", I can rewrite your sentence
like this:
"well, as i said on IRC earlier, i can't come up with a use case that would
involve diffing two different _tags_ and applying the results to a third."
Well, I sure can :).
I branch the main line of Optasia away from the code that Jake and Tony are
working on so I can get ATI Radeon 8500 support in without destroying what
they are doing. I branch from an existing tag. I figure to do this I'm
doing:
svn cp http://svn.ninetjer.org/svn/optasia/tags/optasia-gdc_2001
http://svn.ninetjer.org/svn/optasia/branches/optasia-radeon_8500
(please god all mighty don't tell me I need to check out either repository
to do this...)
OK, so now Jake is working on the next major milestone (the E3 game demo).
Let's say he finishes that (dedicated worker he is), but I've been spending
so much time fighting with our old CVS repository that I'm _still_ working
on Radeon support. So, I want to do the following merge to get the new
updates to my working copy:
svn merge http://svn.ninetjer.org/svn/optasia/tags/optasia-gdc_2001
http://svn.ninetjer.org/svn/optasia/tags/optasia-e3_2001
I figure merging diffs between two tags will be the 99% case, diffing
between arbitrary revisions sounds like something only a developer who is
really pissed off is going to do (as in my description of that scenario a
week or two ago).
Sincerely,
Jay Freeman (saurik)
saurik@saurik.com
----- Original Message -----
From: "Garrett Rooney" <ro...@electricjellyfish.net>
To: "Ben Collins-Sussman" <su...@collab.net>
Cc: "SVN Dev List" <de...@subversion.tigris.org>
Sent: Wednesday, January 23, 2002 7:15 PM
Subject: Re: merging and switching
> On Wed, Jan 23, 2002 at 05:37:58PM -0600, Ben Collins-Sussman wrote:
> > So, what method to use? And, do we need to stay flexible and
> > accept 2 different urls?
>
> well, as i said on IRC earlier, i can't come up with a use case that
> would involve diffing two different branches and applying the results
> to a third. it seems like two of the three things involved would just
> be different revs of the same branch, and you'd be applying the
> difference between them to another branch. (apply the difference
> between rev 6 and 7 of branch foo to the trunk, since we fixed a bug
> in that commit that still exists in the truck...)
>
> even if we can come up with a use case for this, we should ask
> ourselves 'how common is this', and 'how hard will it be to write'.
> if it'll be difficult and not commonly used, then i don't see why we
> shouldn't put it off until after 1.0.
>
...
>
> looking forward to hearing everyone else's opinions on the matter,
>
> -garrett
>
> --
> garrett rooney Unix was not designed to stop you from
> rooneg@electricjellyfish.net doing stupid things, because that would
> http://electricjellyfish.net/ stop you from doing clever things.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: merging and switching
Posted by John P Cavanaugh <ca...@soco.agilent.com>.
On Wed, Jan 23, 2002 at 08:15:44PM -0500, Garrett Rooney wrote:
> On Wed, Jan 23, 2002 at 05:37:58PM -0600, Ben Collins-Sussman wrote:
> > So, what method to use? And, do we need to stay flexible and
> > accept 2 different urls?
>
> well, as i said on IRC earlier, i can't come up with a use case that
> would involve diffing two different branches and applying the results
> to a third. it seems like two of the three things involved would just
> be different revs of the same branch, and you'd be applying the
> difference between them to another branch. (apply the difference
> between rev 6 and 7 of branch foo to the trunk, since we fixed a bug
> in that commit that still exists in the truck...)
I havent been following this thread closely, but we might want to
resurrect the discussion on change sets (sometimes referred to as change
packages) as I believe they might just utilize a use-case as described
above.
-----------------------------------------------------------------------
John Cavanaugh Agilent Technologies
R&D Program Manager 1400 Fountaingrove Pkwy
Wireless Network Solutions Santa Rosa, CA 95403-1799
Email: cavanaug@soco.agilent.com Phone: 707-577-4780
707-577-3948 (Fax)
-----------------------------------------------------------------------
When schemes are laid in advance, it is surprising
how often the circumstances fit in with them.
-- William Osler
-----------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: merging and switching
Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On Wed, Jan 23, 2002 at 05:37:58PM -0600, Ben Collins-Sussman wrote:
> So, what method to use? And, do we need to stay flexible and
> accept 2 different urls?
well, as i said on IRC earlier, i can't come up with a use case that
would involve diffing two different branches and applying the results
to a third. it seems like two of the three things involved would just
be different revs of the same branch, and you'd be applying the
difference between them to another branch. (apply the difference
between rev 6 and 7 of branch foo to the trunk, since we fixed a bug
in that commit that still exists in the truck...)
even if we can come up with a use case for this, we should ask
ourselves 'how common is this', and 'how hard will it be to write'.
if it'll be difficult and not commonly used, then i don't see why we
shouldn't put it off until after 1.0.
as for the 'retrieve the full files and diff them' versus the more
complicated 'play tricks with diffs off our present wc to generate the
two versions to diff', it feels more right to take the second,
possibly more complicated route, since we've been trying to design for
low bandwidth where possible, and the brute force 'grab full text of
both files' approach just seems wrong. it's just a gut feeling
though, and since i'm not going to be writing this code, i really
don't have much say in how you do it.
looking forward to hearing everyone else's opinions on the matter,
-garrett
--
garrett rooney Unix was not designed to stop you from
rooneg@electricjellyfish.net doing stupid things, because that would
http://electricjellyfish.net/ stop you from doing clever things.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: merging and switching
Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Greg Hudson <gh...@MIT.EDU> writes:
> People like to use names, not numbers.
>
> Because you're forgetting this rule, you're copying command syntaxes
> from CVS without accounting for the fact that in CVS, you can use branch
> and tag names for version numbers, whereas in Subversion you have to use
> paths.
>
> So, not only does merge need to handle two different URLs, so does
> diff. I pointed this out in
> http://subversion.tigris.org/servlets/ReadMsg?msgId=41945&listName=dev
> but, even though Karl answered in the positive and appeared to
> understand, I think my argument got lost in the noise.
+1 (I just forgot about that fact, thanks Greg)
In any case, the essential observation remains the same: we're doing
the same work for "svn diff" that we're doing for "svn merge", and
there will be a *lot* of duplicated code unless we take care to factor
them.
For example, Ben's question about whether we should just grab two
fulltexts to do merge, or do some fancy svndiffing to produce the
fulltexts on the client side... Whatever the answer is, there's no
reason for it to be one way for `diff' and another way for `merge'.
It's the same problem.
-K
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: merging and switching
Posted by Greg Hudson <gh...@MIT.EDU>.
On Wed, 2002-01-23 at 18:37, Ben Collins-Sussman wrote:
> Given how rarely merges occur, is it worth jumping through hoops
> to reconstruct the fulltexts? Maybe it's just simpler to have
> the client grab the fulltexts directly. What do people think?
Implement it both ways and see if the faster way took too much effort.
:) Seriously, I think this should be left up to the person doing the
work. If that person does it the slow way and someone thinks it should
be faster, then get that person to redo it the fast way.
> and apply the context diffs right to our wc! In other words,
> Philip's fancy new diff-editor is already doing what we want.
> Cmpilato points out, however, that a *true* merge should be able
> to generate context diffs between any 2 arbitrary urls, which
> Philip's system can't yet do. Kfogel counters with the notion
> that for 99% of all merges, the two urls are identical anyway.
As far as I can tell, you guys are forgetting a golden rule of
usability:
People like to use names, not numbers.
Because you're forgetting this rule, you're copying command syntaxes
from CVS without accounting for the fact that in CVS, you can use branch
and tag names for version numbers, whereas in Subversion you have to use
paths.
So, not only does merge need to handle two different URLs, so does
diff. I pointed this out in
http://subversion.tigris.org/servlets/ReadMsg?msgId=41945&listName=dev
but, even though Karl answered in the positive and appeared to
understand, I think my argument got lost in the noise.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: merging and switching
Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On Wed, Jan 23, 2002 at 07:30:05PM -0800, Zack Weinberg wrote:
> On Wed, Jan 23, 2002 at 09:16:55PM -0600, Ben Collins-Sussman wrote:
> > It worked for me 20 minutes ago. I tested the link myself.
> > Oh lookee. Our nightly Berkeley DB freeze.
> > OK, ran db_recover again, took 18 minutes. Should be all fixed.
>
> I'm still getting the error. Here's more detail:
yeah, this is just giving me errors like this when i try to update:
rooneg@quicksilver:~/svn> svn up
apr_error: #20014, src_err 0 : <Error string not specified yet>
The REPORT status was 500, but expected 200.
rooneg@quicksilver:~/svn>
this isn't the usual 'repository is hung' response, unless something
has changed on the server since yesterday.
-garrett
--
garrett rooney Unix was not designed to stop you from
rooneg@electricjellyfish.net doing stupid things, because that would
http://electricjellyfish.net/ stop you from doing clever things.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: merging and switching
Posted by Ben Collins-Sussman <su...@collab.net>.
Zack Weinberg <za...@codesourcery.com> writes:
> On Wed, Jan 23, 2002 at 09:16:55PM -0600, Ben Collins-Sussman wrote:
> > It worked for me 20 minutes ago. I tested the link myself.
> > Oh lookee. Our nightly Berkeley DB freeze.
> > OK, ran db_recover again, took 18 minutes. Should be all fixed.
>
> I'm still getting the error. Here's more detail:
What the *heck*?!? I just fixed the db not five minutes ago and
re-tested the link, and now it's broken again.
Hmmmm, here's a clue: 'ps ax' reveals some script trying to run
db_archive out of /usr/local/BerkeleyDB3.3/ !! Wait, looking at our
post-commit backup script... I see that the path is hard-coded into
the tools script. Oh jeez. I wonder if this was the problem.
Sorry to delay you, Zack. Here's a copy of the doc while we work out
the server bugs:
----------------------------------------------------------------------
SUBVERSION "MERGE" and "SWITCH" FEATURES
Slated for 0.9 (M9)
1st draft writ by Karl & Ben,
after much discussion with CMike & Greg.
This is primarily a description of the semantics of merge and switch,
that is, Subversion's user-visible behavior in these operations. It
also discusses some implementation issues.
Definitions:
* Merging is like "cvs update -j -j". I.e., take the difference
between two trees in the repository, and apply it diffily to the
working copy.
* Switching means to switch the working copy from one line of
development over to another, like "cvs update -r <TAG|BRANCH>".
Of course, Subversion doesn't really have the concept of lines
of development, it just has copies. But if a working directory
is based on repository tree T, and you "switch" it to be based on
repository tree S, where T and S are similar (related) in some
way, that's effectively the same as what CVS does.
The General Theory of Updating, Merging, and Switching
======================================================
Updating, merging, and switching are all very similar operations; each
command is a request to have the server modify the working copy in
some way. Each of these subcommands begins with the client describing
the "state" of the working copy to the server, and ends with the
server comparing trees and sending back tree-delta(s) to the client.
Here's the easiest way to understand the three operations: assume that
X:PATH1 and Y:PATH2 are paths within two repository revisions X and Y,
which are possibly the same revision. The server compares the X:PATH1
and Y:PATH2 and sends the difference to the client.
* In an update, PATH1 == PATH2 always, and after the tree-delta is
applied, the working copy metadata is changed (specifically,
revisions are bumped.)
* In a merge, PATH1 does not necessarily equal PATH2, and we don't
touch metadata (except maybe for "genetic" merging properties
someday). In other words, the applied changes end up looking like
local modifications.
* In a switch, PATH1 does not necessarily equal PATH2, and we *do*
rewrite the working copy metadata (specifically, revisions are
bumped and URLs are changed).
When doing a merge or switch, the user needs to specify at least one
of the two paths. There's a risk that the requested path may be
completely unrelated to the path represented by the working copy --
and thus might result in seemingly random diffs and conflicts
everywhere (or in the worst case, a complete deletion and re-checkout
of the working copy!) Our plan is to add a heuristic to Subversion
that asks the question "are these two paths related in some way?" If
the test fails, the command aborts and the user receives a friendly
message: "PATH1 and PATH2 have no common ancestry. Are you *sure*
you want to apply this delta? If so, re-run the command with the
--force option."
Merging
=======
Merge is a special case of update, or rather, update is a special case
of merge. Simplifying things a bit: when we update, we take the
differences between path P at revision X versus P at revision Y, and
apply that difference to the working copy. Note that since P:X
reflects the working copy text bases exactly, the server can send
contextless diffs to bring the working copy to P:Y. (The
simplification here is that P:X is really a transaction reflecting the
working copy's revision mixture, and not necessarily corresponding
precisely to any single revision tree).
When we merge, we take the differences between path P at revision X
(X:P) versus path Q at revision Y (Y:Q), and apply them to the working
copy.
Thus, what distinguishes a merge from an update is that P != Q (is
there a symbol for "need not equal"? Maybe "P ?= Q"...) For that
matter, X ?= Y.
X:P and Y:Q are two distinct trees, but in practice, they share a
common ancestor, so using the difference between them is not a
ridiculous idea. But note that svn_repos_dir_delta() is perfectly
content to express the difference between any two trees, related or
not.
It is possible, indeed likely, that neither P:X nor Q:Y are an exact
reflection of the working copy bases, therefore context diffs are used
to facilitate merging.
*** Implementation details ***
And as a rule, only the Subversion client generates context diffs and
applies them (right now by running 'diff' and 'patch' externally.)
Therefore, the objective is to create *two* sets of fulltext files in
some client-side temporary area. The first fulltext set represents
X:P, and the second fulltext set represents Y:Q. The client then
compares the two sets, generates context diffs, and applies the
context diffs to the working copy's working files.
The naive approach would be to just directly ask the server for both
sets of fulltexts. (We still consider this an option!)
A more complex approach (which we'll attempt) is a network
optimization -- it's a way of creating both sets of fulltexts on the
client using minimal network traffic:
* The client builds a transaction on the server that is a
"reflection" of the working-copy, mixed revisions and all.
* The server sends a tree-delta between the reflection and X:P; the
client then applies these binary diffs to copies of the
working-copy's text-bases in order to reconstruct the fulltexts
of X:P.
* The server sends a tree-delta between X:P and Y:Q; the client
then applies these binary diffs to copies of the X:P fulltexts in
order to reconstruct the fulltexts of Y:Q.
And that's it! We have both sets of fulltexts. The client generates
context diffs between them and patches the working copy.
As mentioned earlier, this process doesn't touch any working-copy
metadata in .svn/. Only the working files are patched, so the
differences appear as local modifications. At that point, the user
manually resolves any conflicts.
Switching
=========
Switching is a more general case of update: instead of comparing the
working-copy "reflection" to an identical path in some revision, the
server compares the reflection to some *arbitrary* path in some
revision. The user specifies the new path.
The result of the operation is to effectively morph the working copy
into representing a different location in the tree. In theory, there
should be no way to tell the difference between a fresh checkout of
PATH2 and a working copy that was "switched" to PATH2.
*** Implementation details ***
As in update operations, the client begins by building a reflection of
working-copy state on the server. The client then specifies a new
path/revision pair as the target of the tree-delta.
After the client finishes applying the delta, it needs to do a little
more work than update: besides bumping all working revisions to some
uniform value, it needs to rewrite all of the metadata URL ancestry as
well.
-----------------------------------------------------------------------
Interactions: A Brave New World
================================
With the `svn switch' feature, we now have the potential to have
working copies with "disjoint" subdirs, that is, subdirs whose
repository url is not simply the subdir's parent's url plus the
subdir's entry name in the parent. For example:
$ svn checkout http://svn.collab.net/repos/trunk -d svn
A ...
A svn/subversion/libsvn_wc
A svn/subversion/libsvn_fs
A svn/subversion/libsvn_repos
A svn/subversion/libsvn_delta
A ...
$ cd svn/subversion/libsvn_fs
$ svn switch http://svn.collab.net/repos/branches/blue/subversion/libsvn_fs
[...]
$
While svn/subversion/.svn/entries still has an entry for "libsvn_fs",
if you go into libsvn_fs and look at its own directory url, it is not
simply a child of the `subversion' directory url, but rather a
completely different url. We call this directory "disjoint".
Commits, updates, merges, and further switch commands all need to deal
sanely with this scenario.
We can assume that even disjoint urls are still all within the same
repository, because the parent of a disjoint child still has an entry
for that child, and all working copy walks are guided by entries. In
cases where there are wc subdirs from completely different
repositories, there is unlikely to be such entry linkage. [NOTE: We
will still be adding some extra information to the wc to make it
possible to check for the rare circumstance where the parent has an
entry for a subdir which (for whatever reason) is the result of a
checkout from a different repository. More on that later.]
Changes To The Commit Process:
==============================
Currently, the commit editor driver crawls the working copy, and sends
local modifications through the editor as it finds them. But we now
have to deal with disjoint urls in the working copy. Because editors
must be driven depth-first, we cannot send changes against these
disjoint urls as they are found -- instead, we must begin the edit
based on a common parent of all the urls involved in the commit. So
we must do a preliminary scan of the working copy, discovering all
local mods, collecting the urls for the mods, and then calculating the
common path prefix on which to base the edit.
[NOTE: this increases the memory usage of commits by a small amount.
We formerly interleaved the discovering and sending of local mods, but
now discovery will happen first and produce a list of changed paths,
and then sending the changes will happen entirely after that. The
benefit is that we preserve commit atomicity even when branches are
present in the working copy... which is very important!]
Changes To The Update Process:
==============================
Currently, update builds a reflection of the working copy's state on
the server (the reflection is a Subversion transaction). Then the
server sends back a tree delta between the reflection and the desired
revision tree (usually the head revision, but whatever). The tree
delta is expressed by driving an svn_delta_edit_fns_t editor on the
client side.
If there are disjoint subdirs in the working copy, the reflection
must, uh, reflect this. That's pretty easy: that subtree of the
transaction will simply point to the appropriate revision subtree
(implementation note: we'll need to add a new function to
svn_ra_reporter_t, allowing us to link arbitrary path/rev pairs into
the transaction.)
But getting the reflection right isn't enough. The revision tree
we're comparing the reflection with doesn't have the special disjoint
subtree, so a lot of spurious differences would be sent to the client,
which the client would then have to ignore, presumably making a
separate connection later to update the disjoint subdir. This way
lies madness... or at least inefficiency.
So instead, we'll create a *second*seaoe transaction, representing the
target of the update. In the plain update case, this transaction is
an exact copy of the revision (and perhaps we'll optimize out the txn
and just use the revision tree after all). But in the disjoint subdir
case, this second txn will also reflect the disjointedness. In other
words, when a disjoint directory D is discovered, it will be linked
into both txn trees -- in the reflection txn, D will be at whatever
revision(s) it is in the working copy, and in the target txn, it will
be at the target revision of the update. This way, the delta between
the reflection and target txns will apply cleanly to the working copy
(i.e., svn_repos_dir_delta() will just Do The Right Thing when invoked
on the two txns). Voila.
Changes to Switch and Merge Process:
====================================
The switch process still needs to build a working-copy reflection that
contains possible "disjointed" subtrees. However, the second
target-transaction isn't needed at all. The server can send a delta
between the reflection and a "pure" path in some revision (presumably
the path that we're switching to.)
If the disjointed subtree and the target path both happen to be part
of the same branch, then svn_repos_dir_delta() won't notice any
differences at all. Otherwise, the user should expect to have the
disjointed section of the working copy be "converted" to a new URL,
just like the rest of the working copy.
In the case of merges, we continue to build a reflection that contains
disjointed subtrees. Again, no need for a second transaction.
Remember that the reflection is only being built as a shortcut to
cheaply construct fulltexts of X:P in the client. The structure of
the reflection is irrelevant; *any* reflection can be used as a basis
for sending a tree-delta that constructs X:P, no matter what
disjointed sections it has. (Although some reflections may be more
useful than others! In the worst case, if the reflection is
completely unrelated to X:P, then svn_repos_dir_delta() regresses into
sending fulltexts anyway.)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: merging and switching
Posted by Zack Weinberg <za...@codesourcery.com>.
On Wed, Jan 23, 2002 at 09:16:55PM -0600, Ben Collins-Sussman wrote:
> It worked for me 20 minutes ago. I tested the link myself.
> Oh lookee. Our nightly Berkeley DB freeze.
> OK, ran db_recover again, took 18 minutes. Should be all fixed.
I'm still getting the error. Here's more detail:
$ telnet svn.collab.net 80
Trying 216.127.237.133...
Connected to 216-127-237-133.focaldata.net.
Escape character is '^]'.
GET /repos/svn/trunk/notes/merging-and-switching.txt HTTP/1.1
Host: svn.collab.net
Connection: close
HTTP/1.1 500 Internal Server Error
Date: Thu, 24 Jan 2002 03:23:09 GMT
Server: Apache/2.0.31-dev (Unix) DAV/2 SVN/0.7.0
Vary: accept-language
Accept-Ranges: bytes
Content-Length: 506
Connection: close
Content-Type: text/html; charset=ISO-8859-1
<!--#set var="TITLE" value="Server error!" -->
<!--#include virtual="include/top.html" -->
<!--#if expr="$REDIRECT_ERROR_NOTES" -->
<!--#include virtual="include/spacer.html" -->
Error message:
<BR><!--#echo var="REDIRECT_ERROR_NOTES" -->
<!--#else -->
The server encountered an internal error and was
unable to complete your request. The server is either
overloaded or there was an error in a CGI script.
<!--#endif -->
<!--#include virtual="include/bottom.html" -->
Connection closed by foreign host.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: merging and switching
Posted by Ben Collins-Sussman <su...@collab.net>.
Zack Weinberg <za...@codesourcery.com> writes:
> On Wed, Jan 23, 2002 at 08:18:11PM -0600, Ben Collins-Sussman wrote:
> >
> > http://svn.collab.net/repos/svn/trunk/notes/merging-and-switching.txt
>
> The server encountered an internal error and was
> unable to complete your request. The server is either
> overloaded or there was an error in a CGI script.
It worked for me 20 minutes ago. I tested the link myself.
Oh lookee. Our nightly Berkeley DB freeze.
OK, ran db_recover again, took 18 minutes. Should be all fixed.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: merging and switching
Posted by Zack Weinberg <za...@codesourcery.com>.
On Wed, Jan 23, 2002 at 08:18:11PM -0600, Ben Collins-Sussman wrote:
>
> http://svn.collab.net/repos/svn/trunk/notes/merging-and-switching.txt
<!--#set var="TITLE" value="Server error!" -->
<!--#include virtual="include/top.html" -->
<!--#if expr="$REDIRECT_ERROR_NOTES" -->
<!--#include virtual="include/spacer.html" -->
Error message:
<br><!--#echo var="REDIRECT_ERROR_NOTES" -->
<!--#else -->
The server encountered an internal error and was
unable to complete your request. The server is either
overloaded or there was an error in a CGI script.
<!--#endif -->
<!--#include virtual="include/bottom.html" -->
zw
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: merging and switching
Posted by Ben Collins-Sussman <su...@collab.net>.
Colin Putney <co...@whistler.com> writes:
> On Wednesday, January 23, 2002, at 03:37 PM, Ben Collins-Sussman wrote:
>
> >
> > At this point, I'm sure everyone saw the power-plant that was just
> > checked into notes. Karl is going to add some further thoughts.
> > Everybody take your time to digest that doc. :-)
>
> Nope. I'm using Mac OS X, so I can't check out the head
> revision. Would you post the doc to the list please?
I don't need to... we've got WebDAV always exporting HEAD:
http://svn.collab.net/repos/svn/trunk/notes/merging-and-switching.txt
:-)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: merging and switching
Posted by Colin Putney <co...@whistler.com>.
On Wednesday, January 23, 2002, at 03:37 PM, Ben Collins-Sussman wrote:
>
> At this point, I'm sure everyone saw the power-plant that was just
> checked into notes. Karl is going to add some further thoughts.
> Everybody take your time to digest that doc. :-)
Nope. I'm using Mac OS X, so I can't check out the head revision. Would
you post the doc to the list please?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org