[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-10 19:07:53 CET

Jim Blandy wrote:
>
> I think this has two problems:
>
> - If I have a wc based on a branch, how does this help me find the
> corresponding trunk? The repository could have many projects in it. The
> trunk might not be a sibling of the branches directory.

The idea is that everything listed within a single "roots" property is
parallel, to use the terminology from elsewhere in this thread. So if I
had the following multi-project layout:

/
   /project1
     /trunk
     /branches
     /tags
   /project2
     /trunk
     /branches
     /tags

The project1 and project2 dirs would both have svn:roots properties set to:

svn:roots=trunk|(tags|branches)/[^/]+

The .svn directory in the wc would need to store two additional pieces
of info (I'm guessing in the entries file): The ancestor path that
contains an svn:roots property, and the value of that property.

So, if I'm in a working copy checked out from /project1/branches/r1.x,
and within that working copy I am in the dir src/foo/bar, the command:

svn diff -r +trunk baz.txt

would do the following:
1) check the entries file to find:
roots-set-on-dir = svn://repos/project1
roots-value = trunk|(tags|branches)/[^/]+

2) Assert that the path specified with "-r +" (ie: "trunk") matches the
roots value regex

3) construct a regex from the two values:
(?<=^svn://repos/project1/)trunk|(tags|branches)/[^/]+(?=/)

4) Match the regex against the current dirs repository url
(svn://repos/project1/branches/r1.x/src/foo/bar), replacing the match
with the value given with "-r +". This produces the url:
svn://repos/project1/trunk/src/foo/bar

5) construct the target url to compare by appending the relative
paramater "baz.txt", giving:
svn://repos/project1/trunk/src/foo/bar/baz.txt

> - The regexp given assumes that there is only one directory component after
> 'branches'; that is, every subdirectory of 'branches' must be a root. But we
> encourage people to take advantage of the fact that the branch 'namespace'
> is really just part of the directory tree, and use hierarchy within branch
> names: 'experimental/wacko'. If all your branch names were two levels deep,
> then you could fix the regexp. Or if all your root names ended in '%' (say),
> and never used % elsewhere, then you could fix the regexp.

Consider a third project in the same repository as above:

   /project3
     /trunk
     /dev
     /experimental
       /exp1
     /releases
       /r1.0
       /r1.x
         /r1.1

On the project3 dir, I'd set:
svn:roots=trunk|dev|experimental/[^/]+|releases/(r1.x/[^/]+|(?!r1.x)[^/]+)

You'd need to use libpcre for this level of regexp complexity, I think.
  It appears to be portable already to all of Subversion's supported
platforms, I think.

- Marc

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Nov 10 19:14:23 2005

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.