Re: [PATCH] svnlook.py: Make it usable as a library
From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Thu, 14 Nov 2013 11:13:09 +0000 (GMT)
anatoly techtonik wrote:
That makes sense. I'm not sure what to put in the __version__ string, but the most common way to identify the version of other scripts in the 'tools' directory in our repository seems to be by adding these three lines:
Would you be happy with this? I've committed that in r1541878, but am happy to change it.
>> @@ -76,7 +74,7 @@ class SVNLook(object):
OK, so this is basically for the convenience of callers that might want to pass a string. I'll do it like this:
# if set, txn takes precendence
Also related to revision numbers, I noticed that the 'changed' and 'dirs-changed' and 'diff' commands would fail with rev=0, because they tried to set base_rev=-1. To fix those, I'll add:
def _walk_tree(self, e_factory, base_rev=None, pass_root=0, callback=None):
(With the current code, a 'return' statement would be equivalent, but this way avoids making assumptions.)
I committed these two changes (and a tweak to the doc string) in revision 1541873.
>> def cmd_date(self):
You are right that the output was (and is) different. I am happy to change the format to be the same as 'svnlook'); the only problems were (1) it was an unrelated change and (2) it broke if a revision had no date property.
I have added "if secs is None: print('')" to fix the latter, and committed it as revision 1541877.
>> def get_date(self, unixtime=False):
It's possible for a committed revision to not have a svn:date property. Although the property is always created on commit, it can be removed by "svn propdel --revprop -r X svn:date".
> Anyway, LGTM without any more fixes.
Thanks. Let me know if you would like any more changes.
This is an archived mail posted to the Subversion Dev mailing list.