Skip to content

Commit c3f6163

Browse files
splicergitster
authored andcommitted
git-p4: replace each tab with 8 spaces for consistency
Note that the majority of git-p4 uses spaces, not tabs, for indentation. Consistent indentation is a good hygiene for Python scripts, and mixing tabs and spaces in Python can lead to hard-to-find bugs. Signed-off-by: Andrew Garber <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6be0559 commit c3f6163

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

contrib/fast-import/git-p4

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@ def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None):
222222
try:
223223
while True:
224224
entry = marshal.load(p4.stdout)
225-
if cb is not None:
226-
cb(entry)
227-
else:
228-
result.append(entry)
225+
if cb is not None:
226+
cb(entry)
227+
else:
228+
result.append(entry)
229229
except EOFError:
230230
pass
231231
exitCode = p4.wait()
@@ -449,8 +449,8 @@ def p4ChangesForPaths(depotPaths, changeRange):
449449

450450
changes = {}
451451
for line in output:
452-
changeNum = int(line.split(" ")[1])
453-
changes[changeNum] = True
452+
changeNum = int(line.split(" ")[1])
453+
changes[changeNum] = True
454454

455455
changelist = changes.keys()
456456
changelist.sort()
@@ -1033,10 +1033,10 @@ class P4Sync(Command):
10331033
# - helper for streamP4Files
10341034

10351035
def streamOneP4File(self, file, contents):
1036-
if file["type"] == "apple":
1037-
print "\nfile %s is a strange apple file that forks. Ignoring" % \
1038-
file['depotFile']
1039-
return
1036+
if file["type"] == "apple":
1037+
print "\nfile %s is a strange apple file that forks. Ignoring" % \
1038+
file['depotFile']
1039+
return
10401040

10411041
relPath = self.stripRepoPath(file['depotFile'], self.branchPrefixes)
10421042
relPath = self.wildcard_decode(relPath)
@@ -1085,22 +1085,22 @@ class P4Sync(Command):
10851085
# handle another chunk of streaming data
10861086
def streamP4FilesCb(self, marshalled):
10871087

1088-
if marshalled.has_key('depotFile') and self.stream_have_file_info:
1089-
# start of a new file - output the old one first
1090-
self.streamOneP4File(self.stream_file, self.stream_contents)
1091-
self.stream_file = {}
1092-
self.stream_contents = []
1093-
self.stream_have_file_info = False
1088+
if marshalled.has_key('depotFile') and self.stream_have_file_info:
1089+
# start of a new file - output the old one first
1090+
self.streamOneP4File(self.stream_file, self.stream_contents)
1091+
self.stream_file = {}
1092+
self.stream_contents = []
1093+
self.stream_have_file_info = False
10941094

1095-
# pick up the new file information... for the
1096-
# 'data' field we need to append to our array
1097-
for k in marshalled.keys():
1098-
if k == 'data':
1099-
self.stream_contents.append(marshalled['data'])
1100-
else:
1101-
self.stream_file[k] = marshalled[k]
1095+
# pick up the new file information... for the
1096+
# 'data' field we need to append to our array
1097+
for k in marshalled.keys():
1098+
if k == 'data':
1099+
self.stream_contents.append(marshalled['data'])
1100+
else:
1101+
self.stream_file[k] = marshalled[k]
11021102

1103-
self.stream_have_file_info = True
1103+
self.stream_have_file_info = True
11041104

11051105
# Stream directly from "p4 files" into "git fast-import"
11061106
def streamP4Files(self, files):
@@ -1132,14 +1132,14 @@ class P4Sync(Command):
11321132
self.stream_contents = []
11331133
self.stream_have_file_info = False
11341134

1135-
# curry self argument
1136-
def streamP4FilesCbSelf(entry):
1137-
self.streamP4FilesCb(entry)
1135+
# curry self argument
1136+
def streamP4FilesCbSelf(entry):
1137+
self.streamP4FilesCb(entry)
11381138

1139-
p4CmdList("-x - print",
1140-
'\n'.join(['%s#%s' % (f['path'], f['rev'])
1139+
p4CmdList("-x - print",
1140+
'\n'.join(['%s#%s' % (f['path'], f['rev'])
11411141
for f in filesToRead]),
1142-
cb=streamP4FilesCbSelf)
1142+
cb=streamP4FilesCbSelf)
11431143

11441144
# do the last chunk
11451145
if self.stream_file.has_key('depotFile'):
@@ -1148,7 +1148,7 @@ class P4Sync(Command):
11481148
def commit(self, details, files, branch, branchPrefixes, parent = ""):
11491149
epoch = details["time"]
11501150
author = details["user"]
1151-
self.branchPrefixes = branchPrefixes
1151+
self.branchPrefixes = branchPrefixes
11521152

11531153
if self.verbose:
11541154
print "commit into %s" % branch
@@ -1253,7 +1253,7 @@ class P4Sync(Command):
12531253

12541254
s = ''
12551255
for (key, val) in self.users.items():
1256-
s += "%s\t%s\n" % (key.expandtabs(1), val.expandtabs(1))
1256+
s += "%s\t%s\n" % (key.expandtabs(1), val.expandtabs(1))
12571257

12581258
open(self.getUserCacheFilename(), "wb").write(s)
12591259
self.userMapFromPerforceServer = True

0 commit comments

Comments
 (0)