summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4b97ffb)
raw | patch | inline | side by side (parent: 4b97ffb)
author | Simon Hausmann <shausman@trolltech.com> | |
Fri, 18 May 2007 20:13:26 +0000 (22:13 +0200) | ||
committer | Simon Hausmann <shausman@trolltech.com> | |
Fri, 18 May 2007 20:13:26 +0000 (22:13 +0200) |
to detect the master branch.
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
contrib/fast-import/git-p4 | patch | blob | history |
index e993d3f6933f701f54ff610b4ba19fdfe09fbc2e..7d4273963725464776256b1ecda8fab97a25a5bc 100755 (executable)
if self.detectBranches:
self.getBranchMapping();
+ self.branchPrefix = self.depotPath[self.depotPath[:-1].rfind("/") + 1:]
self.tz = "%+03d%02d" % (- time.timezone / 3600, ((- time.timezone % 3600) / 60))
filesForCommit = self.extractFilesInCommitToBranch(files, branch)
- if branch not in self.createdBranches :
+ if branch not in self.createdBranches:
self.createdBranches.add(branch)
parent = self.knownBranches[branch]
if parent == branch:
parent = ""
+ # main branch? use master
+ if branch == "main":
+ branch = "master"
+ else:
+ branch = self.branchPrefix + branch
+
+ if parent == "main":
+ parent = "master"
+ elif len(parent) > 0:
+ parent = self.branchPrefix + parent
+
branch = "refs/remotes/p4/" + branch
if len(parent) > 0:
parent = "refs/remotes/p4/" + parent
if not P4Sync.run(self, [depotPath]):
return False
if self.branch != "master":
- system("git branch master p4")
- system("git checkout -f")
+ if gitBranchExists("refs/remotes/p4/master"):
+ system("git branch master refs/remotes/p4/master")
+ system("git checkout -f")
+ else:
+ print "Could not detect main branch. No checkout/master branch created."
return True
class HelpFormatter(optparse.IndentedHelpFormatter):