#12329 closed defect (fixed)
WARNING: Diff rendering failed for property svnmerge-integrated with renderer SubversionMergePropertyDiffRenderer
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.12 |
Component: | version control | Version: | |
Severity: | normal | Keywords: | svn |
Cc: | Branch: | ||
Release Notes: |
Fixed |
||
API Changes: | |||
Internal Changes: |
Description
Another issue found in the logs. Probably not too significant, but hopefully we can raise a TracError
for invalid input.
2016-01-19 19:12:45,719 Trac[changeset] WARNING: Diff rendering failed for property svnmerge-integrated with renderer SubversionMergePropertyDiffRenderer: Traceback (most recent call last): File "/usr/local/virtualenv/1.0-stable/lib/python2.7/site-packages/trac/versioncontrol/web_ui/changeset.py", line 811, in render_property_diff options) File "/usr/local/virtualenv/1.0-stable/lib/python2.7/site-packages/tracopt/versioncontrol/svn/svn_prop.py", line 367, in render_property_diff old_sources = parse_sources(old_props) File "/usr/local/virtualenv/1.0-stable/lib/python2.7/site-packages/tracopt/versioncontrol/svn/svn_prop.py", line 364, in parse_sources sources[spath] = (set(Ranges(inheritable)), File "/usr/local/virtualenv/1.0-stable/lib/python2.7/site-packages/trac/util/__init__.py", line 982, in __init__ self.appendrange(r) File "/usr/local/virtualenv/1.0-stable/lib/python2.7/site-packages/trac/util/__init__.py", line 1000, in appendrange a, b = int(x), int(x) ValueError: invalid literal for int() with base 10: '7014 /trunk:1-4559'
Attachments (1)
Change History (11)
comment:1 by , 9 years ago
Owner: | set to |
---|
comment:2 by , 9 years ago
comment:3 by , 9 years ago
Milestone: | 1.0.10 → 1.0.11 |
---|
comment:4 by , 9 years ago
Milestone: | 1.0.11 → 1.0.12 |
---|
by , 8 years ago
Attachment: | Screen Shot 2016-06-06 at 22.43.33.png added |
---|
follow-up: 7 comment:5 by , 8 years ago
Nice find.
The svnmerge-integrated
property is separated by spaces but newlines are used for svn:mergeinfo
.
$ svn propget -r7084 svnmerge-integrated https://svn.edgewall.org/repos/trac/trunk /branches/0.11-stable:1-6940,6942-6971,6973-6979,6981-7012,7014-7036,7077,7080,7082 /trunk:1-4559,5254-5420
According to https://svn.apache.org/repos/asf/subversion/trunk/contrib/client-side/svnmerge/svnmerge.py, svnmerge-*
property separated by any whitespace.
def dict_from_revlist_prop(propvalue): """Given a property value as a string containing per-source revision lists, return a dictionary whose key is a source path identifier and whose value is the revisions for that source.""" prop = {} # Multiple sources are separated by any whitespace. for L in propvalue.split(): # We use rsplit to play safe and allow colons in pathids. pathid_str, revs = rsplit(L.strip(), ":", 1)
comment:6 by , 8 years ago
The problem is seen in r7084, which has space-delimited svn properties rather than newline delimited properties.
The property changes are:
Index: trunk =================================================================== --- trunk (revision 7083) +++ trunk (revision 7084) Property changes on: trunk ___________________________________________________________________ Modified: svnmerge-integrated ## -1 +1 ## -/branches/0.11-stable:1-6940,6942-6971,6973-6979,6981-7012,7014-7036,7077,7080 /trunk:1-4559,5254-5420 \ No newline at end of property +/branches/0.11-stable:1-6940,6942-6971,6973-6979,6981-7012,7014-7036,7077,7080,7082 /trunk:1-4559,5254-5420 \ No newline at end of property
$ svn pg svnmerge-integrated -r 7084 https://svn.edgewall.org/repos/trac/trunk
/branches/0.11-stable:1-6940,6942-6971,6973-6979,6981-7012,7014-7036,7077,7080,7082 /trunk:1-4559,5254-5420
The property diff should be rendered like this:
The following patch seems to fix the issue:
-
tracopt/versioncontrol/svn/svn_prop.py
diff --git a/tracopt/versioncontrol/svn/svn_prop.py b/tracopt/versioncontrol/svn/svn_prop.py index eb7d1e0..3edda66 100644
a b 16 16 # Author: Christopher Lenz <cmlenz@gmx.de> 17 17 # Christian Boos <cboos@edgewall.org> 18 18 19 import re 19 20 import posixpath 20 21 21 22 from genshi.builder import tag … … class SubversionMergePropertyDiffRenderer(Component): 356 357 repos = rm.get_repository(old_context.resource.parent.id) 357 358 def parse_sources(props): 358 359 sources = {} 359 for line in props[name].splitlines():360 for line in re.split('\s+', props[name]): 360 361 path, revs = line.split(':', 1) 361 362 spath = _path_within_scope(repos.scope, path) 362 363 if spath is not None:
That's not a good solution though because paths can have whitespace, such as in this little test example that I ran:
$svn pg svn:mergeinfo trunk /branches/rel 2.0:23
Also, from what I recall properties should be newline delimited, not whitespace delimited. It looks like svnmerge-integrated
was probably created by the svnmerge
script, which I assume is a tool that was useful prior to the addition of svn:mergeinfo
in SVN 1.5.
If the svnmerge-*
properties are deprecated, and they are effectively malformed by using whitespace rather than newline delimiters, one possible resolution would be to just turn off rendering of the properties:
hide_properties = svk:merge, svnmerge-integrated, svnmerge-blocked
comment:7 by , 8 years ago
Replying to Jun Omae:
According to https://svn.apache.org/repos/asf/subversion/trunk/contrib/client-side/svnmerge/svnmerge.py,
svnmerge-*
property separated by any whitespace.def dict_from_revlist_prop(propvalue): """Given a property value as a string containing per-source revision lists, return a dictionary whose key is a source path identifier and whose value is the revisions for that source.""" prop = {} # Multiple sources are separated by any whitespace. for L in propvalue.split(): # We use rsplit to play safe and allow colons in pathids. pathid_str, revs = rsplit(L.strip(), ":", 1)
I have to assume then that svnmerge.py
would not store a path with whitespace encoding the path. With that information, maybe the proper solution involves parsing svnmerge-*
differently from svn:mergeinfo
.
comment:8 by , 8 years ago
Yeah. I think we could simply fix it like this:
-
tracopt/versioncontrol/svn/svn_prop.py
diff --git a/tracopt/versioncontrol/svn/svn_prop.py b/tracopt/versioncontrol/svn/svn_prop.py index eb7d1e037..1ac9fcd68 100644
a b class SubversionMergePropertyDiffRenderer(Component): 356 356 repos = rm.get_repository(old_context.resource.parent.id) 357 357 def parse_sources(props): 358 358 sources = {} 359 for line in props[name].splitlines(): 359 value = props[name] 360 lines = value.splitlines() if name == 'svn:mergeinfo' else \ 361 value.split() 362 for line in lines: 360 363 path, revs = line.split(':', 1) 361 364 spath = _path_within_scope(repos.scope, path) 362 365 if spath is not None:
comment:9 by , 8 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Similar to #11308.