You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Jeremy Whitlock <jc...@gmail.com> on 2008/08/04 21:47:56 UTC

[PATCH] Fix svnlook.py Problem Where 'diff' Results in Error

Hi All,
    I've been trying to use tool/examples/svnlook.py in a project at
work and whenever I ran svnlook.py with the 'diff' command, whenever
the revision being diffed had changes to a versioned file, an error
was always thrown:

python svnlook.py /opt/repos/svn/test/ rev 4 diff
Traceback (most recent call last):
  File "svnlook.py", line 386, in <module>
    main()
  File "svnlook.py", line 383, in main
    SVNLook(sys.argv[1], cmd, rev, txn)
  File "svnlook.py", line 38, in __init__
    getattr(self, 'cmd_' + cmd)()
  File "svnlook.py", line 70, in cmd_diff
    self._print_tree(DiffEditor, pass_root=1)
  File "svnlook.py", line 128, in _print_tree
    e_ptr, e_baton, authz_cb, 0, 1, 0, 0)
  File "/opt/subversion/lib/svn-python/libsvn/repos.py", line 294, in
svn_repos_dir_delta
    return apply(_repos.svn_repos_dir_delta, args)
  File "svnlook.py", line 306, in apply_textdelta
    self._do_diff(file_baton[2], file_baton[2], file_baton[3])
IndexError: list index out of range

Google reported that others were having the same issue but I found no
fix.  After looking at the sources, I see that DiffEditor._do_diff()
accepts only 3 arguments, instead of the 4 being passed, and the 4th
argument was actually the culprit for this error, since the file_baton
only had 3 elements.  This patch fixes this issue by removing the 4th
argument to DiffEditor._do_diff() and the result is an svnlook.py
which properly diffs versioned files.

Take care,

Jeremy

Re: [PATCH] Fix svnlook.py Problem Where 'diff' Results in Error

Posted by Julian Foad <ju...@btopenworld.com>.
On Mon, 2008-08-04 at 15:47 -0600, Jeremy Whitlock wrote:
>     I've been trying to use tool/examples/svnlook.py in a project at
> work and whenever I ran svnlook.py with the 'diff' command, whenever
> the revision being diffed had changes to a versioned file, an error
> was always thrown:
[...]

Thanks, Jeremy. Confirmed. I looked at the history of that file with
"svn blame" and see that this error was introduced in r16215.

I committed your patch in r32367.

- Julian



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org