Exemple #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
Exemple #2
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