/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/plugins/git/tests/test_branch.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-05-15 18:47:57 UTC
  • mfrom: (6964.2.7 python3-git)
  • Revision ID: breezy.the.bot@gmail.com-20180515184757-xozniaj9gztgtom8
Port some of brz-git to python3.

Merged from https://code.launchpad.net/~jelmer/brz/python3-git/+merge/345479

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
            )
72
72
        d = ControlDir.open(url)
73
73
        b = d.create_branch()
74
 
        self.assertEquals(b.ref, "refs/remotes/origin/unstable")
 
74
        self.assertEqual(b.ref, "refs/remotes/origin/unstable")
75
75
 
76
76
    def test_open_existing(self):
77
77
        r = GitRepo.init('.')
83
83
        r = GitRepo.init('.')
84
84
        d = ControlDir.open('.')
85
85
        thebranch = d.create_branch()
86
 
        self.assertEquals(
 
86
        self.assertEqual(
87
87
            "<LocalGitBranch('%s/', u'master')>" % (
88
88
                urlutils.local_path_to_url(self.test_dir),),
89
89
            repr(thebranch))
116
116
        revb = r.do_commit("b", committer="Somebody <foo@example.com>")
117
117
 
118
118
        thebranch = Branch.open('.')
119
 
        self.assertEquals((2, default_mapping.revision_id_foreign_to_bzr(revb)), thebranch.last_revision_info())
 
119
        self.assertEqual((2, default_mapping.revision_id_foreign_to_bzr(revb)), thebranch.last_revision_info())
120
120
 
121
121
    def test_tag_annotated(self):
122
122
        reva = self.simple_commit_a()
131
131
        r.object_store.add_object(o)
132
132
        r['refs/tags/foo'] = o.id
133
133
        thebranch = Branch.open('.')
134
 
        self.assertEquals({"foo": default_mapping.revision_id_foreign_to_bzr(reva)},
 
134
        self.assertEqual({"foo": default_mapping.revision_id_foreign_to_bzr(reva)},
135
135
                          thebranch.tags.get_tag_dict())
136
136
 
137
137
    def test_tag(self):
139
139
        r = GitRepo(".")
140
140
        r.refs["refs/tags/foo"] = reva
141
141
        thebranch = Branch.open('.')
142
 
        self.assertEquals({"foo": default_mapping.revision_id_foreign_to_bzr(reva)},
 
142
        self.assertEqual({"foo": default_mapping.revision_id_foreign_to_bzr(reva)},
143
143
                          thebranch.tags.get_tag_dict())
144
144
 
145
145
 
170
170
        self.format = branch.LocalGitBranchFormat()
171
171
 
172
172
    def test_get_format_description(self):
173
 
        self.assertEquals("Local Git Branch", self.format.get_format_description())
 
173
        self.assertEqual("Local Git Branch", self.format.get_format_description())
174
174
 
175
175
    def test_get_network_name(self):
176
 
        self.assertEquals("git", self.format.network_name())
 
176
        self.assertEqual("git", self.format.network_name())
177
177
 
178
178
    def test_supports_tags(self):
179
179
        self.assertTrue(self.format.supports_tags())
213
213
        path, gitsha = self.make_onerev_branch()
214
214
        oldrepo = Repository.open(path)
215
215
        revid = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha)
216
 
        self.assertEquals(gitsha, oldrepo._git.get_refs()["refs/heads/master"])
 
216
        self.assertEqual(gitsha, oldrepo._git.get_refs()["refs/heads/master"])
217
217
        newbranch = self.clone_git_branch(path, "f")
218
 
        self.assertEquals([revid], newbranch.repository.all_revision_ids())
 
218
        self.assertEqual([revid], newbranch.repository.all_revision_ids())
219
219
 
220
220
    def test_sprouted_tags(self):
221
221
        path, gitsha = self.make_onerev_branch()
224
224
        oldrepo = Repository.open(path)
225
225
        revid = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha)
226
226
        newbranch = self.clone_git_branch(path, "f")
227
 
        self.assertEquals({"lala": revid}, newbranch.tags.get_tag_dict())
228
 
        self.assertEquals([revid], newbranch.repository.all_revision_ids())
 
227
        self.assertEqual({"lala": revid}, newbranch.tags.get_tag_dict())
 
228
        self.assertEqual([revid], newbranch.repository.all_revision_ids())
229
229
 
230
230
    def test_interbranch_pull(self):
231
231
        path, (gitsha1, gitsha2) = self.make_tworev_branch()
234
234
        newbranch = self.make_branch('g')
235
235
        inter_branch = InterBranch.get(Branch.open(path), newbranch)
236
236
        inter_branch.pull()
237
 
        self.assertEquals(revid2, newbranch.last_revision())
 
237
        self.assertEqual(revid2, newbranch.last_revision())
238
238
 
239
239
    def test_interbranch_pull_noop(self):
240
240
        path, (gitsha1, gitsha2) = self.make_tworev_branch()
245
245
        inter_branch.pull()
246
246
        # This is basically "assertNotRaises"
247
247
        inter_branch.pull()
248
 
        self.assertEquals(revid2, newbranch.last_revision())
 
248
        self.assertEqual(revid2, newbranch.last_revision())
249
249
 
250
250
    def test_interbranch_pull_stop_revision(self):
251
251
        path, (gitsha1, gitsha2) = self.make_tworev_branch()
254
254
        newbranch = self.make_branch('g')
255
255
        inter_branch = InterBranch.get(Branch.open(path), newbranch)
256
256
        inter_branch.pull(stop_revision=revid1)
257
 
        self.assertEquals(revid1, newbranch.last_revision())
 
257
        self.assertEqual(revid1, newbranch.last_revision())
258
258
 
259
259
    def test_interbranch_pull_with_tags(self):
260
260
        path, (gitsha1, gitsha2) = self.make_tworev_branch()
268
268
        source_branch.get_config().set_user_option("branch.fetch_tags", True)
269
269
        inter_branch = InterBranch.get(source_branch, newbranch)
270
270
        inter_branch.pull(stop_revision=revid1)
271
 
        self.assertEquals(revid1, newbranch.last_revision())
 
271
        self.assertEqual(revid1, newbranch.last_revision())
272
272
        self.assertTrue(newbranch.repository.has_revision(revid2))
273
273
 
274
274