+ sourceFiles = {}
+ for file in p4CmdList("files %s...@%s" % (globalPrefix + sourceBranch + "/", change)):
+ if file["action"] == "delete":
+ continue
+ sourceFiles[file["depotFile"]] = file
+
+ destinationFiles = {}
+ for file in p4CmdList("files %s...@%s" % (globalPrefix + destinationBranch + "/", change)):
+ destinationFiles[file["depotFile"]] = file
+
+ for fileName in sourceFiles.keys():
+ integrations = []
+ deleted = False
+ for integration in p4CmdList("integrated \"%s\"" % fileName):
+ toFile = integration["fromFile"] # yes, it's true, it's fromFile
+ if not toFile in destinationFiles:
+ continue
+ destFile = destinationFiles[toFile]
+ if destFile["action"] == "delete":
+# print "file %s has been deleted in %s" % (fileName, toFile)
+ deleted = True
+ break
+
+ if int(integration["change"]) == change:
+ integrations.append(integration)
+ continue
+
+ destRev = int(destFile["rev"])
+
+ startRev = integration["startFromRev"][1:]
+ if startRev == "none":
+ startRev = 0
+ else:
+ startRev = int(startRev)
+
+ endRev = integration["endFromRev"][1:]
+ if endRev == "none":
+ endRev = 0
+ else:
+ endRev = int(endRev)
+
+ initialBranch = (destRev == 1 and integration["how"] != "branch into")
+ inRange = (destRev >= startRev and destRev <= endRev)
+ newer = (destRev > startRev and destRev > endRev)
+
+ if initialBranch or inRange or newer:
+ integrations.append(integration)
+
+ if deleted:
+ continue
+
+ if len(integrations) == 0:
+ print "file %s was not integrated from %s into %s" % (fileName, sourceBranch, destinationBranch)
+ return False
+
+ return True