Guido van Rossum | 79ed32d | 1995-06-23 14:40:06 +0000 | [diff] [blame^] | 1 | #!/usr/local/bin/python |
| 2 | # |
| 3 | # rcsbump,v 1.2 1995/06/22 21:27:27 bwarsaw Exp |
| 4 | # |
| 5 | # Python script for bumping up an RCS major revision number. |
| 6 | |
| 7 | import regex |
| 8 | import rcslib |
| 9 | import string |
| 10 | |
| 11 | WITHLOCK = 1 |
| 12 | majorrev_re = regex.compile('^[0-9]+') |
| 13 | |
| 14 | dir = rcslib.RCSDirectory() |
| 15 | |
| 16 | for file in dir.listfiles(): |
| 17 | # get the major revnumber of the file |
| 18 | headbranch = dir.info(file)['head'] |
| 19 | majorrev_re.match(headbranch) |
| 20 | majorrev = string.atoi(majorrev_re.group(0)) + 1 |
| 21 | |
| 22 | if not dir.islocked(file): |
| 23 | dir.get(file, WITHLOCK) |
| 24 | |
| 25 | msg = "Bumping major revision number (to %d)" % majorrev |
| 26 | dir.put((file, "%s.0" % majorrev), msg, "-f") |