Changeset 885 in tailor
- Timestamp:
- 10/05/05 10:32:48 (8 years ago)
- Hash name:
- 20051005083248-d21f0-8f92e53d5d5eb7c79537e5aa6081541b7014f5c6
- File:
-
- 1 edited
-
vcpx/cvs.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
vcpx/cvs.py
r872 r885 17 17 from config import ConfigurationError 18 18 19 def compare_cvs_revs(rev1, rev2):20 """Co mpare two CVS revision numerically, not alphabetically."""21 22 if not rev1: rev1 = '0'23 if not rev 2: rev2= '0'19 def normalize_cvs_rev(rev): 20 """Convert a revision string to a tuple of numbers, eliminating the 21 penultimate zero in a 'magic branch number' if there is one. 22 1.1.1.1 is converted to (1,1). """ 23 if not rev: rev = '0' 24 24 25 25 # handle locked files by taking only the first part of the 26 26 # revision string to handle gracefully lines like "1.1 locked" 27 rev1 = rev1.split(' ')[0] 28 rev2 = rev2.split(' ')[0] 29 r1 = [int(n) for n in rev1.split('.')] 30 r2 = [int(n) for n in rev2.split('.')] 27 rev = rev.split(' ')[0] 28 29 r = [int(n) for n in rev.split('.')] 30 # convert "magic branch numbers" like 1.2.0.2 to regular 31 # branch numbers like 1.2.2. 32 if len(r) > 2 and r[-2] == 0: 33 r = r[0:-2] + r[-1:] 34 35 if r == [1,1,1,1]: 36 r = [1,1] 37 38 return tuple(r) 39 40 def compare_cvs_revs(revstr1, revstr2): 41 """Compare two CVS revision strings numerically, not alphabetically.""" 42 43 r1 = normalize_cvs_rev(revstr1) 44 r2 = normalize_cvs_rev(revstr2) 31 45 32 46 return cmp(r1, r2)
Note: See TracChangeset
for help on using the changeset viewer.
