class TestGitLabClone(TestHttpsClone): testDir = "./__testGitLabClone" def setUp(self): """ put this file in local test dir: [myconfig.py] user, pwd = "gitlab user", "git lab password", url = 'gitlab url' commit_id = "commitid for test" commit_exists = '/path/somefilename' then pass this test :return: """ self.cf = __import__("myconfig") self.gc = GitCmd(work_dir=self.testDir, user=self.cf.user, pwd=self.cf.pwd, url=self.cf.url) self.gc.clone() def testCheckout(self): self.gc.checkout(self.cf.commit_id) self.exists(self.cf.commit_exists) self.gc.checkout() def testPull(self): self.gc.pull()
def lpush(self, remote, branch=None): git = GitCmd(self.filename, self.repo) git.get_branch() if branch: remote_branch = branch else: remote_branch = git.branch git.checkout(remote_branch) git.execute('pull %s %s' % (remote, remote_branch))