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

Re: Easy comparisons between related trunks, branches, and tags

From: Marc Sherman <msherman_at_projectile.ca>
Date: 2005-11-12 16:23:12 CET

Jim Blandy wrote:
>
> No, that's not right. You can set the svn:parallel:KIND property on a
> single common parent, and operations in WC's based on any child of
> that parent will see all the branches set there. I show this in the
> example.

It took me a while to figure out what you were doing here with the two
different properties, but I finally got it. And it just gave me another
idea; by combining our two ideas (your two properties, and my regex
matching), we can simplify things even more:

Two properties are defined: svn:projectroot and svn:treeroot. No
semantics are defined to the values of the properties; they're simply
boolean flags, true if set, false if not.

Each WC .svn directory stores two new pieces of information: the closest
ancestor repository path in which the two properties are set. The
treeroot must be a child of projectroot. The projectroot property is
optional -- if not set on any ancestor directory, it defaults to the
repository root.

So, consider this example repository:

/
   /projecta (P)
     /trunk (T)
     /branches
       /1.x (T)
       /2.x (T)
     /tags
       /1.0 (T)
       /1.1 (T)
       /1.2 (T)
   /projectb (P)
     /trunk (T)
     /users
       /msherman
         /exp1 (T)
       /jimb
         /scratch (T)
         /new
           /try1 (T)
           /try2 (T)
     /releases
       /1.1 (T)

We're in a working copy checked out from
svn://repos/projecta/trunk/foo/bar. We run:
   svn diff -r +branches/2.x baz.txt

The working copy for this dir contains:
svn:projectroot=svn://repos/projecta
svn:treeroot=svn://repos/projecta/trunk

To construct the URL to compare baz.txt against, simply take the URL of
BASE, and replace the leading svn:treeroot with
svn:projectroot+"/"+"branches/2.x".

A more complex example: I'm in a working dir at
svn://repos/projectb/users/msherman/exp1/foo/bar, and I want to diff
against your try2 branch:
   svn diff -r +users/jimb/new/try2 baz.txt

The working copy for this dir contains:
svn:projectroot=svn://repos/projectb
svn:treeroot=svn://repos/projectb/users/msherman/exp1

To get the URL to compare with, take
svn://repos/projectb/users/msherman/exp1/foo/bar/baz.txt, and replace
the leading treeroot with projectroot+branchparam, ie: replace
"^svn://repos/projectb/users/msherman/exp1" with
"svn://repos/projectb"+"/"+"users/jimb/new/try2", giving
"svn://repos/projectb/users/jimb/new/try2/foo/bar/baz.txt"

Some error checking can be added to this:
- When setting the properties, or on "svn cp" for branching/tagging,
assert that the treeroot is not within another treeroot, and assert that
  the projectroot is not within another projectroot or treeroot
- When doing the substitution to construct the second target URL, assert
that the dir at svn:projectroot+"branches/2.x" is a treeroot within the
same projectroot

This puts all the information about how to construct the paths in the
location of the two properties; the user doesn't have to specify any
paths or regexs in the properties at all. All they have to do when
setting up their repo is set the treeroot property on their trunk
directory, and if required, set the projectroot (and it's only needed
for multi-project repositories; it can be left out in the simple
single-project repository setup). Branching and tagging the trunk dir
will propagate the treeroot property to the correct location, wherever
it is.

What do you think?

- Marc

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Nov 12 16:24:09 2005

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