57
59
self._reference_values[references[i]] = references[i+1]
58
60
self.follow_reference_calls = []
60
def followReference(self, url):
62
def followReference(self, url, open_dir=None):
61
63
self.follow_reference_calls.append(url)
62
64
return self._reference_values[url]
232
234
self.assertRaises(BranchLoopError, opener.open, a.base)
233
235
self.assertRaises(BranchLoopError, opener.open, b.base)
237
def testCustomOpener(self):
238
# A custom function for opening a control dir can be specified.
239
a = self.make_branch('a', format='2a')
240
b = self.make_branch('b', format='2a')
241
b.set_stacked_on_url(a.base)
245
return BzrDir.open(url)
246
opener = self.makeBranchOpener([a.base, b.base])
247
opener.open(b.base, open_dir=open_dir)
248
self.assertEquals(seen_urls, set([b.base, a.base]))
250
def testCustomOpenerWithBranchReference(self):
251
# A custom function for opening a control dir can be specified.
252
a = self.make_branch('a', format='2a')
253
b_dir = self.make_bzrdir('b')
254
b = BranchReferenceFormat().initialize(b_dir, target_branch=a)
258
return BzrDir.open(url)
259
opener = self.makeBranchOpener([a.base, b.base])
260
opener.open(b.base, open_dir=open_dir)
261
self.assertEquals(seen_urls, set([b.base, a.base]))
236
264
class TestSafeOpen(TestCaseWithTransport):
237
265
"""Tests for `safe_open`."""