Beispiel #1
0
    def test1005_pull_exception(self):
        with self.assertRaises(gitcmd.NotInRepositoryError):
            gitcmd.pull('/tmp', 'url')

        local = os.path.join(LOCAL_DIRS, 'local')
        test_file = os.path.join(local, 'testfile')
        test_file2 = os.path.join(local, 'testfile')

        gitcmd.clone(LOCAL_DIRS, HOST_DIR, to='local')
        gitcmd.clone(LOCAL_DIRS, HOST_DIR, to='local2')
        open(test_file, 'w+').close()
        gitcmd.add(test_file)
        gitcmd.commit(test_file, 'test')
        gitcmd.push(local, HOST_DIR)
        with self.assertRaises(ValueError):
            gitcmd.pull(test_file2, HOST_DIR, "username")
Beispiel #2
0
    def test1002_pull_useless(self):
        local2 = os.path.join(LOCAL_DIRS, 'local2')

        gitcmd.clone(LOCAL_DIRS, HOST_DIR, to='local')
        gitcmd.clone(LOCAL_DIRS, HOST_DIR, to='local2')
        ret, out, err = gitcmd.pull(local2, HOST_DIR)
        self.assertEqual(ret, 0)
        self.assertEqual("Already up to date.", out.replace('-', ' '))
Beispiel #3
0
    def test1001_pull_no_url(self):
        local = os.path.join(LOCAL_DIRS, 'local')
        local2 = os.path.join(LOCAL_DIRS, 'local2')
        test_file = os.path.join(local, 'testfile')
        test_file2 = os.path.join(local, 'testfile')

        gitcmd.clone(LOCAL_DIRS, HOST_DIR, to='local')
        gitcmd.clone(LOCAL_DIRS, HOST_DIR, to='local2')
        open(test_file, 'w+').close()
        gitcmd.add(test_file)
        gitcmd.commit(test_file, 'test')
        gitcmd.push(local, HOST_DIR)
        ret, out, err = gitcmd.pull(local2)
        self.assertEqual(ret, 0)
        self.assertIn("Fast-forward\n testfile", out)
        self.assertTrue(os.path.isfile(test_file2))
Beispiel #4
0
 def test1004_pull_exception(self):
     with self.assertRaises(gitcmd.NotInRepositoryError):
         gitcmd.pull('/tmp', 'url')