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

Issue 1974 - Possible way to solve this and similar issues

From: Mike Friedrich <mfriedrich_at_modulani.de>
Date: 2005-04-04 10:26:45 CEST

Hi all,

I don't know if anyone already thought about this, but I want to make a
suggestion to solve this issue in a general way.

Goal:
- custom properties usable as keywords in files
- introduce property inheritance via new keyword-lookup hook to ease the
repository administration

I hope you like and understand this idea:

Whenever a file is checked out or updated in the local copy, the following
actions should be performed:
- For each file (x) the keyword-lookup-hook is executed with keyword
"svn:keywords" as parameter.
  This hook returns the current file-name or any parent directory (y) with
the property-name (p) to use.
  The hook can also use the file-extension or mime-type to retrieve a
specific property name (whatever is wanted by the hook).
  Each of those properties are read from the transaction or reporitory and a
hash or simple set is constructed:
        unique key: filename x
        value: keywords retrieved from property p of file y (containing
custom keywords (k))
- For each custom keyword (k) of file (x) the keyword-lookup-hook is
executed with keyword k as parameter.
  Again the hook returns the current file-name or any parent directory (y2)
with the property-name (p2) to use.
- For each file x the pre-defined keywords are replaced
- For each custom keyword (k) of file (x) the value of property p2 of file
y2 is used for replacement.

Whenever a repository is commited:
- Find the keywords and remove those keyword-values from the file by
invoking the keyword-lookup-hook
  with"svn:keywords".
  In such a case the clients local copy must be updated automatically (must
be done anyway to reflect the new
  predefined keywords, which change also on a commit)

Example:
Repository: http://svn.collab.net/repos/svn
Property on directory /trunk:
        "default-keywords"="Id URL Date Revision Author Project"
        "keyword-pattern"="*.c;*.cc;*.cpp;*.h;*.hh;*.hpp"
        "Project"="Subversion"
Property on directory /trunk/www:
        "keyword-pattern"="*.html;*.eps;*.xml"
        "Project"="Subversion Intro/Docs?"
Property on directory /trunk/tools:
        "Version"="1.1"
Property on directory /trunk/tools/hook-scripts:
        "default-keywords"="Id URL Date Revision Author Version"

Example-Hook keyword-lookup:
When the hook gets a "svn:keywords" passed in, it looks first for
"svn:keywords" on the file itself,
if not set, it looks for any "default-keywords" in the parent-tree and
returns the property location, if
the file-extension matches with a found "keyword-pattern".
If any other parameter is passed in it just searches that property going the
tree up.

New hook keyword-lookup
        parameters: repository, revision-id, transactions-id, keyword
        output: file/url where the keyword is attached to and can be
retrieved from
        returns: 0 on success and an errocode if not found

Because I don't know the Subversion-code, I have no idea how complicated
this is to translate into c/c++.
But the solution I think is using a hook to find the keywords, ... and this
gives the reposity-admin a powerfull weapon as well.
Of course the svnlook-command must be able to retrieve properties from the
transaction and the repository
(which it is according to the Subversion Book - I havn't tried it.)

I would be glad to see this issue solved in this or a similar way and hope I
could give at least some inspiration.

Cheers,
Mike Friedrich
Received on Mon Apr 4 10:53:21 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.