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

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

From: Jeremy Whitlock <jcscoobyrs_at_gmail.com>
Date: Mon, 4 Aug 2008 15:47:56 -0600

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org

Received on 2008-08-04 23:48:14 CEST

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.