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

Re: [PATCH] Fixed broken parsing of property strings from svnlook's output

From: Karl Fogel <kfogel_at_red-bean.com>
Date: Wed, 08 Oct 2008 14:31:31 -0400

Karl Fogel <kfogel_at_red-bean.com> writes:
> Panu Outinen <panu_at_vertex.fi> writes:
>> As Karl Fogel pushed here's my quick patch for the contributed
>> hook-script 'enforcer' relating to the parsing problem with svn
>> 1.5.x's change introduced in r27808 in svnlook's output.
>>
>> svn diff is against the trunk version.
>
> Below is a slightly improved version of the patch & log message (it
> conditionally recommends to the user to upgrade, see the diff). Can you
> test this and let us know if it works?

By the way, an even better change would be to handle *both* formats.
That is,

   if not (line.startswith("Added: ")
           or line.startswith("Modified: ")
           or line.startswith("Deleted: ")
           or line.startswith("Name: ")
           ):
      raise AssertionError(...)
   [...]
   if line.startswith("Added: "):
      ### handle new format
   if line.startswith("Modified: "):
      ### handle new format
   if line.startswith("Deleted: "):
      ### handle new format
   if line.startswith("Name: "):
      ### handle OLD format

If you want to make that change instead, that'd be great...

-Karl

> [[[
> * contrib/hook-scripts/enforcer/enforcer: Adjust for the r27808
> svnlook output changes.
>
> Patch by: Panu Outinen <panu_at_vertex.fi>
> me
> ]]]
>
> Index: contrib/hook-scripts/enforcer/enforcer
> ===================================================================
> --- contrib/hook-scripts/enforcer/enforcer (revision 33550)
> +++ contrib/hook-scripts/enforcer/enforcer (working copy)
> @@ -412,16 +412,31 @@
> continue
>
> if state is 31: # Expecting property name (follows bar)
> - assert line.startswith("Name: ")
> + if not (line.startswith("Added: ") or line.startswith("Modified: ") or line.startswith("Deleted: ")):
> + error_str = "Unexpected property line: '%r'" % line
> + if line.startswith("Name: "):
> + error_str += "\n(Upgrade to Subversion 1.5 or higher " \
> + "to use this script.)"
> + raise AssertionError(error_str)
> state = 300
> # Fall through to state 300
>
> if state is 300:
> - if line.startswith("Name: "):
> - current_property = line[6:]
> + if line.startswith("Added: "):
> + current_property = line[7:]
> current_verify_property_function = None
> continue
>
> + if line.startswith("Modified: "):
> + current_property = line[10:]
> + current_verify_property_function = None
> + continue
> +
> + if line.startswith("Deleted: "):
> + current_property = line[9:]
> + current_verify_property_function = None
> + continue
> +
> for prefix, verify in (
> (" - ", verify_property_line_removed),
> (" + ", verify_property_line_added)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: dev-help_at_subversion.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-10-08 20:31:45 CEST

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