~ubuntu-branches/ubuntu/maverick/python3.1/maverick

« back to all changes in this revision

Viewing changes to Demo/pdist/rcsbump

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-03-23 00:01:27 UTC
  • Revision ID: james.westby@ubuntu.com-20090323000127-5fstfxju4ufrhthq
Tags: upstream-3.1~a1+20090322
ImportĀ upstreamĀ versionĀ 3.1~a1+20090322

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
# -*- python -*-
 
3
#
 
4
# guido's version, from rcsbump,v 1.2 1995/06/22 21:27:27 bwarsaw Exp
 
5
#
 
6
# Python script for bumping up an RCS major revision number.
 
7
 
 
8
import sys
 
9
import re
 
10
import rcslib
 
11
import string
 
12
 
 
13
WITHLOCK = 1
 
14
majorrev_re = re.compile('^[0-9]+')
 
15
 
 
16
dir = rcslib.RCS()
 
17
 
 
18
if sys.argv[1:]:
 
19
    files = sys.argv[1:]
 
20
else:
 
21
    files = dir.listfiles()
 
22
 
 
23
for file in files:
 
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):
 
30
        dir.checkout(file, WITHLOCK)
 
31
 
 
32
    msg = "Bumping major revision number (to %d)" % majorrev
 
33
    dir.checkin((file, "%s.0" % majorrev), msg, "-f")