Guido van Rossum | 7e75c94 | 1999-03-12 19:05:49 +0000 | [diff] [blame] | 1 | #!/usr/bin/env python |
Guido van Rossum | 40de53c | 1995-06-23 22:05:39 +0000 | [diff] [blame] | 2 | # -*- python -*- |
Guido van Rossum | 79ed32d | 1995-06-23 14:40:06 +0000 | [diff] [blame] | 3 | # |
Guido van Rossum | 40de53c | 1995-06-23 22:05:39 +0000 | [diff] [blame] | 4 | # guido's version, from rcsbump,v 1.2 1995/06/22 21:27:27 bwarsaw Exp |
Guido van Rossum | 79ed32d | 1995-06-23 14:40:06 +0000 | [diff] [blame] | 5 | # |
| 6 | # Python script for bumping up an RCS major revision number. |
| 7 | |
Guido van Rossum | 40de53c | 1995-06-23 22:05:39 +0000 | [diff] [blame] | 8 | import sys |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 9 | import re |
Guido van Rossum | 79ed32d | 1995-06-23 14:40:06 +0000 | [diff] [blame] | 10 | import rcslib |
| 11 | import string |
| 12 | |
| 13 | WITHLOCK = 1 |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 14 | majorrev_re = re.compile('^[0-9]+') |
Guido van Rossum | 79ed32d | 1995-06-23 14:40:06 +0000 | [diff] [blame] | 15 | |
Guido van Rossum | 40de53c | 1995-06-23 22:05:39 +0000 | [diff] [blame] | 16 | dir = rcslib.RCS() |
Guido van Rossum | 79ed32d | 1995-06-23 14:40:06 +0000 | [diff] [blame] | 17 | |
Guido van Rossum | 40de53c | 1995-06-23 22:05:39 +0000 | [diff] [blame] | 18 | if sys.argv[1:]: |
| 19 | files = sys.argv[1:] |
| 20 | else: |
| 21 | files = dir.listfiles() |
| 22 | |
| 23 | for file in files: |
Guido van Rossum | 79ed32d | 1995-06-23 14:40:06 +0000 | [diff] [blame] | 24 | # get the major revnumber of the file |
| 25 | headbranch = dir.info(file)['head'] |
| 26 | majorrev_re.match(headbranch) |
| 27 | majorrev = string.atoi(majorrev_re.group(0)) + 1 |
| 28 | |
| 29 | if not dir.islocked(file): |
Guido van Rossum | 5fae9e8 | 1998-09-14 17:51:14 +0000 | [diff] [blame] | 30 | dir.checkout(file, WITHLOCK) |
Guido van Rossum | 79ed32d | 1995-06-23 14:40:06 +0000 | [diff] [blame] | 31 | |
| 32 | msg = "Bumping major revision number (to %d)" % majorrev |
Guido van Rossum | 40de53c | 1995-06-23 22:05:39 +0000 | [diff] [blame] | 33 | dir.checkin((file, "%s.0" % majorrev), msg, "-f") |