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

Re: idea: a revision keyword expanded only at 'svn export' time

From: <brane_at_xbc.nu>
Date: 2002-12-04 00:20:05 CET

Karl Fogel wrote:

>John Barstow <John_Barstow@gfsg.co.nz> writes:
>>Assuming you have grep on your platform (which most Win32 users don't).
>>Assuming you know to run 'svn status -v' (which a newbie usually wouldn't).
>>People don't read documentation (aside from tutorials) until they run into a
>>Which explains why so many of the unintiated have asked for this trivial
>If it were truly trivial, sure. But adding a new keyword -- and one
>that behaves slightly differently than the keywords we already have --
>is not trivial. It adds new complexities to code paths in libsvn_wc.
>I guess what worries me is that keyword expansion has already been a
>bug source on a few occasions, so complexifying the keyword code
>doesn't seem like a good idea to me.
>I'm not vetoing it, just explaining why I think it's not good.
I absolutely agree here. And there's more: Not only would this be a new
keyword, the expansion rules would be different, too. For example, in
the current scheme of things, the keyword


would be expanded to

    $WorkingRev: 3687$

This is exactly what you don't want, assuming that you'd use the keyword
in a version.h file; in Subversion, this is what would happen, for example:

    $ svn --version
    svn, version 0.15.0 ($WorkingRev: 3687$)
       compiled Nov 9 2002, 11:07:15

So you'd have to change the behaviour so that "$WorkingRev$" expands to
just "3687", and only on export... that's not just not trivial, it's a
fair amount of fiddling for something that can be scripted in five minutes.

By all means, if somebody really can't live without this feature, go for
it. But in that case I propose to do it without special-caseing a single
keyword, and instead do the following:

   1. Create a new keyword $WorkingRev$ that expands to the current WC
      revision of a file
   2. Create a new special property, svn:export-keywords. This property
      would behave like svn:keywords, except in two respects:
          a) The keywords listed there would be expanded
             only during "svn export"
          b) The keywords would be expanded to _just_ the keyword
             value, not to $Keyword: value$ as they are normally
      If a keyword appears in both svn:keywords and svn:export-keywords,
      the export-keywords behaviour takes precedence.
   3. Write a bunch of tests for this new feature. And I mean that very
      seriously. I'd be inclined to veto any patch towards this feature
      that doesn't come with good tests, including tests for
      interactions with other source-modiyfing transformations
      (end-of-line, svn:keywords vs. svn:export-keywords, etc.)

Spelled out like this, it doesn't look trivial at all, does it.

Oh, by the way, I'd just like to point out that the working copy
revision does _not_ uniquely identify the sources used in a build, even
assuming a single-version working copy. The same revision of
http://svn.collab.net/repos/svn/trunk and
http://svn.collab.net/repos/svn/tags/0.15.0 defines two quite different
sets of sources.

Brane ─îibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Dec 4 00:20:46 2002

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