1 | #!/usr/bin/python |
---|
2 | # |
---|
3 | # This program will convert the output of "svn log" to be suitable |
---|
4 | # for usage in an rpm %changelog session. |
---|
5 | # |
---|
6 | from RepSys import Error |
---|
7 | from RepSys.command import * |
---|
8 | from RepSys.log import svn2rpm |
---|
9 | import getopt |
---|
10 | import sys |
---|
11 | |
---|
12 | HELP = """\ |
---|
13 | Usage: repsys rpmlog [OPTIONS] REPPKGDIRURL |
---|
14 | |
---|
15 | Options: |
---|
16 | -r REV Collect logs from given revision to revision 0 |
---|
17 | -n NUM Output only last NUM entries |
---|
18 | -T FILE %changelog template file to be used |
---|
19 | -h Show this message |
---|
20 | |
---|
21 | Examples: |
---|
22 | repsys rpmlog https://repos/snapshot/python |
---|
23 | """ |
---|
24 | |
---|
25 | def parse_options(): |
---|
26 | parser = OptionParser(help=HELP) |
---|
27 | parser.add_option("-r", dest="revision") |
---|
28 | parser.add_option("-n", dest="size", type="int") |
---|
29 | parser.add_option("-T", "--template", dest="template", type="string") |
---|
30 | opts, args = parser.parse_args() |
---|
31 | if len(args) != 1: |
---|
32 | raise Error, "invalid arguments" |
---|
33 | opts.pkgdirurl = default_parent(args[0]) |
---|
34 | return opts |
---|
35 | |
---|
36 | def rpmlog(pkgdirurl, revision, size, template): |
---|
37 | sys.stdout.write(svn2rpm(pkgdirurl, revision, size, template=template)) |
---|
38 | |
---|
39 | def main(): |
---|
40 | do_command(parse_options, rpmlog) |
---|
41 | |
---|
42 | # vim:sw=4:ts=4:et |
---|