コード例 #1
0
	def doPull(self, branch = "master"):
		if not self.loadManifest():
			return False

		self.mListProject = self.mManifest.getProjects()
		if self.mListProject == None:
			return False

		remote = self.mManifest.getRemoteName()
		if not remote:
			remote = "cavan-svn"

		if not self.mVerbose:
			self.initProgress(len(self.mListProject))

		for node in self.mManifest.getProjects():
			manager = GitSvnManager(self.getProjectAbsPath(node), self.mVerbose)
			if manager.gitCheckout(branch):
				if not manager.doExecGitCmd(["pull", remote, branch], of = "/dev/null", ef = "/dev/null"):
					self.prRedInfo("fetch %s failed" % manager.getRootPath())
					return False
			elif manager.hasBranch(branch):
				self.prRedInfo("checkout %s to %s failed" % (manager.getRootPath(), branch))
				return False

			if not self.mVerbose:
				self.addProgress()

		if not self.mVerbose:
			self.finishProgress()

		return True
コード例 #2
0
	def doMerge(self, argv):
		if len(argv) > 1:
			branch = argv[0]
			destBranch = argv[1]
		else:
			if len(argv) > 0:
				branch = argv[0]
			else:
				branch = "master"
			destBranch = "cavan"

		if not self.getChoice("Merge branch %s to %s" % (branch, destBranch)):
			return False

		if not self.loadManifest():
			return False

		self.mListProject = self.mManifest.getProjects()
		if self.mListProject == None:
			return False

		if not self.mVerbose:
			self.initProgress(len(self.mListProject))

		for node in self.mManifest.getProjects():
			manager = GitSvnManager(self.getProjectAbsPath(node), self.mVerbose)
			if not manager.doGitMerge(branch, destBranch):
				self.prRedInfo("checkout %s to %s failed" % (manager.getRootPath(), branch))
				return False

			if not self.mVerbose:
				self.addProgress()

		if not self.mVerbose:
			self.finishProgress()

		return True
コード例 #3
0
	def doCheckout(self, argv):
		if len(argv) < 1:
			self.prRedInfo("Please give the branch name")
			return False

		branch = argv[0]

		if not self.loadManifest():
			return False

		self.mListProject = self.mManifest.getProjects()
		if self.mListProject == None:
			return False

		remote = self.mManifest.getRemoteName()
		if not remote:
			remote = "cavan-svn"

		if not self.mVerbose:
			self.initProgress(len(self.mListProject))

		for node in self.mManifest.getProjects():
			manager = GitSvnManager(self.getProjectAbsPath(node), self.mVerbose, name = None)
			if not manager.gitCheckout(branch):
				if manager.hasBranch(branch):
					self.prRedInfo("checkout %s to %s failed" % (manager.getRootPath(), branch))
					return False
				manager.doExecGitCmd(["checkout", "-b", branch, os.path.join(remote, branch)], of = "/dev/null", ef = "/dev/null")

			if not self.mVerbose:
				self.addProgress()

		if not self.mVerbose:
			self.finishProgress()

		return True
コード例 #4
0
	def fetchProjectBase(self, manager, name):
		url = os.path.join(self.mUrl, name)

		for count in range(2):
			if self.mErrorCount > 0:
				return -1

			if (manager.isInitialized() or manager.doInitBase(url)) and (manager.doSync(url) or manager.doDcommit(url)):
				self.addProgress()
				return 1

			if not self.doExecute(["svn", "info", url], of = "/dev/null"):
				return -1

			self.prRedInfo("Retry count = %d" % count)
			manager.removeSelf()

		self.mLockProject.acquire()
		tmpPathname = self.getTempProjectPath()
		self.mLockProject.release()

		if tmpPathname != None:
			if self.mVerbose:
				self.prRedInfo(url, " => ", tmpPathname)

			managerTemp = GitSvnManager(tmpPathname, self.mVerbose)
			if managerTemp.doInitBase(url) and managerTemp.doSync(url) and self.doExecute(["mv", managerTemp.getRootPath(), manager.getRootPath()]):
				self.addProgress()
				return 1

			managerTemp.removeSelf()

		self.prRedInfo("Checkout ", manager.getRootPath(), " Failed")

		self.mLockProject.acquire()
		self.mErrorCount = self.mErrorCount + 1
		file_append_line(self.mFileFailed, "%s => %s" % (manager.getRootPath(), url))
		self.mLockProject.release()

		return -1