Mercurial > hg
annotate tests/seq.py @ 26538:5c9ec1cc671a
revset: strip off "literal:" prefix from bookmark not found error
This is what branch() and tag() do.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 07 Oct 2015 23:04:31 +0900 |
parents | f554f89a2038 |
children | ff3be5a325bc |
rev | line source |
---|---|
24360
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
2 # |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
3 # A portable replacement for 'seq' |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
4 # |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
5 # Usage: |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
6 # seq STOP [1, STOP] stepping by 1 |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
7 # seq START STOP [START, STOP] stepping by 1 |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
8 # seq START STEP STOP [START, STOP] stepping by STEP |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
9 |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
10 import sys |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
11 |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
12 start = 1 |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
13 if len(sys.argv) > 2: |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
14 start = int(sys.argv[1]) |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
15 |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
16 step = 1 |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
17 if len(sys.argv) > 3: |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
18 step = int(sys.argv[2]) |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
19 |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
20 stop = int(sys.argv[-1]) + 1 |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
21 |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
22 for i in xrange(start, stop, step): |
f554f89a2038
tests: introduce 'seq.py' as a portable replacement for 'seq'
Matt Harbison <matt_harbison@yahoo.com>
parents:
diff
changeset
|
23 print i |