sapling/tests/seq.py
Stanislau Hlebik 6f3cfe5684 scmprompt: output only one remote bookmark
Summary:
Recently I had this scm prompt:
{F64910275}

This is not user friendly. I suggest to output at most one remote bookmark

Also this diff copies `seq.py` from upstream hg repo

Test Plan: Run scm prompt tests on devserver and mac and with '--shell=zsh'

Reviewers: rmcelroy

Reviewed By: rmcelroy

Subscribers: simonfar, wez, mjpieters, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D4197242

Signature: t1:4197242:1483466446:cd1fe943dc99fde0600a4e20994fa4b0f971f72a
2017-01-04 00:23:16 -08:00

25 lines
500 B
Python
Executable File

#!/usr/bin/env python
#
# A portable replacement for 'seq'
#
# Usage:
# seq STOP [1, STOP] stepping by 1
# seq START STOP [START, STOP] stepping by 1
# seq START STEP STOP [START, STOP] stepping by STEP
from __future__ import absolute_import, print_function
import sys
start = 1
if len(sys.argv) > 2:
start = int(sys.argv[1])
step = 1
if len(sys.argv) > 3:
step = int(sys.argv[2])
stop = int(sys.argv[-1]) + 1
for i in xrange(start, stop, step):
print(i)