/breezy/trunk

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/trunk

« back to all changes in this revision

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

Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
142
142
        self.assertTrue(self.format.supports_tags())
143
143
 
144
144
 
 
145
class TestRemoteGitBranch(TestCaseWithTransport):
 
146
 
 
147
    def setUp(self):
 
148
        TestCaseWithTransport.setUp(self)
 
149
        self.remote_real = GitRepo.init('remote', mkdir=True)
 
150
        self.remote_url = 'git://%s/' % os.path.abspath(self.remote_real.path)
 
151
        self.permit_url(self.remote_url)
 
152
 
 
153
    def test_set_last_revision_info(self):
 
154
        c1 = self.remote_real.do_commit(
 
155
                message=b'message 1',
 
156
                committer=b'committer <committer@example.com>',
 
157
                author=b'author <author@example.com>',
 
158
                ref=b'refs/heads/newbranch')
 
159
        c2 = self.remote_real.do_commit(
 
160
                message=b'message 2',
 
161
                committer=b'committer <committer@example.com>',
 
162
                author=b'author <author@example.com>',
 
163
                ref=b'refs/heads/newbranch')
 
164
 
 
165
        remote = ControlDir.open(self.remote_url)
 
166
        newbranch = remote.open_branch('newbranch')
 
167
        self.assertEqual(newbranch.lookup_foreign_revision_id(c2),
 
168
                         newbranch.last_revision())
 
169
        newbranch.set_last_revision_info(
 
170
            1, newbranch.lookup_foreign_revision_id(c1))
 
171
        self.assertEqual(c1, self.remote_real.refs[b'refs/heads/newbranch'])
 
172
        self.assertEqual(newbranch.last_revision(),
 
173
                         newbranch.lookup_foreign_revision_id(c1))
 
174
 
 
175
 
145
176
class FetchFromRemoteTestBase(object):
146
177
 
147
178
    _test_needs_features = [ExecutableFeature('git')]