You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Marc Schlinger <ma...@pace.com> on 2011/12/08 14:07:06 UTC

Python-subversion

Hello,

I'm using subversion and python-subversion on a debian squeeze system.
The package version is 1.6.12dfsg-4.

I'm trying to modify the behavior of the changed command of the
svnlook.py file provided by python-subversion.

I'm want to show that a directory was copied by adding a "+" to the
output - the way genuine svnlook command do.

I've modified the add_directory method of the ChangedEditor as follow:

  def add_directory(self, path, parent_baton,
                    copyfrom_path, copyfrom_revision, dir_pool):

    print('A %s %s/' % ("+" if copyfrom_path else " ", path))
    return [ 0, path ]

but the copyfrom_path always equals to None.

Is there a way to have this parameter set?

Thanks,

Marc Schlinger.


This message has been scanned for viruses by BlackSpider MailControl. - www.blackspider.com

Re: Python-subversion

Posted by Daniel Shahaf <da...@elego.de>.
Marc Schlinger wrote on Fri, Dec 09, 2011 at 10:02:16 +0100:
> Le jeudi 08 décembre 2011 à 19:39 +0200, Daniel Shahaf a écrit :
> > Marc Schlinger wrote on Thu, Dec 08, 2011 at 16:00:03 +0100:
> > > Le jeudi 08 décembre 2011 à 15:20 +0200, Daniel Shahaf a écrit :
> > > > Marc Schlinger wrote on Thu, Dec 08, 2011 at 14:07:06 +0100:
> > > > > Hello,
> > > > > 
> > > > > I'm using subversion and python-subversion on a debian squeeze system.
> > > > > The package version is 1.6.12dfsg-4.
> > > > > 
> > > > > I'm trying to modify the behavior of the changed command of the
> > > > > svnlook.py file provided by python-subversion.
> > > > > 
> > > > > I'm want to show that a directory was copied by adding a "+" to the
> > > > > output - the way genuine svnlook command do.
> > > > > 
> > > > > I've modified the add_directory method of the ChangedEditor as follow:
> > > > > 
> > > > >   def add_directory(self, path, parent_baton,
> > > > >                     copyfrom_path, copyfrom_revision, dir_pool):
> > > > > 
> > > > >     print('A %s %s/' % ("+" if copyfrom_path else " ", path))
> > > > >     return [ 0, path ]
> > > > > 
> > > > > but the copyfrom_path always equals to None.
> > > > > 
> > > > > Is there a way to have this parameter set?
> > > > > 
> > > > 
> > > > What does viewvc do to cause
> > > > http://svn.apache.org/viewvc?view=revision&revision=1207555
> > > > to show "(Copied from
> > > > subversion/trunk/contrib/server-side/mod_dontdothat, r1207550)"
> > > > ?
> > > 
> > > Thanks for pointing out this project. I didn't even notice it was
> > > written in python.
> > > 
> > > To answer your question.
> > > They call the svn.fs.copied_from(rev_root, path) method to get the
> > > copyfrom_path information.
> > > 
> > > They don't seem to implement the "editor" interface, so I still don't
> > > know how to get the copyfrom_info directly in add_directory.
> > 
> > Perhaps you should use svn_repos_replay() to drive your editor?
> > 
> That's excatly what I've found in svnlook::main.c . They use
> svn_repos_replay2.
> In python it's in the subpackage repos of package svn.
> 
> The right method to use is svn.repos.replay2 because the api have
> changed.
> 
> http://subversion.apache.org/docs/api/1.6/svn__repos_8h.html#aef0fa3335d10b603cfbae5efc7a5d016
> 

Yes.  If being able to run against the 1.3 libraries isn't important to
you then you should use svn_repos_replay2() instead of svn_repos_replay().

> Since python subversion is an "dummy" binding of the subversion C api I
> think this is the right place to look at.
> 

Yes.  Note that there are also ctypes python bindings which have
a portino which is not "dummy".

> 
> Thank you for your help.
> 
> 
> > A quick look into the source of svn_repos_dir_delta2() (which is what
> > 'svnlook.py changed' uses) suggests that it always passes '(NULL,
> > SVN_INVALID_REVNUM)' for the copyfrom.
> > 
> > 
> >  Click https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg==  to report this email as spam.
> 
> 
> 
> This message has been scanned for viruses by BlackSpider MailControl. - www.blackspider.com

Re: Python-subversion

Posted by Marc Schlinger <ma...@pace.com>.
Le jeudi 08 décembre 2011 à 19:39 +0200, Daniel Shahaf a écrit :
> Marc Schlinger wrote on Thu, Dec 08, 2011 at 16:00:03 +0100:
> > Le jeudi 08 décembre 2011 à 15:20 +0200, Daniel Shahaf a écrit :
> > > Marc Schlinger wrote on Thu, Dec 08, 2011 at 14:07:06 +0100:
> > > > Hello,
> > > > 
> > > > I'm using subversion and python-subversion on a debian squeeze system.
> > > > The package version is 1.6.12dfsg-4.
> > > > 
> > > > I'm trying to modify the behavior of the changed command of the
> > > > svnlook.py file provided by python-subversion.
> > > > 
> > > > I'm want to show that a directory was copied by adding a "+" to the
> > > > output - the way genuine svnlook command do.
> > > > 
> > > > I've modified the add_directory method of the ChangedEditor as follow:
> > > > 
> > > >   def add_directory(self, path, parent_baton,
> > > >                     copyfrom_path, copyfrom_revision, dir_pool):
> > > > 
> > > >     print('A %s %s/' % ("+" if copyfrom_path else " ", path))
> > > >     return [ 0, path ]
> > > > 
> > > > but the copyfrom_path always equals to None.
> > > > 
> > > > Is there a way to have this parameter set?
> > > > 
> > > 
> > > What does viewvc do to cause
> > > http://svn.apache.org/viewvc?view=revision&revision=1207555
> > > to show "(Copied from
> > > subversion/trunk/contrib/server-side/mod_dontdothat, r1207550)"
> > > ?
> > 
> > Thanks for pointing out this project. I didn't even notice it was
> > written in python.
> > 
> > To answer your question.
> > They call the svn.fs.copied_from(rev_root, path) method to get the
> > copyfrom_path information.
> > 
> > They don't seem to implement the "editor" interface, so I still don't
> > know how to get the copyfrom_info directly in add_directory.
> 
> Perhaps you should use svn_repos_replay() to drive your editor?
> 
That's excatly what I've found in svnlook::main.c . They use
svn_repos_replay2.
In python it's in the subpackage repos of package svn.

The right method to use is svn.repos.replay2 because the api have
changed.

http://subversion.apache.org/docs/api/1.6/svn__repos_8h.html#aef0fa3335d10b603cfbae5efc7a5d016

Since python subversion is an "dummy" binding of the subversion C api I
think this is the right place to look at.


Thank you for your help.


> A quick look into the source of svn_repos_dir_delta2() (which is what
> 'svnlook.py changed' uses) suggests that it always passes '(NULL,
> SVN_INVALID_REVNUM)' for the copyfrom.
> 
> 
>  Click https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg==  to report this email as spam.



This message has been scanned for viruses by BlackSpider MailControl. - www.blackspider.com

Re: Python-subversion

Posted by Daniel Shahaf <da...@elego.de>.
Marc Schlinger wrote on Thu, Dec 08, 2011 at 16:00:03 +0100:
> Le jeudi 08 décembre 2011 à 15:20 +0200, Daniel Shahaf a écrit :
> > Marc Schlinger wrote on Thu, Dec 08, 2011 at 14:07:06 +0100:
> > > Hello,
> > > 
> > > I'm using subversion and python-subversion on a debian squeeze system.
> > > The package version is 1.6.12dfsg-4.
> > > 
> > > I'm trying to modify the behavior of the changed command of the
> > > svnlook.py file provided by python-subversion.
> > > 
> > > I'm want to show that a directory was copied by adding a "+" to the
> > > output - the way genuine svnlook command do.
> > > 
> > > I've modified the add_directory method of the ChangedEditor as follow:
> > > 
> > >   def add_directory(self, path, parent_baton,
> > >                     copyfrom_path, copyfrom_revision, dir_pool):
> > > 
> > >     print('A %s %s/' % ("+" if copyfrom_path else " ", path))
> > >     return [ 0, path ]
> > > 
> > > but the copyfrom_path always equals to None.
> > > 
> > > Is there a way to have this parameter set?
> > > 
> > 
> > What does viewvc do to cause
> > http://svn.apache.org/viewvc?view=revision&revision=1207555
> > to show "(Copied from
> > subversion/trunk/contrib/server-side/mod_dontdothat, r1207550)"
> > ?
> 
> Thanks for pointing out this project. I didn't even notice it was
> written in python.
> 
> To answer your question.
> They call the svn.fs.copied_from(rev_root, path) method to get the
> copyfrom_path information.
> 
> They don't seem to implement the "editor" interface, so I still don't
> know how to get the copyfrom_info directly in add_directory.

Perhaps you should use svn_repos_replay() to drive your editor?

A quick look into the source of svn_repos_dir_delta2() (which is what
'svnlook.py changed' uses) suggests that it always passes '(NULL,
SVN_INVALID_REVNUM)' for the copyfrom.

Re: Python-subversion

Posted by Marc Schlinger <ma...@pace.com>.
Le jeudi 08 décembre 2011 à 15:20 +0200, Daniel Shahaf a écrit :
> Marc Schlinger wrote on Thu, Dec 08, 2011 at 14:07:06 +0100:
> > Hello,
> > 
> > I'm using subversion and python-subversion on a debian squeeze system.
> > The package version is 1.6.12dfsg-4.
> > 
> > I'm trying to modify the behavior of the changed command of the
> > svnlook.py file provided by python-subversion.
> > 
> > I'm want to show that a directory was copied by adding a "+" to the
> > output - the way genuine svnlook command do.
> > 
> > I've modified the add_directory method of the ChangedEditor as follow:
> > 
> >   def add_directory(self, path, parent_baton,
> >                     copyfrom_path, copyfrom_revision, dir_pool):
> > 
> >     print('A %s %s/' % ("+" if copyfrom_path else " ", path))
> >     return [ 0, path ]
> > 
> > but the copyfrom_path always equals to None.
> > 
> > Is there a way to have this parameter set?
> > 
> 
> What does viewvc do to cause
> http://svn.apache.org/viewvc?view=revision&revision=1207555
> to show "(Copied from
> subversion/trunk/contrib/server-side/mod_dontdothat, r1207550)"
> ?

Thanks for pointing out this project. I didn't even notice it was
written in python.

To answer your question.
They call the svn.fs.copied_from(rev_root, path) method to get the
copyfrom_path information.

They don't seem to implement the "editor" interface, so I still don't
know how to get the copyfrom_info directly in add_directory.


> 
> > Thanks,
> > 
> > Marc Schlinger.
> > 
> > 




This message has been scanned for viruses by BlackSpider MailControl. - www.blackspider.com

Re: Python-subversion

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Marc Schlinger wrote on Thu, Dec 08, 2011 at 14:07:06 +0100:
> Hello,
> 
> I'm using subversion and python-subversion on a debian squeeze system.
> The package version is 1.6.12dfsg-4.
> 
> I'm trying to modify the behavior of the changed command of the
> svnlook.py file provided by python-subversion.
> 
> I'm want to show that a directory was copied by adding a "+" to the
> output - the way genuine svnlook command do.
> 
> I've modified the add_directory method of the ChangedEditor as follow:
> 
>   def add_directory(self, path, parent_baton,
>                     copyfrom_path, copyfrom_revision, dir_pool):
> 
>     print('A %s %s/' % ("+" if copyfrom_path else " ", path))
>     return [ 0, path ]
> 
> but the copyfrom_path always equals to None.
> 
> Is there a way to have this parameter set?
> 

What does viewvc do to cause
http://svn.apache.org/viewvc?view=revision&revision=1207555
to show "(Copied from
subversion/trunk/contrib/server-side/mod_dontdothat, r1207550)"
?

> Thanks,
> 
> Marc Schlinger.
> 
> 
> This message has been scanned for viruses by BlackSpider MailControl. - www.blackspider.com