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

Re: Buglet expanding keywords

From: David Kimdon <dwhedon_at_debian.org>
Date: 2003-01-06 04:11:26 CET

On Sun, Jan 05, 2003 at 12:30:23PM -0600, Karl Fogel wrote:
> Hmmm, okay, sounds like this unexpected behavior is a real problem
> (plus maybe I'm wrong in remembering that this was the way we'd
> intended it to work?). Andreas, want to file that issue?

Hi,

Here's a fix for the keyword issue. I took a look at
doc/book/book/ch06.xml and the other docs and didn't see anything that
needs to be updated. If we are in agreement that this is something we
want to do (I'd like to see it changed as well), and the patch looks
good I'll commit the fix.

-David

* subversion/libsvn_subr/subst.c
  (translate_keyword_subst) : Treat "$keyword:$" as an unexpanded keyword.
  Previously "$keyword$" was considered an unexpanded keyword and
  "$keyword: $" was considered a contracted keyword. Both would be expanded but
  "$keyword:$" was left unexpanded. This inconsistency causes confusion on
  its own and the confusion is compounded by the fact that RCS keywords
  accept the "$keyword:$" syntax.

* subversion/tests/libsvn_wc/translate-test.c
  (lines, substitute_and_verify) : "$keyword:$" should now be expanded.

Index: subversion/libsvn_subr/subst.c
===================================================================
--- subversion/libsvn_subr/subst.c (revision 4265)
+++ subversion/libsvn_subr/subst.c (working copy)
@@ -134,7 +134,9 @@
   buf_ptr = buf + 1 + keyword_len;
 
   /* Check for unexpanded keyword. */
- if (buf_ptr[0] == '$')
+ if ((buf_ptr[0] == '$') /* "$keyword$" */
+ || ((buf_ptr[0] == ':')
+ && (buf_ptr[1] == '$'))) /* "$keyword:$" */
     {
       /* unexpanded... */
       if (value)
Index: subversion/tests/libsvn_wc/translate-test.c
===================================================================
--- subversion/tests/libsvn_wc/translate-test.c (revision 4265)
+++ subversion/tests/libsvn_wc/translate-test.c (working copy)
@@ -93,7 +93,7 @@
     "Line 43: fairly boring subst test data... blah blah.",
     "Line 44: fairly boring subst test data... blah blah.",
     "Line 45: Invalid $LastChangedRevisionWithSuffix$, started unexpanded.",
- "Line 46: Invalid $Rev:$ is missing a space.",
+ "Line 46: Valid $Rev:$ is not missing a space.",
     "Line 47: fairly boring subst test data... blah blah.",
     "Line 48: Two keywords back to back: $Author$$Rev$.",
     "Line 49: One keyword, one not, back to back: $Author$Rev$.",
@@ -478,6 +478,17 @@
         }
     }
 
+ if (rev)
+ {
+ if (expand)
+ {
+ expect[46 - 1] =
+ apr_pstrcat (pool, "Line 46: ", "Valid $Rev: ", rev,
+ " $ is not missing a space.", NULL);
+ }
+ /* Else Line 46 remains unchanged. */
+ }
+
   /* Handle lines 48, 49, and 70 specially, as they contains two valid
      keywords. */
   if (rev && author)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jan 6 04:48:15 2003

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.