From e257f0551fdf9351dc3f8796ef3ca11b255b8a04 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sat, 23 Feb 2013 16:50:20 -0800 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- contrib/fast-import/import-zips.py | 156 ++++++++++++++++++------------------- 1 file changed, 78 insertions(+), 78 deletions(-) rewrite contrib/fast-import/import-zips.py (70%) diff --git a/contrib/fast-import/import-zips.py b/contrib/fast-import/import-zips.py dissimilarity index 70% index 1936a730b2..d12c296223 100755 --- a/contrib/fast-import/import-zips.py +++ b/contrib/fast-import/import-zips.py @@ -1,78 +1,78 @@ -#!/usr/bin/env python - -## zip archive frontend for git-fast-import -## -## For example: -## -## mkdir project; cd project; git init -## python import-zips.py *.zip -## git log --stat import-zips - -from os import popen, path -from sys import argv, exit, hexversion, stderr -from time import mktime -from zipfile import ZipFile - -if hexversion < 0x01060000: - # The limiter is the zipfile module - stderr.write("import-zips.py: requires Python 1.6.0 or later.\n") - exit(1) - -if len(argv) < 2: - print 'usage:', argv[0], '...' - exit(1) - -branch_ref = 'refs/heads/import-zips' -committer_name = 'Z Ip Creator' -committer_email = 'zip@example.com' - -fast_import = popen('git fast-import --quiet', 'w') -def printlines(list): - for str in list: - fast_import.write(str + "\n") - -for zipfile in argv[1:]: - commit_time = 0 - next_mark = 1 - common_prefix = None - mark = dict() - - zip = ZipFile(zipfile, 'r') - for name in zip.namelist(): - if name.endswith('/'): - continue - info = zip.getinfo(name) - - if commit_time < info.date_time: - commit_time = info.date_time - if common_prefix == None: - common_prefix = name[:name.rfind('/') + 1] - else: - while not name.startswith(common_prefix): - last_slash = common_prefix[:-1].rfind('/') + 1 - common_prefix = common_prefix[:last_slash] - - mark[name] = ':' + str(next_mark) - next_mark += 1 - - printlines(('blob', 'mark ' + mark[name], \ - 'data ' + str(info.file_size))) - fast_import.write(zip.read(name) + "\n") - - committer = committer_name + ' <' + committer_email + '> %d +0000' % \ - mktime(commit_time + (0, 0, 0)) - - printlines(('commit ' + branch_ref, 'committer ' + committer, \ - 'data <...' + exit(1) + +branch_ref = 'refs/heads/import-zips' +committer_name = 'Z Ip Creator' +committer_email = 'zip@example.com' + +fast_import = popen('git fast-import --quiet', 'w') +def printlines(list): + for str in list: + fast_import.write(str + "\n") + +for zipfile in argv[1:]: + commit_time = 0 + next_mark = 1 + common_prefix = None + mark = dict() + + zip = ZipFile(zipfile, 'r') + for name in zip.namelist(): + if name.endswith('/'): + continue + info = zip.getinfo(name) + + if commit_time < info.date_time: + commit_time = info.date_time + if common_prefix == None: + common_prefix = name[:name.rfind('/') + 1] + else: + while not name.startswith(common_prefix): + last_slash = common_prefix[:-1].rfind('/') + 1 + common_prefix = common_prefix[:last_slash] + + mark[name] = ':' + str(next_mark) + next_mark += 1 + + printlines(('blob', 'mark ' + mark[name], \ + 'data ' + str(info.file_size))) + fast_import.write(zip.read(name) + "\n") + + committer = committer_name + ' <' + committer_email + '> %d +0000' % \ + mktime(commit_time + (0, 0, 0)) + + printlines(('commit ' + branch_ref, 'committer ' + committer, \ + 'data <