1183
1183
client.add_expected_call(
1184
1184
'Branch.last_revision_info', ('quack/',),
1185
1185
'success', ('ok', '1', 'rev-tip'))
1186
client.add_expected_call(
1187
'Branch.get_config_file', ('quack/',),
1188
'success', ('ok',), '')
1189
transport.mkdir('quack')
1190
transport = transport.clone('quack')
1191
branch = self.make_remote_branch(transport, client)
1192
result = branch.heads_to_fetch()
1193
self.assertFinished(client)
1194
self.assertEqual((set(['rev-tip']), set()), result)
1196
def test_uses_last_revision_info_and_tags_when_set(self):
1197
transport = MemoryTransport()
1198
client = FakeClient(transport.base)
1199
client.add_expected_call(
1200
'Branch.get_stacked_on_url', ('quack/',),
1201
'error', ('NotStacked',))
1202
client.add_expected_call(
1203
'Branch.last_revision_info', ('quack/',),
1204
'success', ('ok', '1', 'rev-tip'))
1205
client.add_expected_call(
1206
'Branch.get_config_file', ('quack/',),
1207
'success', ('ok',), 'branch.fetch_tags = True')
1208
1186
# XXX: this will break if the default format's serialization of tags
1209
1187
# changes, or if the RPC for fetching tags changes from get_tags_bytes.
1210
1188
client.add_expected_call(
1235
1213
self.assertFinished(client)
1236
1214
self.assertEqual((set(['tip']), set(['tagged-1', 'tagged-2'])), result)
1238
def make_branch_with_tags(self):
1216
def test_backwards_compatible(self):
1239
1217
self.setup_smart_server_with_call_log()
1240
1218
# Make a branch with a single revision.
1241
1219
builder = self.make_branch_builder('foo')
1247
1225
# Add two tags to that branch
1248
1226
branch.tags.set_tag('tag-1', 'rev-1')
1249
1227
branch.tags.set_tag('tag-2', 'rev-2')
1252
def test_backwards_compatible(self):
1253
branch = self.make_branch_with_tags()
1254
c = branch.get_config()
1255
c.set_user_option('branch.fetch_tags', 'True')
1256
1228
self.addCleanup(branch.lock_read().unlock)
1257
1229
# Disable the heads_to_fetch verb
1258
1230
verb = 'Branch.heads_to_fetch'
1261
1233
result = branch.heads_to_fetch()
1262
1234
self.assertEqual((set(['tip']), set(['rev-1', 'rev-2'])), result)
1263
1235
self.assertEqual(
1264
['Branch.last_revision_info', 'Branch.get_config_file',
1265
'Branch.get_tags_bytes'],
1266
[call.call.method for call in self.hpss_calls])
1268
def test_backwards_compatible_no_tags(self):
1269
branch = self.make_branch_with_tags()
1270
c = branch.get_config()
1271
c.set_user_option('branch.fetch_tags', 'False')
1272
self.addCleanup(branch.lock_read().unlock)
1273
# Disable the heads_to_fetch verb
1274
verb = 'Branch.heads_to_fetch'
1275
self.disable_verb(verb)
1276
self.reset_smart_call_log()
1277
result = branch.heads_to_fetch()
1278
self.assertEqual((set(['tip']), set()), result)
1280
['Branch.last_revision_info', 'Branch.get_config_file'],
1236
['Branch.last_revision_info', 'Branch.get_tags_bytes'],
1281
1237
[call.call.method for call in self.hpss_calls])