def decorated(self, **kwargs): if os.getcwd() != self.local: if DirCommands.isLocalDirectExist(self.local): DirCommands.enterDirAbs(self.local) else: raise GitError(self.local, "Local path not exist") return f(self, **kwargs)
def pushLocalBranch(self): (status, output) = commands.getstatusoutput( "git push origin caencompile_submit:caencompile_submit") if status != 0: self.checkLocalMaster() self.deleteLocalBranch() raise GitError(os.getcwd, output)
def pullRemoteBranch(self): with cd(self.remote): ret = run("git pull origin caencompile_submit") if not ret.succeeded: self.checkLocalMaster() self.createLocalBranch() self.deleteRemoteBranch() raise GitError(self.remote, ret)
def checkCaenBranch(self): with cd(self.remote): ret = run("git checkout origin/HEAD") if not ret.succeeded: self.checkRemoteMaster() self.checkLocalMaster() self.createLocalBranch() self.deleteRemoteBranch() raise GitError(self.remote, ret)
def testRemote(self): with cd(self.remote): ret = run("ls") if not ret.succeeded: raise GitError(self.remote, ret)
def deleteRemoteBranch(self): self.checkLocalMaster() (status, output ) = commands.getstatusoutput("git push origin :caencompile_submit ") if status != 0: raise GitError(os.getcwd, output)
def deleteLocalBranch(self): self.checkLocalMaster() (status, output) = commands.getstatusoutput("git branch -D caencompile_submit") if status != 0: raise GitError(os.getcwd, output)
def createLocalBranch(self): (status, output ) = commands.getstatusoutput("git checkout -b caencompile_submit") if status != 0: raise GitError(os.getcwd(), output)
def checkLocalMaster(self): (status, output) = commands.getstatusoutput("git checkout master") if status != 0: raise GitError(os.getcwd(), output)
def testLocal(self): (status, output) = commands.getstatusoutput("mkdir tmp") if status != 0: raise GitError(os.getcwd(), output)
def decorated(self, **kwargs): if not DirCommands.isRemoteDirectExist(self.remote): raise GitError(self.remote, "Remote path not exist") return f(self, **kwargs)
def checkRemoteMaster(self): with cd(self.remote): ret = run("git checkout master") if not ret.succeeded: raise GitError(self.remote, ret)
def cloneGit(self, gitAddr): if DirCommands.isRemoteDirectExist(InitCommands.remote): with cd(InitCommands.remote): ret = run("git clone %s git" % gitAddr) if not ret.succeeded: raise GitError(InitCommands.remote, ret)