Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ed5b3d8

Browse files
committed
give in to tab police
1 parent 3db0e37 commit ed5b3d8

6 files changed

Lines changed: 440 additions & 435 deletions

File tree

Tools/scripts/cvsfiles.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,53 +20,53 @@
2020

2121
def main():
2222
try:
23-
opts, args = getopt.getopt(sys.argv[1:], "n:")
23+
opts, args = getopt.getopt(sys.argv[1:], "n:")
2424
except getopt.error, msg:
25-
print msg
26-
print __doc__,
27-
return 1
25+
print msg
26+
print __doc__,
27+
return 1
2828
global cutofftime
2929
newerfile = None
3030
for o, a in opts:
31-
if o == '-n':
32-
cutofftime = getmtime(a)
31+
if o == '-n':
32+
cutofftime = getmtime(a)
3333
if args:
34-
for arg in args:
35-
process(arg)
34+
for arg in args:
35+
process(arg)
3636
else:
37-
process(".")
37+
process(".")
3838

3939
def process(dir):
4040
cvsdir = 0
4141
subdirs = []
4242
names = os.listdir(dir)
4343
for name in names:
44-
fullname = os.path.join(dir, name)
45-
if name == "CVS":
46-
cvsdir = fullname
47-
else:
48-
if os.path.isdir(fullname):
49-
if not os.path.islink(fullname):
50-
subdirs.append(fullname)
44+
fullname = os.path.join(dir, name)
45+
if name == "CVS":
46+
cvsdir = fullname
47+
else:
48+
if os.path.isdir(fullname):
49+
if not os.path.islink(fullname):
50+
subdirs.append(fullname)
5151
if cvsdir:
52-
entries = os.path.join(cvsdir, "Entries")
53-
for e in open(entries).readlines():
54-
words = string.split(e, '/')
55-
if words[0] == '' and words[1:]:
56-
name = words[1]
57-
fullname = os.path.join(dir, name)
58-
if cutofftime and getmtime(fullname) <= cutofftime:
59-
pass
60-
else:
61-
print fullname
52+
entries = os.path.join(cvsdir, "Entries")
53+
for e in open(entries).readlines():
54+
words = string.split(e, '/')
55+
if words[0] == '' and words[1:]:
56+
name = words[1]
57+
fullname = os.path.join(dir, name)
58+
if cutofftime and getmtime(fullname) <= cutofftime:
59+
pass
60+
else:
61+
print fullname
6262
for sub in subdirs:
63-
process(sub)
63+
process(sub)
6464

6565
def getmtime(filename):
6666
try:
67-
st = os.stat(filename)
67+
st = os.stat(filename)
6868
except os.error:
69-
return 0
69+
return 0
7070
return st[stat.ST_MTIME]
7171

7272
sys.exit(main())

Tools/scripts/fixnotice.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,18 @@
5050
def main():
5151
args = sys.argv[1:]
5252
if not args:
53-
print "No arguments."
53+
print "No arguments."
5454
for arg in args:
55-
process(arg)
55+
process(arg)
5656

5757
def process(arg):
5858
f = open(arg)
5959
data = f.read()
6060
f.close()
6161
i = string.find(data, OLD_NOTICE)
6262
if i < 0:
63-
## print "No old notice in", arg
64-
return
63+
## print "No old notice in", arg
64+
return
6565
data = data[:i] + NEW_NOTICE + data[i+len(OLD_NOTICE):]
6666
new = arg + ".new"
6767
backup = arg + ".bak"

Tools/scripts/linktree.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,25 @@ def linknames(old, new, link):
5555
print old + ': warning: cannot listdir:', msg
5656
return
5757
for name in names:
58-
if name not in (os.curdir, os.pardir):
59-
oldname = os.path.join(old, name)
60-
linkname = os.path.join(link, name)
61-
newname = os.path.join(new, name)
62-
if debug > 1: print oldname, newname, linkname
63-
if os.path.isdir(oldname) and not os.path.islink(oldname):
64-
try:
65-
os.mkdir(newname, 0777)
66-
ok = 1
67-
except:
68-
print newname + ': warning: cannot mkdir:', msg
69-
ok = 0
70-
if ok:
71-
linkname = os.path.join(os.pardir, linkname)
72-
linknames(oldname, newname, linkname)
73-
else:
74-
os.symlink(linkname, newname)
58+
if name not in (os.curdir, os.pardir):
59+
oldname = os.path.join(old, name)
60+
linkname = os.path.join(link, name)
61+
newname = os.path.join(new, name)
62+
if debug > 1: print oldname, newname, linkname
63+
if os.path.isdir(oldname) and \
64+
not os.path.islink(oldname):
65+
try:
66+
os.mkdir(newname, 0777)
67+
ok = 1
68+
except:
69+
print newname + \
70+
': warning: cannot mkdir:', msg
71+
ok = 0
72+
if ok:
73+
linkname = os.path.join(os.pardir,
74+
linkname)
75+
linknames(oldname, newname, linkname)
76+
else:
77+
os.symlink(linkname, newname)
7578

7679
sys.exit(main())

Tools/scripts/logmerge.py

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@
2626

2727
import os, sys, getopt, string, re
2828

29-
sep1 = '='*77 + '\n' # file separator
30-
sep2 = '-'*28 + '\n' # revision separator
29+
sep1 = '='*77 + '\n' # file separator
30+
sep2 = '-'*28 + '\n' # revision separator
3131

3232
def main():
3333
"""Main program"""
3434
truncate_last = 0
3535
opts, args = getopt.getopt(sys.argv[1:], "-t")
3636
for o, a in opts:
37-
if o == '-t':
38-
truncate_last = 1
37+
if o == '-t':
38+
truncate_last = 1
3939
database = []
4040
while 1:
41-
chunk = read_chunk(sys.stdin)
42-
if not chunk:
43-
break
44-
records = digest_chunk(chunk)
45-
if truncate_last:
46-
del records[-1]
47-
database[len(database):] = records
41+
chunk = read_chunk(sys.stdin)
42+
if not chunk:
43+
break
44+
records = digest_chunk(chunk)
45+
if truncate_last:
46+
del records[-1]
47+
database[len(database):] = records
4848
database.sort()
4949
database.reverse()
5050
format_output(database)
@@ -58,19 +58,19 @@ def read_chunk(fp):
5858
chunk = []
5959
lines = []
6060
while 1:
61-
line = fp.readline()
62-
if not line:
63-
break
64-
if line == sep1:
65-
if lines:
66-
chunk.append(lines)
67-
break
68-
if line == sep2:
69-
if lines:
70-
chunk.append(lines)
71-
lines = []
72-
else:
73-
lines.append(line)
61+
line = fp.readline()
62+
if not line:
63+
break
64+
if line == sep1:
65+
if lines:
66+
chunk.append(lines)
67+
break
68+
if line == sep2:
69+
if lines:
70+
chunk.append(lines)
71+
lines = []
72+
else:
73+
lines.append(line)
7474
return chunk
7575

7676
def digest_chunk(chunk):
@@ -79,53 +79,53 @@ def digest_chunk(chunk):
7979
key = 'Working file:'
8080
keylen = len(key)
8181
for line in lines:
82-
if line[:keylen] == key:
83-
working_file = string.strip(line[keylen:])
84-
break
82+
if line[:keylen] == key:
83+
working_file = string.strip(line[keylen:])
84+
break
8585
else:
86-
working_file = None
86+
working_file = None
8787
records = []
8888
for lines in chunk[1:]:
89-
revline = lines[0]
90-
dateline = lines[1]
91-
text = lines[2:]
92-
words = string.split(dateline)
93-
author = None
94-
if len(words) >= 3 and words[0] == 'date:':
95-
dateword = words[1]
96-
timeword = words[2]
97-
if timeword[-1:] == ';':
98-
timeword = timeword[:-1]
99-
date = dateword + ' ' + timeword
100-
if len(words) >= 5 and words[3] == 'author:':
101-
author = words[4]
102-
if author[-1:] == ';':
103-
author = author[:-1]
104-
else:
105-
date = None
106-
text.insert(0, revline)
107-
words = string.split(revline)
108-
if len(words) >= 2 and words[0] == 'revision':
109-
rev = words[1]
110-
else:
111-
rev = None
112-
text.insert(0, revline)
113-
records.append((date, working_file, rev, author, text))
89+
revline = lines[0]
90+
dateline = lines[1]
91+
text = lines[2:]
92+
words = string.split(dateline)
93+
author = None
94+
if len(words) >= 3 and words[0] == 'date:':
95+
dateword = words[1]
96+
timeword = words[2]
97+
if timeword[-1:] == ';':
98+
timeword = timeword[:-1]
99+
date = dateword + ' ' + timeword
100+
if len(words) >= 5 and words[3] == 'author:':
101+
author = words[4]
102+
if author[-1:] == ';':
103+
author = author[:-1]
104+
else:
105+
date = None
106+
text.insert(0, revline)
107+
words = string.split(revline)
108+
if len(words) >= 2 and words[0] == 'revision':
109+
rev = words[1]
110+
else:
111+
rev = None
112+
text.insert(0, revline)
113+
records.append((date, working_file, rev, author, text))
114114
return records
115-
115+
116116
def format_output(database):
117117
prevtext = None
118118
prev = []
119119
database.append((None, None, None, None, None)) # Sentinel
120120
for (date, working_file, rev, author, text) in database:
121-
if text != prevtext:
122-
if prev:
123-
print sep2,
124-
for (p_date, p_working_file, p_rev, p_author) in prev:
125-
print p_date, p_author, p_working_file
126-
sys.stdout.writelines(prevtext)
127-
prev = []
128-
prev.append((date, working_file, rev, author))
129-
prevtext = text
121+
if text != prevtext:
122+
if prev:
123+
print sep2,
124+
for (p_date, p_working_file, p_rev, p_author) in prev:
125+
print p_date, p_author, p_working_file
126+
sys.stdout.writelines(prevtext)
127+
prev = []
128+
prev.append((date, working_file, rev, author))
129+
prevtext = text
130130

131131
main()

0 commit comments

Comments
 (0)