You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by da...@chaosreigns.com on 2011/05/27 18:48:19 UTC

How do I escape a subversion keyword?

I'm working on some software (spamassassin) that uses the subversion
keyword "$LastChangedDate$".  In the same file that it's used, I want that
string to appear unmodified - not expanded by subversion, exactly as
"$LastChangedDate$" instead of something like "$LastChangedDate: 2010-03-30
08:02:18 -0400 (Tue, 30 Mar 2010) $"

Because I want to check for a case where svn keywords aren't getting
expanded.

Something like (perl):

  if ('$LastChangedDate$' eq '$LastChangedDate$')

But with one of them getting expanded, and the other not.

I think it would work to do something like:

  if ('$LastChangedDate$' eq '$LastChan'.'gedDate$')

But I'd prefer to escape the keyword instead.

Maybe something like \$LastChangedDate$ ?


The reason is that the Ubuntu daily build system on launchpad.net doesn't
support subversion keyword expansion:
https://bugs.launchpad.net/launchpad/+bug/780916

SpamAssassin bug:
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6605

-- 
"Go forth, and be excellent to one another." - http://www.jhuger.com/fredski.php
http://www.ChaosReigns.com

Re: How do I escape a subversion keyword?

Posted by Andreas Krey <a....@gmx.de>.
On Fri, 27 May 2011 13:27:36 +0000, darxus@chaosreigns.com wrote:
> On 05/27, Bob Archer wrote:
> > I'm confused about what you are asking. Are you saying you don't want
> > subversion to expand the keywords? If so, then remove them from the
> > svn:keywords property. Any keywords not in the property are not expanded.
> 
> I want the expanded keyword, and the *un-expanded* keyword to both exist in
> the same file.

Doesn't work. svn either expands them all, or none. The only way to
get selective is to use some quoting that does not affect the target
language's perception of the string but makes it not look like $Keyword$
to svn.

I don't know if perl likes

  if ('$LastChangedDate\$' eq '$LastChangedDate$')

or

  if ('$LastChangedDate\044' eq '$LastChangedDate$')

is legal in perl but anyway this specific check is equivalent to (Ruby)

  if '$LastChangedDate$' =~ /:/

(check whether the string contains a colon).

Or, to answer the subject line: As by the escaping rules of your content language.

Andreas

-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800

Re: How do I escape a subversion keyword?

Posted by da...@chaosreigns.com.
On 05/27, Bob Archer wrote:
> I'm confused about what you are asking. Are you saying you don't want
> subversion to expand the keywords? If so, then remove them from the
> svn:keywords property. Any keywords not in the property are not expanded.

I want the expanded keyword, and the *un-expanded* keyword to both exist in
the same file.

So after expansion, it would look like:

  if ('$LastChangedDate$' eq '$LastChangedDate: 2010-03-30 08:02:18 -0400 (Tue, 30 Mar 2010) $')

And when expansion doesn't happen (with launchpad build recipes), it'll
look like:

  if ('$LastChangedDate$' eq '$LastChangedDate$')

-- 
"One armed student or teacher could have stopped the killer, but all
died obeying the rules."
- http://www.olegvolk.net/gallery/technology/arms/yourkid0181.jpg.html
http://www.ChaosReigns.com

RE: How do I escape a subversion keyword?

Posted by "Becker, Thomas" <Th...@torex.com>.
How about:

if (length('$LastCheckedDate$') == 17) # keyword wasn't expanded

Regards,
  Thomas

> -----Ursprüngliche Nachricht-----
> Von: Bob Archer [mailto:Bob.Archer@amsi.com]
> Gesendet: Freitag, 27. Mai 2011 19:08
> An: darxus@chaosreigns.com; users@subversion.apache.org
> Betreff: RE: How do I escape a subversion keyword?
> 
> > I'm working on some software (spamassassin) that uses the
> > subversion
> > keyword "$LastChangedDate$".  In the same file that it's used, I
> > want that
> > string to appear unmodified - not expanded by subversion, exactly
> > as
> > "$LastChangedDate$" instead of something like "$LastChangedDate:
> > 2010-03-30
> > 08:02:18 -0400 (Tue, 30 Mar 2010) $"
> >
> > Because I want to check for a case where svn keywords aren't
> > getting
> > expanded.
> >
> > Something like (perl):
> >
> >   if ('$LastChangedDate$' eq '$LastChangedDate$')
> >
> > But with one of them getting expanded, and the other not.
> >
> > I think it would work to do something like:
> >
> >   if ('$LastChangedDate$' eq '$LastChan'.'gedDate$')
> >
> > But I'd prefer to escape the keyword instead.
> >
> > Maybe something like \$LastChangedDate$ ?
> 
> I'm confused about what you are asking. Are you saying you don't want
> subversion to expand the keywords? If so, then remove them from the
> svn:keywords property. Any keywords not in the property are not expanded.
> 
> BOb



 

This email and its attachments may be confidential and are intended solely for 
the use of the individual to whom it is addressed. Any views or opinions expressed 
are solely those of the author and do not necessarily represent those of Torex 
(Torex Group of Companies). If you are not the intended recipient of this email 
and its attachments, you must take no action based upon them, nor must you copy 
or show them to anyone.  Please contact the sender if you believe you have received 
this email in error.

Torex Retail Solutions GmbH
Sitz der Gesellschaft: Berlin. HRB 102273B Amtsgericht Berlin Charlottenburg.
UST.-ID: DE170817515. Steuer-Nr. 27/448/07028. WEEE-Reg.-Nr. DE 30664749.
Geschäftsführer: Stephen Callaghan, Martin Timmann.


.


RE: How do I escape a subversion keyword?

Posted by Bob Archer <Bo...@amsi.com>.
> I'm working on some software (spamassassin) that uses the
> subversion
> keyword "$LastChangedDate$".  In the same file that it's used, I
> want that
> string to appear unmodified - not expanded by subversion, exactly
> as
> "$LastChangedDate$" instead of something like "$LastChangedDate:
> 2010-03-30
> 08:02:18 -0400 (Tue, 30 Mar 2010) $"
> 
> Because I want to check for a case where svn keywords aren't
> getting
> expanded.
> 
> Something like (perl):
> 
>   if ('$LastChangedDate$' eq '$LastChangedDate$')
> 
> But with one of them getting expanded, and the other not.
> 
> I think it would work to do something like:
> 
>   if ('$LastChangedDate$' eq '$LastChan'.'gedDate$')
> 
> But I'd prefer to escape the keyword instead.
> 
> Maybe something like \$LastChangedDate$ ?

I'm confused about what you are asking. Are you saying you don't want subversion to expand the keywords? If so, then remove them from the svn:keywords property. Any keywords not in the property are not expanded.

BOb