def genFileRepo(self): manager = CavanGitManager(self.mPathFileRepo, self.mVerbose, name = None) if not manager.genGitRepo(): return False listFile = self.mManifest.getFiles() if not listFile: return listFile != None nodeProject = self.mManifest.appendProject("platform/copyfile", self.getRelPath(self.mPathFileRepo)) if not nodeProject: return False for node in listFile: pathname = self.getProjectRelPath(node) dirname = os.path.dirname(pathname) if not dirname: dirname = self.mPathFileRepo else: dirname = os.path.join(self.mPathFileRepo, dirname) if not os.path.isdir(dirname): os.makedirs(dirname) if not self.doExecute(["cp", "-a", pathname, dirname]): return False copyfile = self.mManifest.createElement("copyfile") if not copyfile: return False copyfile.setAttribute("dest", pathname) copyfile.setAttribute("src", pathname) nodeProject.appendChild(copyfile) return manager.gitAutoCommit()
def __init__(self, pathname = None, verbose = True, name = ".cavan-git"): CavanGitManager.__init__(self, pathname, verbose) self.mRemoteName = "cavan-svn" self.mBranchMaster = "master" self.mBranchMerge = "cavan-merge" self.mPatternSvnUpdate = re.compile('^([AD])[UCGER ]{4}(.*)$') self.mPatternGitWhatChanged = re.compile('^:([0-9]{3}[0-7]{3} ){2}([0-9a-f]{7}\.{3} ){2}([AMD])\t(.*)$')
def genManifestRepo(self): manager = CavanGitManager(self.mPathManifestRepo, self.mVerbose, name = None) if not manager.genGitRepo(): return False if not self.mManifest.save(os.path.join(self.mPathManifestRepo, "default.xml")): return False return manager.gitAutoCommit()
def setRootPath(self, pathname, auto_create = False): CavanGitManager.setRootPath(self, pathname, auto_create) self.mPathGitSvn = os.path.join(self.mPathGitRepo, "cavan-svn") if auto_create and not os.path.isdir(self.mPathGitSvn): self.mkdirSafe(self.mPathGitSvn) self.mPathSvnRepo = self.getAbsPath(".svn") if auto_create and not os.path.isdir(self.mPathSvnRepo): self.mkdirSafe(self.mPathSvnRepo) self.mFileSvnLog = os.path.join(self.mPathGitSvn, "svn_log.xml") self.mFileSvnInfo = os.path.join(self.mPathGitSvn, "svn_info.xml")
def gitPushProject(self, localPath, backupPath): managerLocal = CavanGitManager(localPath, self.mVerbose) managerBackup = CavanGitManager(backupPath, self.mVerbose, bare = True) for index in range(2): if not managerBackup.genGitRepo(): return False if managerLocal.doPush([backupPath]): return True self.prRedInfo("Remove git repo ", backupPath) managerBackup.removeSelf(); return False
def genGitRepo(self): if not CavanGitManager.genGitRepo(self): return False return self.setRemoteUrl(self.mUrl)