Give branches a nice project prefix and don't bail out on clone if we failed
to detect the master branch. Signed-off-by: Simon Hausmann <shausman@trolltech.com>
This commit is contained in:
parent
4b97ffb1e4
commit
8f9b2e082b
@ -729,6 +729,7 @@ class P4Sync(Command):
|
|||||||
|
|
||||||
if self.detectBranches:
|
if self.detectBranches:
|
||||||
self.getBranchMapping();
|
self.getBranchMapping();
|
||||||
|
self.branchPrefix = self.depotPath[self.depotPath[:-1].rfind("/") + 1:]
|
||||||
|
|
||||||
self.tz = "%+03d%02d" % (- time.timezone / 3600, ((- time.timezone % 3600) / 60))
|
self.tz = "%+03d%02d" % (- time.timezone / 3600, ((- time.timezone % 3600) / 60))
|
||||||
|
|
||||||
@ -815,12 +816,23 @@ class P4Sync(Command):
|
|||||||
|
|
||||||
filesForCommit = self.extractFilesInCommitToBranch(files, branch)
|
filesForCommit = self.extractFilesInCommitToBranch(files, branch)
|
||||||
|
|
||||||
if branch not in self.createdBranches :
|
if branch not in self.createdBranches:
|
||||||
self.createdBranches.add(branch)
|
self.createdBranches.add(branch)
|
||||||
parent = self.knownBranches[branch]
|
parent = self.knownBranches[branch]
|
||||||
if parent == branch:
|
if parent == branch:
|
||||||
parent = ""
|
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
|
branch = "refs/remotes/p4/" + branch
|
||||||
if len(parent) > 0:
|
if len(parent) > 0:
|
||||||
parent = "refs/remotes/p4/" + parent
|
parent = "refs/remotes/p4/" + parent
|
||||||
@ -906,8 +918,11 @@ class P4Clone(P4Sync):
|
|||||||
if not P4Sync.run(self, [depotPath]):
|
if not P4Sync.run(self, [depotPath]):
|
||||||
return False
|
return False
|
||||||
if self.branch != "master":
|
if self.branch != "master":
|
||||||
system("git branch master p4")
|
if gitBranchExists("refs/remotes/p4/master"):
|
||||||
system("git checkout -f")
|
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
|
return True
|
||||||
|
|
||||||
class HelpFormatter(optparse.IndentedHelpFormatter):
|
class HelpFormatter(optparse.IndentedHelpFormatter):
|
||||||
|
Loading…
Reference in New Issue
Block a user