branch = "refs/heads/master"
globalPrefix = previousDepotPath = os.popen("git-repo-config --get p4.depotpath").read()
detectBranches = False
branch = "refs/heads/master"
globalPrefix = previousDepotPath = os.popen("git-repo-config --get p4.depotpath").read()
detectBranches = False
- opts, args = getopt.getopt(sys.argv[1:], "", [ "branch=", "detect-branches" ])
+ opts, args = getopt.getopt(sys.argv[1:], "", [ "branch=", "detect-branches", "changesfile=" ])
except getopt.GetoptError:
print "fixme, syntax error"
sys.exit(1)
except getopt.GetoptError:
print "fixme, syntax error"
sys.exit(1)
if len(args) == 0 and len(globalPrefix) != 0:
print "[using previously specified depot path %s]" % globalPrefix
if len(args) == 0 and len(globalPrefix) != 0:
print "[using previously specified depot path %s]" % globalPrefix
path = commit["depotFile%s" % fnum]
if not path.startswith(globalPrefix):
print "\nchanged files: ignoring path %s outside of %s in change %s" % (path, globalPrefix, change)
path = commit["depotFile%s" % fnum]
if not path.startswith(globalPrefix):
print "\nchanged files: ignoring path %s outside of %s in change %s" % (path, globalPrefix, change)
- if not knownBranch:
- branches.add(relativePath)
+ if knownBranch:
+ continue
+
+ for branch in knownBranches:
+ #if relativePath.startswith(branch):
+ if isSubPathOf(relativePath, branch):
+ if len(branches) == 0:
+ relativePath = branch
+ else:
+ knownBranch = True
+ break
+
+ if knownBranch:
+ continue
+
+ branches.add(relativePath)
+ knownBranches.add(relativePath)
print "eek! wrong action in filelog for %s : found %s, expected %s" % (depotPath, log["action0"], action)
sys.exit(1);
print "eek! wrong action in filelog for %s : found %s, expected %s" % (depotPath, log["action0"], action)
sys.exit(1);
- if not log["how0,0"].endswith(" from"):
- print "eek! file %s was not branched but instead: %s" % (depotPath, log["how0,0"])
- sys.exit(1);
+ branchAction = log["how0,0"]
+# if branchAction == "branch into" or branchAction == "ignored":
+# continue # ignore for branching
+
+ if not branchAction.endswith(" from"):
+ continue # ignore for branching
+# print "eek! file %s was not branched from but instead: %s" % (depotPath, branchAction)
+# sys.exit(1);
- print "\nchanged files: ignoring path %s outside of branch prefix %s in change %s" % (path, branchPrefix, change)
+ print "\nchanged files: ignoring path %s outside of branch prefix %s in change %s" % (path, branchPrefix, details["change"])
+ if len(changesFile) > 0:
+ output = open(changesFile).readlines()
+ changeSet = set()
+ for line in output:
+ changeSet.add(int(line))
+
+ for change in changeSet:
+ changes.append(change)
+
+ changes.sort()
+ else:
+ output = os.popen("p4 changes %s...%s" % (globalPrefix, changeRange)).readlines()
+
+ for line in output:
+ changeNum = line.split(" ")[1]
+ changes.append(changeNum)
+
+ changes.reverse()
- try:
- files = extractFilesFromCommit(description)
- if detectBranches:
- for branch in branchesForCommit(files):
- knownBranches.add(branch)
- branchPrefix = globalPrefix + branch + "/"
- branch = "refs/heads/" + branch
- commit(description, files, branch, branchPrefix)
- else:
- commit(description, files, branch, globalPrefix)
- except:
- print gitError.read()
- sys.exit(1)
+# try:
+ files = extractFilesFromCommit(description)
+ if detectBranches:
+ for branch in branchesForCommit(files):
+ knownBranches.add(branch)
+ branchPrefix = globalPrefix + branch + "/"
+ branch = "refs/heads/" + branch
+ commit(description, files, branch, branchPrefix)
+ else:
+ commit(description, files, branch, globalPrefix)
+# except:
+# print gitError.read()
+# sys.exit(1)