예제 #1
0
    def test0702_checkout_branch(self):
        local = os.path.join(LOCAL_DIRS, 'local')

        gitcmd.clone(LOCAL_DIRS, HOST_DIR, to='local')
        gitcmd.checkout(local, 'test_branch', True)
        gitcmd.branch(local)
        gitcmd.checkout(local, 'master')
        ret, out, err = gitcmd.branch(local)
        self.assertEqual(ret, 0)
        self.assertEqual("* master\n  test_branch", out)
예제 #2
0
    def test0600_branch(self):
        local = os.path.join(LOCAL_DIRS, 'local')
        test_file = os.path.join(local, 'test')

        gitcmd.clone(LOCAL_DIRS, HOST_DIR, to='local')
        open(test_file, 'w+').close()
        gitcmd.add(test_file)
        gitcmd.commit(test_file, 'test')
        gitcmd.push(local, HOST_DIR)

        ret, out, err = gitcmd.branch(local)
        self.assertEqual(ret, 0)
        self.assertEqual(out, "* master")

        ret, out, err = gitcmd.branch(test_file)
        self.assertEqual(ret, 0)
        self.assertEqual(out, "* master")
예제 #3
0
    def test0701_checkout_new_branch(self):
        local = os.path.join(LOCAL_DIRS, 'local')

        gitcmd.clone(LOCAL_DIRS, HOST_DIR, to='local')
        ret, out, err = gitcmd.checkout(local, 'test_branch', True)
        self.assertEqual(ret, 0)
        self.assertIn("Switched to a new branch 'test_branch'", err)
        ret, out, err = gitcmd.branch(local)
        self.assertEqual("  master\n* test_branch", out)
예제 #4
0
 def test0601_branch_exception(self):
     with self.assertRaises(gitcmd.NotInRepositoryError):
         gitcmd.branch('/tmp')