summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d590467)
raw | patch | inline | side by side (parent: d590467)
author | Simon Hausmann <shausman@trolltech.com> | |
Sat, 19 May 2007 09:54:11 +0000 (11:54 +0200) | ||
committer | Simon Hausmann <shausman@trolltech.com> | |
Sat, 19 May 2007 09:54:11 +0000 (11:54 +0200) |
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
contrib/fast-import/git-p4 | patch | blob | history |
index 35c5f9c696507e2f9892740b556d20dfb9a43b05..49114d2c6f3e377b2805f0e5e3442d71fb306f41 100755 (executable)
fnum = fnum + 1
return files
- def splitFilesIntoBranches(self, files):
+ def splitFilesIntoBranches(self, commit):
branches = {}
- for file in files:
- path = file["path"][len(self.depotPath):]
+ fnum = 0
+ while commit.has_key("depotFile%s" % fnum):
+ path = commit["depotFile%s" % fnum]
+ if not path.startswith(self.depotPath):
+ # if not self.silent:
+ # print "\nchanged files: ignoring path %s outside of %s in change %s" % (path, self.depotPath, change)
+ fnum = fnum + 1
+ continue
+
+ file = {}
+ file["path"] = path
+ file["rev"] = commit["rev%s" % fnum]
+ file["action"] = commit["action%s" % fnum]
+ file["type"] = commit["type%s" % fnum]
+ fnum = fnum + 1
+
+ relPath = path[len(self.depotPath):]
for branch in self.knownBranches.keys():
- if path.startswith(branch):
+ if relPath.startswith(branch):
if branch not in branches:
branches[branch] = []
- branches[branch].append(file["path"])
+ branches[branch].append(file)
return branches
label = self.labels[change]
labelDetails = label[0]
labelRevisions = label[1]
+ if self.verbose:
+ print "Change %s is labelled %s" % (change, labelDetails)
files = p4CmdList("files %s...@%s" % (branchPrefix, change))
label = output["label"]
revisions = {}
newestChange = 0
- for file in p4CmdList("files //...@%s" % label):
+ if self.verbose:
+ print "Querying files for label %s" % label
+ for file in p4CmdList("files %s...@%s" % (self.depotPath, label)):
revisions[file["depotFile"]] = file["rev"]
change = int(file["change"])
if change > newestChange:
newestChange = change
- self.labels[newestChange] = [output, revisions]
+ self.labels[int(newestChange)] = [output, revisions]
def getBranchMapping(self):
self.projectName = self.depotPath[self.depotPath[:-1].rfind("/") + 1:]
cnt = cnt + 1
try:
- files = self.extractFilesFromCommit(description)
if self.detectBranches:
- branches = self.splitFilesIntoBranches(files)
+ branches = self.splitFilesIntoBranches(description)
for branch in branches.keys():
branchPrefix = self.depotPath + branch + "/"
parent = self.initialParents[branch]
del self.initialParents[branch]
- self.commit(description, files, branch, branchPrefix, parent)
+ self.commit(description, filesForCommit, branch, branchPrefix, parent)
else:
+ files = self.extractFilesFromCommit(description)
self.commit(description, files, self.branch, self.depotPath, self.initialParent)
self.initialParent = ""
except IOError: