Pysvn client.log () returns an empty dictionary

I have the following script that I use to receive log messages from svn

import pysvn class svncheck(): def __init__(self, svn_root="http://10.11.25.3/svn/Moodle/modules", svn_user=None, svn_password=None): self.user = svn_user self.password = svn_password self.root = svn_root def diffrence(self): client = pysvn.Client() client.commit_info_style = 1 client.callback_notify = self.notify client.callback_get_login = self.credentials log = client.log( self.root, revision_start=pysvn.Revision( pysvn.opt_revision_kind.number, 0), revision_end=pysvn.Revision( pysvn.opt_revision_kind.number, 5829), discover_changed_paths=True, strict_node_history=True, limit=0, include_merged_revisions=False, ) print log def notify( event_dict ): print event_dict return def credentials(realm, username, may_save): return True, self.user, self.password, True s = svncheck() s.diffrence() 

when I run this script, returning an empty dictionary object [<PysvnLog ''>, <PysvnLog ''>, <PysvnLog ''>,..

any idea what i'm doing wrong here? I am using pysvn version 1.7.2, built again svn version 1.6.5 cheers Nash

+4
source share
2 answers

The pysvn.Client.log method returns a list of log entries; each journal entry is a dictionary. (see pysvn programmer's reference )

you can print log messages in your code as follows:

 for info in log: print info.revision.number, print info.author, print time.ctime(info.date), print info.message 
+7
source

finally got it to work, and it seems I didn’t quite understand how this particular function worked, anyway ... I thought that I would share with my friends!

  start_rev = 10 end_rev = 30 url = http://dipidi.do.da/svn/foobar log_dict = dict((log.revision.number, log["message"]) for log in pysvn.Client().log(url, revision_start=pysvn.Revision( pysvn.opt_revision_kind.number, start_rev ), revision_end=pysvn.Revision( pysvn.opt_revision_kind.number, end_rev ), discover_changed_paths=True, strict_node_history=True, limit=0)) pprint(log_dict) 

if you don't like the concepts

  for log in pysvn.Client().log(url, revision_start=pysvn.Revision( pysvn.opt_revision_kind.number, start_rev ), revision_end=pysvn.Revision( pysvn.opt_revision_kind.number, end_rev ), discover_changed_paths=True, strict_node_history=True, limit=0): print log.revision.number, log["author"], log["message"] 

The Understanding option gives me the following

  {10: 'testing my commits', 11: 'whohooo this stuff is fun'} 
+2
source

Source: https://habr.com/ru/post/1309851/


All Articles