0
0
mirror of https://github.com/python/cpython.git synced 2024-12-01 03:01:36 +01:00
cpython/Demo/pdist/rcsbump
1995-06-23 22:05:39 +00:00

34 lines
746 B
Python
Executable File

#!/usr/local/bin/python
# -*- python -*-
#
# guido's version, from rcsbump,v 1.2 1995/06/22 21:27:27 bwarsaw Exp
#
# Python script for bumping up an RCS major revision number.
import sys
import regex
import rcslib
import string
WITHLOCK = 1
majorrev_re = regex.compile('^[0-9]+')
dir = rcslib.RCS()
if sys.argv[1:]:
files = sys.argv[1:]
else:
files = dir.listfiles()
for file in files:
# get the major revnumber of the file
headbranch = dir.info(file)['head']
majorrev_re.match(headbranch)
majorrev = string.atoi(majorrev_re.group(0)) + 1
if not dir.islocked(file):
dir.checkout(file, WITHLOCK)
msg = "Bumping major revision number (to %d)" % majorrev
dir.checkin((file, "%s.0" % majorrev), msg, "-f")