3 # revplist.py : display revision properties
5 ######################################################################
7 # Copyright (c) 2000-2004 CollabNet. All rights reserved.
9 # This software is licensed as described in the file COPYING, which
10 # you should have received as part of this distribution. The terms
11 # are also available at http://subversion.tigris.org/license-1.html.
12 # If newer versions of this license are posted there, you may use a
13 # newer version instead, at your option.
15 ######################################################################
22 my_getopt
= getopt
.gnu_getopt
23 except AttributeError:
24 my_getopt
= getopt
.getopt
26 from svn
import fs
, core
28 def plist(rev
=None, home
='.', *props
):
30 db_path
= os
.path
.join(home
, 'db')
31 if not os
.path
.exists(db_path
):
35 fs
.open_berkeley(fs_ptr
, db_path
)
38 rev
= fs
.youngest_rev(fs_ptr
)
40 print 'Properties for revision:', rev
42 for propname
in props
:
43 value
= fs
.revision_prop(fs_ptr
, rev
, propname
)
45 print '%s: <not present>' % propname
47 print '%s: %s' % (propname
, value
)
49 proplist
= fs
.revision_proplist(fs_ptr
, rev
)
50 for propname
, value
in proplist
.items():
51 print '%s: %s' % (propname
, value
)
54 print "USAGE: %s [-r REV] [-h DBHOME] [PROP1 [PROP2 ...]]" % sys
.argv
[0]
58 ### how to invoke usage() ?
59 opts
, args
= my_getopt(sys
.argv
[1:], 'r:h:')
62 for name
, value
in opts
:
68 apply(plist
, (rev
, home
) + tuple(args
))
70 if __name__
== '__main__':