/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

  • Committer: Jelmer Vernooij
  • Date: 2019-03-04 00:16:27 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7318.
  • Revision ID: jelmer@jelmer.uk-20190304001627-v6u7o6pf97tukhek
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    )
31
31
 
32
32
import os
33
 
import urllib
34
33
 
35
34
from ... import (
36
35
    errors,
117
116
        revb = r.do_commit(b"b", committer=b"Somebody <foo@example.com>")
118
117
 
119
118
        thebranch = Branch.open('.')
120
 
        self.assertEqual((2, default_mapping.revision_id_foreign_to_bzr(revb)), thebranch.last_revision_info())
 
119
        self.assertEqual((2, default_mapping.revision_id_foreign_to_bzr(
 
120
            revb)), thebranch.last_revision_info())
121
121
 
122
122
    def test_tag_annotated(self):
123
123
        reva = self.simple_commit_a()
133
133
        r[b'refs/tags/foo'] = o.id
134
134
        thebranch = Branch.open('.')
135
135
        self.assertEqual({"foo": default_mapping.revision_id_foreign_to_bzr(reva)},
136
 
                          thebranch.tags.get_tag_dict())
 
136
                         thebranch.tags.get_tag_dict())
137
137
 
138
138
    def test_tag(self):
139
139
        reva = self.simple_commit_a()
141
141
        r.refs[b"refs/tags/foo"] = reva
142
142
        thebranch = Branch.open('.')
143
143
        self.assertEqual({"foo": default_mapping.revision_id_foreign_to_bzr(reva)},
144
 
                          thebranch.tags.get_tag_dict())
145
 
 
 
144
                         thebranch.tags.get_tag_dict())
146
145
 
147
146
 
148
147
class TestWithGitBranch(tests.TestCaseWithTransport):
158
157
 
159
158
    def test_get_stacked_on_url(self):
160
159
        self.assertRaises(UnstackableBranchFormat,
161
 
            self.git_branch.get_stacked_on_url)
 
160
                          self.git_branch.get_stacked_on_url)
162
161
 
163
162
    def test_get_physical_lock_status(self):
164
163
        self.assertFalse(self.git_branch.get_physical_lock_status())
171
170
        self.format = branch.LocalGitBranchFormat()
172
171
 
173
172
    def test_get_format_description(self):
174
 
        self.assertEqual("Local Git Branch", self.format.get_format_description())
 
173
        self.assertEqual("Local Git Branch",
 
174
                         self.format.get_format_description())
175
175
 
176
176
    def test_get_network_name(self):
177
177
        self.assertEqual(b"git", self.format.network_name())
228
228
        self.assertEqual({"lala": revid}, newbranch.tags.get_tag_dict())
229
229
        self.assertEqual([revid], newbranch.repository.all_revision_ids())
230
230
 
 
231
    def test_sprouted_ghost_tags(self):
 
232
        path, gitsha = self.make_onerev_branch()
 
233
        r = GitRepo(path)
 
234
        r.refs[b"refs/tags/lala"] = b"aa" * 20
 
235
        oldrepo = Repository.open(path)
 
236
        revid = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha)
 
237
        warnings, newbranch = self.callCatchWarnings(
 
238
            self.clone_git_branch, path, "f")
 
239
        self.assertEqual({}, newbranch.tags.get_tag_dict())
 
240
        # Dulwich raises a UserWarning for tags with invalid target
 
241
        self.assertEqual(1, len(warnings))
 
242
 
231
243
    def test_interbranch_pull(self):
232
244
        path, (gitsha1, gitsha2) = self.make_tworev_branch()
233
245
        oldrepo = Repository.open(path)
272
284
        self.assertEqual(revid1, newbranch.last_revision())
273
285
        self.assertTrue(newbranch.repository.has_revision(revid2))
274
286
 
 
287
    def test_bzr_branch_bound_to_git(self):
 
288
        path, (gitsha1, gitsha2) = self.make_tworev_branch()
 
289
        wt = Branch.open(path).create_checkout('co')
 
290
        self.build_tree_contents([('co/foobar', b'blah')])
 
291
        self.assertRaises(
 
292
            errors.NoRoundtrippingSupport, wt.commit,
 
293
            'commit from bound branch.')
 
294
        revid = wt.commit('commit from bound branch.', lossy=True)
 
295
        self.assertEqual(revid, wt.branch.last_revision())
 
296
        self.assertEqual(
 
297
            revid,
 
298
            wt.branch.get_master_branch().last_revision())
 
299
 
275
300
 
276
301
class ForeignTestsBranchFactory(object):
277
302