cpython/Demo/pdist/rcsbump

34 lines
751 B
Plaintext
Raw Normal View History

1999-03-12 15:05:49 -04:00
#!/usr/bin/env python
1995-06-23 19:05:39 -03:00
# -*- python -*-
1995-06-23 11:40:06 -03:00
#
1995-06-23 19:05:39 -03:00
# guido's version, from rcsbump,v 1.2 1995/06/22 21:27:27 bwarsaw Exp
1995-06-23 11:40:06 -03:00
#
# Python script for bumping up an RCS major revision number.
1995-06-23 19:05:39 -03:00
import sys
1995-06-23 11:40:06 -03:00
import regex
import rcslib
import string
WITHLOCK = 1
majorrev_re = regex.compile('^[0-9]+')
1995-06-23 19:05:39 -03:00
dir = rcslib.RCS()
1995-06-23 11:40:06 -03:00
1995-06-23 19:05:39 -03:00
if sys.argv[1:]:
files = sys.argv[1:]
else:
files = dir.listfiles()
for file in files:
1995-06-23 11:40:06 -03:00
# 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):
1998-09-14 14:51:14 -03:00
dir.checkout(file, WITHLOCK)
1995-06-23 11:40:06 -03:00
msg = "Bumping major revision number (to %d)" % majorrev
1995-06-23 19:05:39 -03:00
dir.checkin((file, "%s.0" % majorrev), msg, "-f")