git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 12/16] contrib/fast-import/import-zips.py: use spaces instead of tabs

From
David Aguilar <davvid@gmail.com>
Date
Feb 24, 2013, 00:20 UTC
Message-ID
<1361665254-42866-13-git-send-email-davvid@gmail.com>
In-Reply-To
<1361665254-42866-12-git-send-email-davvid@gmail.com>

Follow the conventional Python style by using 4-space indents instead of hard tabs.

Signed-off-by: David Aguilar <davvid@gmail.com>
---
 contrib/fast-import/import-zips.py | 98 +++++++++++++++++++-------------------
 1 file changed, 49 insertions(+), 49 deletions(-)
diff --git a/contrib/fast-import/import-zips.py b/contrib/fast-import/import-zips.py
index b528798..d12c296 100755
--- a/contrib/fast-import/import-zips.py
+++ b/contrib/fast-import/import-zips.py
@@ -14,13 +14,13 @@ 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)
+    # 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], '<zipfile>...'
-	exit(1)
+    print 'usage:', argv[0], '<zipfile>...'
+    exit(1)
 
 branch_ref = 'refs/heads/import-zips'
 committer_name = 'Z Ip Creator'
@@ -28,51 +28,51 @@ 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 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 <<EOM', 'Imported from ' + zipfile + '.', 'EOM', \
-		'', 'deleteall'))
-
-	for name in mark.keys():
-		fast_import.write('M 100644 ' + mark[name] + ' ' +
-			name[len(common_prefix):] + "\n")
-
-	printlines(('',  'tag ' + path.basename(zipfile), \
-		'from ' + branch_ref, 'tagger ' + committer, \
-		'data <<EOM', 'Package ' + zipfile, 'EOM', ''))
+    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 <<EOM', 'Imported from ' + zipfile + '.', 'EOM', \
+        '', 'deleteall'))
+
+    for name in mark.keys():
+        fast_import.write('M 100644 ' + mark[name] + ' ' +
+            name[len(common_prefix):] + "\n")
+
+    printlines(('',  'tag ' + path.basename(zipfile), \
+        'from ' + branch_ref, 'tagger ' + committer, \
+        'data <<EOM', 'Package ' + zipfile, 'EOM', ''))
 
 if fast_import.close():
-	exit(1)
+    exit(1)
-- 
1.8.2.rc0.247.g811e0c0
Previous: David AguilarNext: David Aguilar
Message 13 of 20 in “make usage text consistent in git commands”
  1. 00/16 make usage text consistent in git commandsDavid Aguilar, Feb 24, 2013
  2. 01/16 git-sh-setup: make usage text consistentDavid Aguilar, Feb 24, 2013
  3. 02/16 git-svn: make usage text consistentDavid Aguilar, Feb 24, 2013
  4. 03/16 git-relink: make usage text consistentDavid Aguilar, Feb 24, 2013
  5. 04/16 git-merge-one-file: make usage text consistentDavid Aguilar, Feb 24, 2013
  6. 05/16 git-archimport: make usage text consistentDavid Aguilar, Feb 24, 2013
  7. 06/16 git-cvsexportcommit: make usage text consistentDavid Aguilar, Feb 24, 2013
  8. 07/16 git-cvsimport: make usage text consistentDavid Aguilar, Feb 24, 2013
  9. 08/16 git-cvsimport: make usage text consistentDavid Aguilar, Feb 24, 2013
  10. 09/16 contrib/credential: make usage text consistentDavid Aguilar, Feb 24, 2013
  11. 10/16 contrib/fast-import: make usage text consistentDavid Aguilar, Feb 24, 2013
  12. 11/16 contrib/fast-import/import-zips.py: fix broken error messageDavid Aguilar, Feb 24, 2013
  13. 12/16 contrib/fast-import/import-zips.py: use spaces instead of tabsDavid Aguilar, Feb 24, 2013
  14. 13/16 contrib/examples: make usage text consistentDavid Aguilar, Feb 24, 2013
  15. 14/16 contrib/hooks/setgitperms.perl: make usage text consistentDavid Aguilar, Feb 24, 2013
  16. 15/16 templates/hooks--update.sample: make usage text consistentDavid Aguilar, Feb 24, 2013
  17. 16/16 Documentation/user-manual.txt: make usage text consistentDavid Aguilar, Feb 24, 2013
  18. Jonathan NiederFeb 24, 2013
  19. Jonathan NiederFeb 24, 2013
  20. David AguilarFeb 24, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.