Beispiel #1
0
    def test_blob_new(self):
        fwrite(pjoin(superp, "newblob"), "newblob!!!")
        # TODO
        g = Git(GitOpt(), cwd=superp)
        blobhash = g.blob_new("newblob")

        content = cmd0(origit, "cat-file", "-p", blobhash, cwd=superp)
        self.assertEqual("newblob!!!", content)
Beispiel #2
0
    def setUp(self):
        self.maxDiff = None

        _clean_case()

        # .git can not be track in a git repo.
        # need to manually create it.
        fwrite(pjoin(this_base, "testdata", "super", ".git"),
               "gitdir: ../supergit")
Beispiel #3
0
    def _fcontent(self, txt, *ps):
        self.assertTrue(os.path.isfile(pjoin(*ps)),
                        pjoin(*ps) + " should exist")

        actual = fread(pjoin(*ps))
        self.assertEqual(txt, actual, "check file content")
Beispiel #4
0
def _clean_case():

    force_remove(pjoin(this_base, "testdata", "super", ".git"))
    cmdx(origit, "reset", "testdata", cwd=this_base)
    cmdx(origit, "checkout", "testdata", cwd=this_base)
    cmdx(origit, "clean", "-dxf", cwd=this_base)
Beispiel #5
0
from k3handy.cmd import cmd0
from k3handy.cmd import cmdf
from k3handy.cmd import cmdx
from k3handy.cmd import cmdout
from k3handy import CalledProcessError

from k3handy.path import pjoin

dd = k3ut.dd

this_base = os.path.dirname(__file__)

origit = "git"

superp = pjoin(this_base, "testdata", "super")
supergitp = pjoin(this_base, "testdata", "supergit")
wowgitp = pjoin(this_base, "testdata", "wowgit")
branch_test_git_p = pjoin(this_base, "testdata", "branch_test_git")
branch_test_worktree_p = pjoin(this_base, "testdata", "branch_test_worktree")


class BaseTest(unittest.TestCase):
    def setUp(self):
        self.maxDiff = None

        _clean_case()

        # .git can not be track in a git repo.
        # need to manually create it.
        fwrite(pjoin(this_base, "testdata", "super", ".git"),