You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Karl Fogel <kf...@red-bean.com> on 2008/10/08 17:49:03 UTC
Re: [PATCH] Fixed broken parsing of property strings from svnlook's output
Panu Outinen <pa...@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?
Thanks,
-Karl
[[[
* contrib/hook-scripts/enforcer/enforcer: Adjust for the r27808
svnlook output changes.
Patch by: Panu Outinen <pa...@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@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] Fixed broken parsing of property strings from svnlook's output
Posted by Karl Fogel <kf...@red-bean.com>.
Wilfredo Sánchez Vega <ws...@apple.com> writes:
> On Oct 8, 2008, at 2:34 PM, Wilfredo Sánchez Vega wrote:
>> Is there a reason why we don't want to leave the Name: case in
>> there for older versions rather than requiring an upgrade to 1.5? I
>> guess this is a server-side thing, so it's not a big deal, but it
>> seems easy to keep compatibility in place there.
Heh. Yeah, see my followup message asking exactly the same question...
> The patch below should work on both 1.5 and pre-1.5.
Nice. Committed in r33568.
-Karl
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] Fixed broken parsing of property strings from svnlook's output
Posted by Wilfredo Sánchez Vega <ws...@apple.com>.
On Oct 8, 2008, at 2:34 PM, Wilfredo Sánchez Vega wrote:
> Is there a reason why we don't want to leave the Name: case in
> there for older versions rather than requiring an upgrade to 1.5? I
> guess this is a server-side thing, so it's not a big deal, but it
> seems easy to keep compatibility in place there.
The patch below should work on both 1.5 and pre-1.5.
-wsv
Index: contrib/hook-scripts/enforcer/enforcer
===================================================================
--- contrib/hook-scripts/enforcer/enforcer (revision 33559)
+++ contrib/hook-scripts/enforcer/enforcer (working copy)
@@ -412,15 +412,27 @@
continue
if state is 31: # Expecting property name (follows bar)
- assert line.startswith("Name: ")
+ for label in (
+ "Name", # svn versions < 1.5
+ "Added", "Modified", "Deleted" # svn versions >= 1.5
+ ):
+ if line.startswith(label + " :"):
+ break
+ else:
+ raise AssertionError("Unexpected property name line:
%r" % line)
+
state = 300
# Fall through to state 300
if state is 300:
- if line.startswith("Name: "):
- current_property = line[6:]
- current_verify_property_function = None
- continue
+ for label in (
+ "Name", # svn versions < 1.5
+ "Added", "Modified", "Deleted" # svn versions >= 1.5
+ ):
+ if line.startswith(label + ": "):
+ current_property = line[len(label)+2:]
+ current_verify_property_function = None
+ continue
for prefix, verify in (
(" - ", verify_property_line_removed),
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] Fixed broken parsing of property strings from svnlook's output
Posted by Wilfredo Sánchez Vega <ws...@wsanchez.net>.
Is there a reason why we don't want to leave the Name: case in
there for older versions rather than requiring an upgrade to 1.5? I
guess this is a server-side thing, so it's not a big deal, but it
seems easy to keep compatibility in place there.
-wsv
On Oct 8, 2008, at 10:49 AM, Karl Fogel wrote:
> Panu Outinen <pa...@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?
>
> Thanks,
> -Karl
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] Fixed broken parsing of property strings from svnlook's output
Posted by Karl Fogel <kf...@red-bean.com>.
Karl Fogel <kf...@red-bean.com> writes:
> Panu Outinen <pa...@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 <pa...@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@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org