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