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