/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/git/tests/test_branch.py

Check for specific warning rather than total number of warnings.

Merged from https://code.launchpad.net/~jelmer/brz/print-warnings/+merge/363702

Show diffs side-by-side

added added

removed removed

Lines of Context:
112
112
        reva = self.simple_commit_a()
113
113
        self.build_tree(['b'])
114
114
        r = GitRepo(".")
 
115
        self.addCleanup(r.close)
115
116
        r.stage("b")
116
117
        revb = r.do_commit(b"b", committer=b"Somebody <foo@example.com>")
117
118
 
129
130
        o.tag_timezone = 0
130
131
        o.tag_time = 42
131
132
        r = GitRepo(".")
 
133
        self.addCleanup(r.close)
132
134
        r.object_store.add_object(o)
133
135
        r[b'refs/tags/foo'] = o.id
134
136
        thebranch = Branch.open('.')
138
140
    def test_tag(self):
139
141
        reva = self.simple_commit_a()
140
142
        r = GitRepo(".")
 
143
        self.addCleanup(r.close)
141
144
        r.refs[b"refs/tags/foo"] = reva
142
145
        thebranch = Branch.open('.')
143
146
        self.assertEqual({"foo": default_mapping.revision_id_foreign_to_bzr(reva)},
221
224
    def test_sprouted_tags(self):
222
225
        path, gitsha = self.make_onerev_branch()
223
226
        r = GitRepo(path)
 
227
        self.addCleanup(r.close)
224
228
        r.refs[b"refs/tags/lala"] = r.head()
225
229
        oldrepo = Repository.open(path)
226
230
        revid = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha)
231
235
    def test_sprouted_ghost_tags(self):
232
236
        path, gitsha = self.make_onerev_branch()
233
237
        r = GitRepo(path)
 
238
        self.addCleanup(r.close)
234
239
        r.refs[b"refs/tags/lala"] = b"aa" * 20
235
240
        oldrepo = Repository.open(path)
236
241
        revid = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha)
238
243
            self.clone_git_branch, path, "f")
239
244
        self.assertEqual({}, newbranch.tags.get_tag_dict())
240
245
        # Dulwich raises a UserWarning for tags with invalid target
241
 
        self.assertEqual(1, len(warnings))
 
246
        self.assertIn(('ref refs/tags/lala points at non-present sha ' + ("aa" * 20), ), [w.args for w in warnings])
242
247
 
243
248
    def test_interbranch_pull(self):
244
249
        path, (gitsha1, gitsha2) = self.make_tworev_branch()
272
277
    def test_interbranch_pull_with_tags(self):
273
278
        path, (gitsha1, gitsha2) = self.make_tworev_branch()
274
279
        gitrepo = GitRepo(path)
 
280
        self.addCleanup(gitrepo.close)
275
281
        gitrepo.refs[b"refs/tags/sometag"] = gitsha2
276
282
        oldrepo = Repository.open(path)
277
283
        revid1 = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha1)