1

本质上,我想要与运行相同的行为:

log = client.log(url)
oldestEntry = log[-1]

除非不必下载整个日志。我知道设置

limit=1

让您找到最新的条目。有什么方法可以限制相反的顺序吗?

4

1 回答 1

1

颠倒 and 的顺序revision_startrevision_end设置limit为 1:

import pysvn

url='http://svn.apache.org/repos/asf/httpd/httpd/trunk/README'

epoch = pysvn.Revision(pysvn.opt_revision_kind.number, 0)
head = pysvn.Revision(pysvn.opt_revision_kind.head)

client = pysvn.Client()

# Get all entries
l = client.log(url)
print len(l), l[0].revision, l[-1].revision

# Get most recent entry:
l = client.log(url, limit=1)
print len(l), l[0].revision

# Get most recent entry, again:
l = client.log(url, revision_start=head, revision_end=epoch, limit=1)
print len(l), l[0].revision

# Get least recent entry
l = client.log(url, revision_start=epoch, revision_end=head, limit=1)
print len(l), l[0].revision

结果是:

22 <Revision kind=number 1209505> <Revision kind=number 87470>
1 <Revision kind=number 1209505>
1 <Revision kind=number 1209505>
1 <Revision kind=number 87470>
于 2013-09-10T14:43:35.003 回答