1
# Copyright (C) 2011 Canonical Ltd
2
# Authors: Jelmer Vernooij <jelmer@canonical.com>
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
"""Tests for git-like versioned files."""
20
from dulwich.repo import Repo as GitRepo
22
from bzrlib.repository import Repository
23
from bzrlib.tests import TestCaseInTempDir
25
from bzrlib.plugins.git import tests
27
class GitRevisionsTests(TestCaseInTempDir):
30
super(GitRevisionsTests, self).setUp()
31
self.gitrepo = GitRepo.init(self.test_dir)
32
self.revisions = Repository.open(self.test_dir).revisions
35
builder = tests.GitBranchBuilder()
36
builder.set_file('a', 'text for a\n', False)
37
commit_handle = builder.commit('Joe Foo <joe@foo.com>', u'message')
38
mapping = builder.finish()
39
return mapping[commit_handle]
42
self.assertEquals([], self.revisions.keys())
45
# Just a no-op at the moment
46
self.assertTrue(self.revisions.check())
48
def test_revision(self):
49
gitsha = self._do_commit()
50
self.assertEquals([(gitsha,)], self.revisions.keys())