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

Proposal for referencing related paths

From: Christian Stork <cstork_at_ics.uci.edu>
Date: 2005-11-13 22:45:11 CET

This proposal is a simplification of the previous proposals on easy
comparision of trunk, branches, tags, etc.

The problem that I want to solve (very inprecise but concise) is:

    "Given a repo path p1 and a branch +b find the corresponding
    path p2 on the branch +b requiring minimal annotations to the
    repository."

We have two properties:

- 'svn:treeroot' contains the path of a related tree, usually the trunk.

- 'svn:projectroot' might be empty or contain a mapping of branch
  nicknames to subdirectories (as discussed in another thread).

The following algorithm makes use of the idea of a node's refpath
("refence path"). Every repo node's path is its own refpath unless one
of it's parents is a treeroot, i.e., a directory with the svn:treeroot
property set. In that case its refpath is the concatenation of the
treeroot's refpath and its relative path to the treeroot. For example,
the root of a branch would have a svn:treeroot property that points to
the corresponding path on the trunk.

Using refpaths has the advantage that comparisons among branches are
reduced to comparisons of their refpaths. The following "algorithm"
should make this clearer.

1. Determine reference path:
Starting at p1 walk up the repo dir tree until we hit a treeroot. (This
will always happen if we assume that / is a treeroot.)
    
    p1's-refpath = treeroot's-refpath / p1's-path-relative-to-treeroot

2. Locate branch:
Starting from treeroot's-refpath on upward look for projectroots. If a
projectroot's subdir or nickname is equal to +b we found our branch.
(There could be several projectroots, which would solve Juilian's
problem posed in the another thread.)

3. Determine corresponding path:

    p2 = +b's-path / p1's-refpath-relative-to-projectroot

Which properties need to be set to make this algorithm work for our
standard repository layout?

repo root "/":
svn:treeroot = "", svn:projectroot = ""

branch /branches/experimental corresponding to /trunk/some/sub/dir/X:
svn:treeroot = "/trunk/some/sub/dir/X"

This provides branch identification of the form +branches/experimental.
For a shorter branch description, such as +b-exp one needs a projectroot with
content "b-exp branches/experimental" in the repo root.
Another standard setting for root's svn:projectroot might be (in some
syntax):

* /branches/*
* /tags/*

which would allow +experimental.

Well, that got a little long and I didn't even consider nested
treeroots ;-),
Chris

-- 
Chris Stork   <>  Support eff.org!  <>   http://www.ics.uci.edu/~cstork/
OpenPGP fingerprint:  B08B 602C C806 C492 D069  021E 41F3 8C8D 50F9 CA2F
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Nov 13 23:16:32 2005

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