@matheusbsbs / matheus-bagliano / commits / 478764bc82
Fork 0

Minor code cleanups.

Signed-off-by: Simon Hausmann <hausmann@kde.org>

Simon Hausmann committed Mar 10, 2007 at 10:53 UTC 478764bc8261857e7eca2deac409e34c2778347a
1 file changed +14 -1
contrib/fast-import/p4-fast-export.py
+14 -1
@@ -340,6 +340,16 @@ def commit(details, files, branch, branchPrefix, parent):
340
341 lastChange = int(details["change"])
342
343 +def extractFilesInCommitToBranch(files, branchPrefix):
344 + newFiles = []
345 +
346 + for file in files:
347 + path = file["path"]
348 + if path.startswith(branchPrefix):
349 + newFiles.append(file)
350 +
351 + return newFiles
352 +
353 def getUserMap():
354 users = {}
355
@@ -448,6 +458,8 @@ else:
458 knownBranches.add(branch)
459 branchPrefix = globalPrefix + branch + "/"
460
461 + filesForCommit = extractFilesInCommitToBranch(files, branchPrefix)
462 +
463 parent = ""
464 ########### remove cnt!!!
465 if branch not in createdBranches and cnt > 2:
@@ -458,10 +470,11 @@ else:
470 # elif len(parent) > 0:
471 # print "%s branched off of %s" % (branch, parent)
472
473 +
474 branch = "refs/heads/" + branch
475 commit(description, files, branch, branchPrefix, parent)
476 else:
464 - commit(description, files, branch, globalPrefix, initialParent)
477 + commit(description, filesForCommit, branch, globalPrefix, initialParent)
478 initialParent = ""
479 # except:
480 # print gitError.read()