142
142
self.assertTrue(self.format.supports_tags())
145
class TestRemoteGitBranch(TestCaseWithTransport):
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)
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')
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))
145
176
class FetchFromRemoteTestBase(object):
147
178
_test_needs_features = [ExecutableFeature('git')]