1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#! /usr/bin/python
# A simple script to check the status of the translation.
import sys, string
from pprint import pprint
def chop (line):
if line[-2:] == '\r\n':
line = line[:-2]
if line[-1:] == '\n':
line = line[:-1]
return line
def cmprevision (a, b):
'''revisions are something delimited with dots'''
return cmp (map (lambda x: x.lower (), a.split ('.')), map (lambda x: x.lower (), b.split ('.')))
name = None
revision = None
files = {}
for line in sys.stdin.readlines ():
parts = string.split (chop (line))
if len (parts) > 0:
if parts[0] == 'File:':
name = parts[1]
elif parts[0] == 'Repository':
files[name] = parts[2]
# pprint (files)
action = 0
for line in open ('status', 'r').readlines ():
parts = string.split (chop (line))
if len (parts) > 0:
if files.has_key (parts[0]):
pass # check the version
relation = cmprevision (parts[1], files[parts[0]])
if relation < 0:
print 'Update: %s (%s -> %s)' % (parts[0], parts[1], files[parts[0]])
action = 1
elif relation > 0:
print 'Downgrade?: %s (%s -> %s)' % (parts[0], parts[1], files[parts[0]])
action = 1
del files[parts[0]] # delete the item
else:
print 'Delete:', parts[0]
action = 1
for file in files.keys ():
print 'New:', file
action = 1
if not action:
print 'You are translating the latest versions'
|