Show More
@@ -15,6 +15,10 b'' | |||
|
15 | 15 | |
|
16 | 16 | import sys |
|
17 | 17 | from subprocess import check_call, Popen, CalledProcessError, STDOUT, PIPE |
|
18 | # cannot use argparse, python 2.7 only | |
|
19 | from optparse import OptionParser | |
|
20 | ||
|
21 | ||
|
18 | 22 | |
|
19 | 23 | def check_output(*args, **kwargs): |
|
20 | 24 | kwargs.setdefault('stderr', PIPE) |
@@ -65,16 +69,22 b' def getrevs(spec):' | |||
|
65 | 69 | return [r for r in out.split() if r] |
|
66 | 70 | |
|
67 | 71 | |
|
72 | parser = OptionParser(usage="usage: %prog [options] <revs>") | |
|
73 | parser.add_option("-f", "--file", | |
|
74 | help="read revset from FILE", metavar="FILE") | |
|
75 | ||
|
76 | (options, args) = parser.parse_args() | |
|
68 | 77 | |
|
69 | 78 | if len(sys.argv) < 2: |
|
70 | print >> sys.stderr, 'usage: %s <revs> [file]' % sys.argv[0] | |
|
79 | parser.print_help() | |
|
71 | 80 | sys.exit(255) |
|
72 | 81 | |
|
73 | target_rev = sys.argv[1] | |
|
82 | ||
|
83 | target_rev = args[0] | |
|
74 | 84 | |
|
75 | 85 | revsetsfile = sys.stdin |
|
76 | if len(sys.argv) > 2: | |
|
77 |
revsetsfile = open( |
|
|
86 | if options.file: | |
|
87 | revsetsfile = open(options.file) | |
|
78 | 88 | |
|
79 | 89 | revsets = [l.strip() for l in revsetsfile] |
|
80 | 90 |
General Comments 0
You need to be logged in to leave comments.
Login now