You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Luc Mercier <me...@cs.brown.edu> on 2006/06/05 19:18:01 UTC
Forcing update of the $keywords$
Hi folks,
I'm using the keywords $Date$, $Rev$, etc. in some file. The problem I
have is that these keywords are subsituted when on an update or a
checkout, but not after a commit, resulting in the subsituted value to
be not up to date. The problem is especially bothering if there's only
one person working on a project, because in that case after the initial
checkout the file will never be updated.
So far, I have two workarounds :
* After each commit, delete the file in the working copy and do an
update... It works, but that's really annoying
* Have two working copies, and each time you commit from one, you start
working in the other one... That's not better.
Thanks for any help !
- Luc M.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Forcing update of the $keywords$
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jun 21, 2006, at 18:44, Luc Mercier wrote:
> Ryan Schmidt wrote:
>
>> On Jun 5, 2006, at 21:18, Luc Mercier wrote:
>>
>>> I'm using the keywords $Date$, $Rev$, etc. in some file. The
>>> problem I have is that these keywords are subsituted when on an
>>> update or a checkout, but not after a commit, resulting in the
>>> subsituted value to be not up to date. The problem is especially
>>> bothering if there's only one person working on a project,
>>> because in that case after the initial checkout the file will
>>> never be updated.
>>>
>>> So far, I have two workarounds :
>>> * After each commit, delete the file in the working copy and do
>>> an update... It works, but that's really annoying
>>> * Have two working copies, and each time you commit from one,
>>> you start working in the other one... That's not better.
>>
>>
>> I don't understand. You say the keywords are updated on update,
>> but not on commit? That's not what I see. With Subversion 1.3.2
>> on Mac OS X, the keywords update when I commit:
[snipped example]
> Oh, yeah, my message was really not that accurate. Sorry for that.
> Here is a new message:
>
> --
> Hi,
>
> The keywords $Date$, $Rev$, etc. are handful, but they refer only
> to the current file. I want to use this kind of feature, for
> example, in a Latex project, to have a footnote on the first page
> reading "this is revision XXX", like on the cover page of the
> Subversion book.
>
> In this case, the file revision is irrelevant. What you want is the
> revision number of the directory containing the document, ie the
> max of the revision number of files contained in this directory
> (recursively). The problem is that it is likely that the $Rev$ will
> be located in a file which will very rarely be modified. What I do
> so far is adding/deleting a blank line in the file containing the
> $Rev$ before each commit, to force the revision number of the file
> to match the one of the directory. Of course, that's a really bad -
> and annoying - solution.
>
> Another solution would to call svnversion before compiling the
> document, dump the output to a file, and have in the latex code an
> input to this file to retreive the information... What a pain.
>
> Is there any reason why there is no keyword called $DirRev$,
> $DirAuthor$...? How to work around that? Does anyone know how the
> authors of the Subversion book are producing this "compiled from
> revision XX" for their book?
The "svnversion" method is the one endorsed by the FAQ and it's the
one I'd recommend as well:
http://subversion.tigris.org/faq.html#version-value-in-source
That page also explains that a keyword like your proposed $DirRev$
would be woefully slow, which is why it doesn't exist.
I haven't used LaTeX myself, but in a programming language like C or
PHP it wouldn't really be too inconvenient to read in the contents of
a file to display it somewhere.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Forcing update of the $keywords$
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jun 5, 2006, at 21:18, Luc Mercier wrote:
> I'm using the keywords $Date$, $Rev$, etc. in some file. The
> problem I have is that these keywords are subsituted when on an
> update or a checkout, but not after a commit, resulting in the
> subsituted value to be not up to date. The problem is especially
> bothering if there's only one person working on a project, because
> in that case after the initial checkout the file will never be
> updated.
>
> So far, I have two workarounds :
> * After each commit, delete the file in the working copy and do an
> update... It works, but that's really annoying
> * Have two working copies, and each time you commit from one, you
> start working in the other one... That's not better.
I don't understand. You say the keywords are updated on update, but
not on commit? That's not what I see. With Subversion 1.3.2 on Mac OS
X, the keywords update when I commit:
$ svnadmin create repo
$ svn co file://`pwd`/repo wc
Checked out revision 0.
$ cd wc
$ echo '$Date$' > foo
$ echo '$Rev$' >> foo
$ svn add foo
A foo
$ svn ci -m ""
Adding foo
Transmitting file data .
Committed revision 1.
$ svn propset svn:keywords 'Date Rev' foo
property 'svn:keywords' set on 'foo'
$ cat foo
$Date$
$Rev$
$ svn ci -m ""
Sending foo
Committed revision 2.
$ cat foo
$Date: 2006-06-05 23:25:49 +0200 (Mon, 05 Jun 2006) $
$Rev: 2 $
$ echo 'bar' >> foo
$ cat foo
$Date: 2006-06-05 23:25:49 +0200 (Mon, 05 Jun 2006) $
$Rev: 2 $
bar
$ svn ci -m ""
Sending foo
Transmitting file data .
Committed revision 3.
$ cat foo
$Date: 2006-06-05 23:26:02 +0200 (Mon, 05 Jun 2006) $
$Rev: 3 $
bar
$
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org