77
75
thebranch.last_revision_info())
79
77
def simple_commit_a(self):
81
79
self.build_tree(['a'])
83
return r.do_commit("a", committer="Somebody <foo@example.com>")
80
tests.run_git('add', 'a')
81
tests.run_git('commit', '-m', 'a')
85
83
def test_last_revision_is_valid(self):
86
head = self.simple_commit_a()
84
self.simple_commit_a()
85
head = tests.run_git('rev-parse', 'HEAD').strip()
87
86
thebranch = Branch.open('.')
88
87
self.assertEqual(default_mapping.revision_id_foreign_to_bzr(head),
89
88
thebranch.last_revision())
91
90
def test_revision_history(self):
92
reva = self.simple_commit_a()
91
self.simple_commit_a()
92
reva = tests.run_git('rev-parse', 'HEAD').strip()
93
93
self.build_tree(['b'])
96
revb = r.do_commit("b", committer="Somebody <foo@example.com>")
94
tests.run_git('add', 'b')
95
tests.run_git('commit', '-m', 'b')
96
revb = tests.run_git('rev-parse', 'HEAD').strip()
98
98
thebranch = Branch.open('.')
99
99
self.assertEqual([default_mapping.revision_id_foreign_to_bzr(r) for r in (reva, revb)],
100
100
thebranch.revision_history())
102
102
def test_tag_annotated(self):
103
reva = self.simple_commit_a()
106
o.tagger = "Jelmer <foo@example.com>"
107
o.message = "add tag"
108
o.object = (Commit, reva)
112
r.object_store.add_object(o)
113
r['refs/tags/foo'] = o.id
103
self.simple_commit_a()
104
reva = tests.run_git('rev-parse', 'HEAD').strip()
105
tests.run_git('tag', '-a', '-m', 'add tag', 'foo')
114
106
thebranch = Branch.open('.')
115
107
self.assertEquals({"foo": default_mapping.revision_id_foreign_to_bzr(reva)},
116
108
thebranch.tags.get_tag_dict())
118
110
def test_tag(self):
119
reva = self.simple_commit_a()
121
r.refs["refs/tags/foo"] = reva
111
self.simple_commit_a()
112
reva = tests.run_git('rev-parse', 'HEAD').strip()
113
tests.run_git('tag', '-m', 'add tag', 'foo')
122
114
thebranch = Branch.open('.')
123
115
self.assertEquals({"foo": default_mapping.revision_id_foreign_to_bzr(reva)},
124
116
thebranch.tags.get_tag_dict())
200
192
def test_sprouted_tags(self):
201
193
path, gitsha = self.make_onerev_branch()
203
r.refs["refs/tags/lala"] = r.head()
195
tests.run_git("tag", "lala")
196
os.chdir(self.test_dir)
204
197
oldrepo = Repository.open(path)
205
198
revid = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha)
206
199
newbranch = self.clone_git_branch(path, "f")