Edgewall Software
Modify

Ticket #4830 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

node = repository.has_node( path, repository.youngest_rev ) worked in trac 10.1 busted in 10.3

Reported by: edunne Owned by: cboos
Priority: normal Milestone: 0.10.4
Component: version control Version: 0.10.3
Severity: normal Keywords: svn
Cc:
Release Notes:
API Changes:

Description (last modified by cboos) (diff)

I'm loggin this as a defect, although I'm not entirely sure it is as TRAC seems to work fine, but something changed between trac 10.1 and trac 10.3 in the TRAC api.

I wrote a plugin for trac and this used to work in trac 10.1. In Trac 10.3 this call pukes and says long expected instead recieved a unicode character. The thing is I'm using the constants as provided by the TRAC api, so I don't know why this should blow up.

I suppose I can cast the second arguement to a long( repository.youngest_rev) but this seem a bit odd to do.

If I try and not give the revision argument and let the rev equal it's default arg of rev=None the call pukes saying 3 args expected.

I've included both stack traces. I'm not entirely sure what changed between 10.1 and 10.3. I'm stumped on this. Potentially I'm just using the TRAC api incorrectly.

Traceback (most recent call last):
  File "C:\Python24\Lib\site-packages\trac\web\main.py", line 387, in dispatch_request
    dispatcher.dispatch(req)
  File "C:\Python24\Lib\site-packages\trac\web\main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "build\bdist.win32\egg\testManagementPlugin\testManager.py", line 83, in process_request
  File "build\bdist.win32\egg\testManagementPlugin\testRuns.py", line 40, in process_testmanager_request
  File "build\bdist.win32\egg\testManagementPlugin\properties.py", line 47, in hasTestCases
  File "C:\Python24\Lib\site-packages\trac\versioncontrol\cache.py", line 110, in has_node
    return self.repos.has_node(path, rev)
  File "C:\Python24\Lib\site-packages\trac\versioncontrol\svn_fs.py", line 319, in has_node
    rev_root = fs.revision_root(self.fs_ptr, rev, pool())
  File "C:\Python24\Lib\site-packages\libsvn\fs.py", line 218, in svn_fs_revision_root
    return apply(_fs.svn_fs_revision_root, args)
TypeError: argument number 2: a 'long' is expected, 'unicode(1)' is received

second stack trace:

Traceback (most recent call last):
  File "C:\Python24\Lib\site-packages\trac\web\main.py", line 387, in dispatch_request
    dispatcher.dispatch(req)
  File "C:\Python24\Lib\site-packages\trac\web\main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "c:\python24\lib\site-packages\testManagementPlugin-0.0.2-py2.4.egg\testManagementPlugin\testManager.py", line 83, in process_request
    template, content_type = pageProvider.process_testmanager_request( req )
  File "c:\python24\lib\site-packages\testManagementPlugin-0.0.2-py2.4.egg\testManagementPlugin\testRuns.py", line 40, in process_testmanager_request
    hasTestCases, path = self.properties.hasTestCases( self, req )
  File "c:\python24\lib\site-packages\testManagementPlugin-0.0.2-py2.4.egg\testManagementPlugin\properties.py", line 45, in hasTestCases
    return repository.has_node( testcasePath ), testcasePath
TypeError: has_node() takes exactly 3 arguments (2 given)

Attachments

Change History

comment:1 Changed 5 years ago by cboos

  • Component changed from general to version control
  • Description modified (diff)
  • Keywords svn added
  • Milestone set to 0.10.4
  • Owner changed from jonas to cboos
  • Version set to 0.10.3

Thanks for the report, I'll have a look into this.

comment:2 Changed 5 years ago by anonymous

  • Summary changed from node = repository.get_node( path, repository.youngest_rev ) worked in trac 10.1 busted in 10.3 to node = repository.has_node( path, repository.youngest_rev ) worked in trac 10.1 busted in 10.3

sorry as the stack trac suggests it was repository.has_node that doesn't work anymore. repository.get_node still works fine.

I've changed the summary to reflect this.

comment:3 Changed 5 years ago by cboos

  • Milestone changed from 0.10.5 to 0.10.4

I think this problem was due to repository.youngest_rev becoming a string in 0.10.3.

I think I'll modify slightly the patch in #4586, so that this is again always a number.

comment:4 Changed 5 years ago by anonymous

hmmm, I'm not convinced that the problem is whether it's a string or not. The behvavior has changed only in repository.has_node( path, repository.youngest_rev). repository.get_node( path, repository.youngest_rev) works fine still and it uses the same property.

I did a search fro where get_node is used in the TRAC source, and I couldn't find many refrences to that method call. get_node is used all over the place.

comment:5 Changed 5 years ago by anonymous

sorry this should have said:

I did a search fro where has_node ... not get_node.

so just to be clear get_node is used all over the place, has_node isn't.

comment:6 Changed 5 years ago by cboos

  • Resolution set to fixed
  • Status changed from new to closed

Ok, the has_node was indeed broken. This should be fixed by r4997 (trunk) and r4998 (0.10-stable).

comment:7 Changed 5 years ago by anonymous

cool thanks.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from cboos. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.