Skip to content

Commit e257f05

Browse files
davvidgitster
authored andcommitted
contrib/fast-import/import-zips.py: use spaces instead of tabs
Follow the conventional Python style by using 4-space indents instead of hard tabs. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 61a7aac commit e257f05

File tree

1 file changed

+49
-49
lines changed

1 file changed

+49
-49
lines changed

contrib/fast-import/import-zips.py

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -14,65 +14,65 @@
1414
from zipfile import ZipFile
1515

1616
if hexversion < 0x01060000:
17-
# The limiter is the zipfile module
18-
stderr.write("import-zips.py: requires Python 1.6.0 or later.\n")
19-
exit(1)
17+
# The limiter is the zipfile module
18+
stderr.write("import-zips.py: requires Python 1.6.0 or later.\n")
19+
exit(1)
2020

2121
if len(argv) < 2:
22-
print 'usage:', argv[0], '<zipfile>...'
23-
exit(1)
22+
print 'usage:', argv[0], '<zipfile>...'
23+
exit(1)
2424

2525
branch_ref = 'refs/heads/import-zips'
2626
committer_name = 'Z Ip Creator'
2727
committer_email = 'zip@example.com'
2828

2929
fast_import = popen('git fast-import --quiet', 'w')
3030
def printlines(list):
31-
for str in list:
32-
fast_import.write(str + "\n")
31+
for str in list:
32+
fast_import.write(str + "\n")
3333

3434
for zipfile in argv[1:]:
35-
commit_time = 0
36-
next_mark = 1
37-
common_prefix = None
38-
mark = dict()
39-
40-
zip = ZipFile(zipfile, 'r')
41-
for name in zip.namelist():
42-
if name.endswith('/'):
43-
continue
44-
info = zip.getinfo(name)
45-
46-
if commit_time < info.date_time:
47-
commit_time = info.date_time
48-
if common_prefix == None:
49-
common_prefix = name[:name.rfind('/') + 1]
50-
else:
51-
while not name.startswith(common_prefix):
52-
last_slash = common_prefix[:-1].rfind('/') + 1
53-
common_prefix = common_prefix[:last_slash]
54-
55-
mark[name] = ':' + str(next_mark)
56-
next_mark += 1
57-
58-
printlines(('blob', 'mark ' + mark[name], \
59-
'data ' + str(info.file_size)))
60-
fast_import.write(zip.read(name) + "\n")
61-
62-
committer = committer_name + ' <' + committer_email + '> %d +0000' % \
63-
mktime(commit_time + (0, 0, 0))
64-
65-
printlines(('commit ' + branch_ref, 'committer ' + committer, \
66-
'data <<EOM', 'Imported from ' + zipfile + '.', 'EOM', \
67-
'', 'deleteall'))
68-
69-
for name in mark.keys():
70-
fast_import.write('M 100644 ' + mark[name] + ' ' +
71-
name[len(common_prefix):] + "\n")
72-
73-
printlines(('', 'tag ' + path.basename(zipfile), \
74-
'from ' + branch_ref, 'tagger ' + committer, \
75-
'data <<EOM', 'Package ' + zipfile, 'EOM', ''))
35+
commit_time = 0
36+
next_mark = 1
37+
common_prefix = None
38+
mark = dict()
39+
40+
zip = ZipFile(zipfile, 'r')
41+
for name in zip.namelist():
42+
if name.endswith('/'):
43+
continue
44+
info = zip.getinfo(name)
45+
46+
if commit_time < info.date_time:
47+
commit_time = info.date_time
48+
if common_prefix == None:
49+
common_prefix = name[:name.rfind('/') + 1]
50+
else:
51+
while not name.startswith(common_prefix):
52+
last_slash = common_prefix[:-1].rfind('/') + 1
53+
common_prefix = common_prefix[:last_slash]
54+
55+
mark[name] = ':' + str(next_mark)
56+
next_mark += 1
57+
58+
printlines(('blob', 'mark ' + mark[name], \
59+
'data ' + str(info.file_size)))
60+
fast_import.write(zip.read(name) + "\n")
61+
62+
committer = committer_name + ' <' + committer_email + '> %d +0000' % \
63+
mktime(commit_time + (0, 0, 0))
64+
65+
printlines(('commit ' + branch_ref, 'committer ' + committer, \
66+
'data <<EOM', 'Imported from ' + zipfile + '.', 'EOM', \
67+
'', 'deleteall'))
68+
69+
for name in mark.keys():
70+
fast_import.write('M 100644 ' + mark[name] + ' ' +
71+
name[len(common_prefix):] + "\n")
72+
73+
printlines(('', 'tag ' + path.basename(zipfile), \
74+
'from ' + branch_ref, 'tagger ' + committer, \
75+
'data <<EOM', 'Package ' + zipfile, 'EOM', ''))
7676

7777
if fast_import.close():
78-
exit(1)
78+
exit(1)

0 commit comments

Comments
 (0)