Cleanup/speed up the branch<> file split and removed change range limitation that I added
for debugging (oops). Signed-off-by: Simon Hausmann <shausman@trolltech.com>
This commit is contained in:
parent
29bdbac1cd
commit
d5904674d1
@ -461,15 +461,17 @@ class P4Sync(Command):
|
|||||||
fnum = fnum + 1
|
fnum = fnum + 1
|
||||||
return files
|
return files
|
||||||
|
|
||||||
def branchesForCommit(self, files):
|
def splitFilesIntoBranches(self, files):
|
||||||
branches = Set()
|
branches = {}
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
path = file["path"][len(self.depotPath):]
|
path = file["path"][len(self.depotPath):]
|
||||||
|
|
||||||
for branch in self.knownBranches.keys():
|
for branch in self.knownBranches.keys():
|
||||||
if path.startswith(branch):
|
if path.startswith(branch):
|
||||||
branches.add(branch)
|
if branch not in branches:
|
||||||
|
branches[branch] = []
|
||||||
|
branches[branch].append(file["path"])
|
||||||
|
|
||||||
return branches
|
return branches
|
||||||
|
|
||||||
@ -574,16 +576,6 @@ class P4Sync(Command):
|
|||||||
if not self.silent:
|
if not self.silent:
|
||||||
print "Tag %s does not match with change %s: file count is different." % (labelDetails["label"], change)
|
print "Tag %s does not match with change %s: file count is different." % (labelDetails["label"], change)
|
||||||
|
|
||||||
def extractFilesInCommitToBranch(self, files, branchPrefix):
|
|
||||||
newFiles = []
|
|
||||||
|
|
||||||
for file in files:
|
|
||||||
path = file["path"]
|
|
||||||
if path.startswith(branchPrefix):
|
|
||||||
newFiles.append(file)
|
|
||||||
|
|
||||||
return newFiles
|
|
||||||
|
|
||||||
def getUserMap(self):
|
def getUserMap(self):
|
||||||
self.users = {}
|
self.users = {}
|
||||||
|
|
||||||
@ -713,8 +705,7 @@ class P4Sync(Command):
|
|||||||
|
|
||||||
if p4Change > 0:
|
if p4Change > 0:
|
||||||
self.depotPath = self.previousDepotPath
|
self.depotPath = self.previousDepotPath
|
||||||
#self.changeRange = "@%s,#head" % p4Change
|
self.changeRange = "@%s,#head" % p4Change
|
||||||
self.changeRange = "@%s,%s" % (p4Change, p4Change + 10)
|
|
||||||
self.initialParent = parseRevision(self.branch)
|
self.initialParent = parseRevision(self.branch)
|
||||||
if not self.silent:
|
if not self.silent:
|
||||||
print "Performing incremental import into %s git branch" % self.branch
|
print "Performing incremental import into %s git branch" % self.branch
|
||||||
@ -857,12 +848,13 @@ class P4Sync(Command):
|
|||||||
try:
|
try:
|
||||||
files = self.extractFilesFromCommit(description)
|
files = self.extractFilesFromCommit(description)
|
||||||
if self.detectBranches:
|
if self.detectBranches:
|
||||||
for branch in self.branchesForCommit(files):
|
branches = self.splitFilesIntoBranches(files)
|
||||||
|
for branch in branches.keys():
|
||||||
branchPrefix = self.depotPath + branch + "/"
|
branchPrefix = self.depotPath + branch + "/"
|
||||||
|
|
||||||
parent = ""
|
parent = ""
|
||||||
|
|
||||||
filesForCommit = self.extractFilesInCommitToBranch(files, branch)
|
filesForCommit = branches[branch]
|
||||||
|
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print "branch is %s" % branch
|
print "branch is %s" % branch
|
||||||
|
Loading…
Reference in New Issue
Block a user