コード例 #1
0
 def simple_commit(self):
     # Create a git repository with a revision.
     tests.run_git('init')
     builder = tests.GitBranchBuilder()
     builder.set_file('a', 'text for a\n', False)
     builder.commit('Joe Foo <*****@*****.**>', u'<The commit message>')
     builder.finish()
コード例 #2
0
    def test_last_revision_is_null(self):
        tests.run_git('init')

        thebranch = Branch.open('.')
        self.assertEqual(revision.NULL_REVISION, thebranch.last_revision())
        self.assertEqual((0, revision.NULL_REVISION),
                         thebranch.last_revision_info())
コード例 #3
0
 def simple_commit(self):
     # Create a git repository with a revision.
     tests.run_git('init')
     builder = tests.GitBranchBuilder()
     builder.set_file('a', 'text for a\n', False)
     builder.commit('Joe Foo <*****@*****.**>', u'<The commit message>')
     builder.finish()
コード例 #4
0
    def test_tags(self):
        self.simple_commit()

        tests.run_git("tag", "foo")

        output, error = self.run_bzr(['tags'])
        self.assertEquals(error, '')
        self.assertEquals(output, "foo                  1\n")
コード例 #5
0
    def test_tags(self):
        self.simple_commit()

        tests.run_git("tag", "foo")

        output, error = self.run_bzr(['tags'])
        self.assertEquals(error, '')
        self.assertEquals(output, "foo                  1\n")
コード例 #6
0
    def test_create_real_branch(self):
        tests.run_git('init')

        builder = tests.GitBranchBuilder()
        builder.set_file(u'foo', 'contents\nfoo\n', False)
        r1 = builder.commit('Joe Foo <*****@*****.**>', u'first',
                            timestamp=1194586400)
        mapping = builder.finish()
        self.assertEqual({1:'44411e8e9202177dd19b6599d7a7991059fa3cb4',
                          2: 'b0b62e674f67306fddcf72fa888c3b56df100d64',
                         }, mapping)
コード例 #7
0
    def test_tags(self):
        self.simple_commit_a()
        reva = tests.run_git('rev-parse', 'HEAD').strip()

        tests.run_git('tag', '-a', '-m', 'add tag', 'foo')

        newid = open('.git/refs/tags/foo').read().rstrip()

        thebranch = Branch.open('.')
        self.assertEquals(
            {"foo": default_mapping.revision_id_foreign_to_bzr(newid)},
            thebranch.tags.get_tag_dict())
コード例 #8
0
    def test_branch(self):
        os.mkdir("gitbranch")
        os.chdir("gitbranch")
        tests.run_git('init')
        builder = tests.GitBranchBuilder()
        builder.set_file('a', 'text for a\n', False)
        builder.commit('Joe Foo <*****@*****.**>', u'<The commit message>')
        builder.finish()

        os.chdir("..")
        output, error = self.run_bzr(['branch', 'gitbranch', 'bzrbranch'])
        self.assertEqual(error, 'Branched 1 revision(s).\n')
        self.assertEqual(output, 'git: counting objects: 3\r\n')
コード例 #9
0
 def simple_commit(self):
     # Create a git repository with some interesting files in a revision.
     tests.run_git('init')
     builder = tests.GitBranchBuilder()
     builder.set_file('data', 'text\n', False)
     builder.set_file('executable', 'content', True)
     builder.set_link('link', 'broken')
     builder.set_file('subdir/subfile', 'subdir text\n', False)
     commit_handle = builder.commit('Joe Foo <*****@*****.**>',
                                    u'message',
                                    timestamp=1205433193)
     mapping = builder.finish()
     return mapping[commit_handle]
コード例 #10
0
    def test_branch(self):
        os.mkdir("gitbranch")
        os.chdir("gitbranch")
        tests.run_git('init')
        builder = tests.GitBranchBuilder()
        builder.set_file('a', 'text for a\n', False)
        builder.commit('Joe Foo <*****@*****.**>', u'<The commit message>')
        builder.finish()

        os.chdir("..")
        output, error = self.run_bzr(['branch', 'gitbranch', 'bzrbranch'])
        self.assertEqual(error, 'Branched 1 revision(s).\n')
        self.assertEqual(output, 'git: counting objects: 3\r\n')
コード例 #11
0
    def test_create_real_branch(self):
        tests.run_git('init')

        builder = tests.GitBranchBuilder()
        builder.set_file(u'foo', 'contents\nfoo\n', False)
        r1 = builder.commit('Joe Foo <*****@*****.**>',
                            u'first',
                            timestamp=1194586400)
        mapping = builder.finish()
        self.assertEqual(
            {
                1: '44411e8e9202177dd19b6599d7a7991059fa3cb4',
                2: 'b0b62e674f67306fddcf72fa888c3b56df100d64',
            }, mapping)
コード例 #12
0
    def test_last_revision_is_valid(self):
        self.simple_commit_a()
        head = tests.run_git('rev-parse', 'HEAD').strip()

        thebranch = Branch.open('.')
        self.assertEqual(default_mapping.revision_id_foreign_to_bzr(head),
                         thebranch.last_revision())
コード例 #13
0
    def test_get_revision(self):
        # GitRepository.get_revision gives a Revision object.

        # Create a git repository with a revision.
        tests.run_git('init')
        builder = tests.GitBranchBuilder()
        builder.set_file('a', 'text for a\n', False)
        commit_handle = builder.commit('Joe Foo <*****@*****.**>', u'message')
        mapping = builder.finish()
        commit_id = mapping[commit_handle]

        # Get the corresponding Revision object.
        revid = default_mapping.revision_id_foreign_to_bzr(commit_id)
        repo = Repository.open('.')
        rev = repo.get_revision(revid)
        self.assertIsInstance(rev, revision.Revision)
コード例 #14
0
    def test_revision_history(self):
        self.simple_commit_a()
        reva = tests.run_git('rev-parse', 'HEAD').strip()
        self.build_tree(['b'])
        tests.run_git('add', 'b')
        tests.run_git('commit', '-m', 'b')
        revb = tests.run_git('rev-parse', 'HEAD').strip()

        thebranch = Branch.open('.')
        self.assertEqual([
            default_mapping.revision_id_foreign_to_bzr(r) for r in (reva, revb)
        ], thebranch.revision_history())
コード例 #15
0
    def test_get_revision_unknown(self):
        tests.run_git('init')

        repo = Repository.open('.')
        self.assertRaises(errors.NoSuchRevision, repo.get_revision, "bla")
コード例 #16
0
 def simple_commit_a(self):
     tests.run_git('init')
     self.build_tree(['a'])
     tests.run_git('add', 'a')
     tests.run_git('commit', '-m', 'a')
コード例 #17
0
ファイル: test_dir.py プロジェクト: harsh-a1/repeater-testing
    def test_open_existing(self):
        tests.run_git('init')

        gd = bzrdir.BzrDir.open('.')
        self.assertIsInstance(gd, dir.LocalGitDir)
コード例 #18
0
    def test_open_existing(self):
        tests.run_git('init')

        thebranch = Branch.open('.')
        self.assertIsInstance(thebranch, branch.GitBranch)
コード例 #19
0
ファイル: test_dir.py プロジェクト: harsh-a1/repeater-testing
    def test_open_workingtree(self):
        tests.run_git('init')

        gd = bzrdir.BzrDir.open('.')
        wt = gd.open_workingtree()
        self.assertIsInstance(wt, workingtree.GitWorkingTree)
コード例 #20
0
ファイル: test_dir.py プロジェクト: harsh-a1/repeater-testing
    def test_open_workingtree_bare(self):
        tests.run_git('--bare', 'init')

        gd = bzrdir.BzrDir.open('.')
        self.assertRaises(errors.NoWorkingTree, gd.open_workingtree)
コード例 #21
0
    def test_has_git_repo(self):
        tests.run_git('init')

        repo = Repository.open('.')
        self.assertIsInstance(repo._git, git.repo.Repo)
コード例 #22
0
    def test_open_existing(self):
        tests.run_git('init')

        repo = Repository.open('.')
        self.assertIsInstance(repo, repository.GitRepository)