13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
"""Black-box tests for bzr branch."""
159
159
"""Branching a stacked branch is not stacked by default"""
160
160
# We have a mainline
161
161
trunk_tree = self.make_branch_and_tree('target',
162
format='development')
163
163
trunk_tree.commit('mainline')
164
164
# and a branch from it which is stacked
165
165
branch_tree = self.make_branch_and_tree('branch',
166
format='development')
167
167
branch_tree.branch.set_stacked_on_url(trunk_tree.branch.base)
168
168
# with some work on it
169
169
branch_tree.commit('moar work plz')
183
183
"""Asking to stack on a stacked branch does work"""
184
184
# We have a mainline
185
185
trunk_tree = self.make_branch_and_tree('target',
186
format='development')
187
187
trunk_revid = trunk_tree.commit('mainline')
188
188
# and a branch from it which is stacked
189
189
branch_tree = self.make_branch_and_tree('branch',
190
format='development')
191
191
branch_tree.branch.set_stacked_on_url(trunk_tree.branch.base)
192
192
# with some work on it
193
193
branch_revid = branch_tree.commit('moar work plz')
208
208
def test_branch_stacked(self):
209
209
# We have a mainline
210
210
trunk_tree = self.make_branch_and_tree('mainline',
211
format='development')
212
212
original_revid = trunk_tree.commit('mainline')
213
213
self.assertRevisionInRepository('mainline', original_revid)
214
214
# and a branch from it which is stacked
226
226
# We can branch stacking on a smart server
227
227
from bzrlib.smart.server import SmartTCPServer_for_testing
228
228
self.transport_server = SmartTCPServer_for_testing
229
trunk = self.make_branch('mainline', format='development')
229
trunk = self.make_branch('mainline', format='1.9')
230
230
out, err = self.run_bzr(
231
231
['branch', '--stacked', self.get_url('mainline'), 'shallow'])
267
267
self.reset_smart_call_log()
268
268
out, err = self.run_bzr(['branch', self.get_url('from'),
269
269
self.get_url('target')])
270
rpc_count = len(self.hpss_calls)
271
270
# This figure represent the amount of work to perform this use case. It
272
271
# is entirely ok to reduce this number if a test fails due to rpc_count
273
272
# being too low. If rpc_count increases, more network roundtrips have
274
273
# become necessary for this use case. Please do not adjust this number
275
274
# upwards without agreement from bzr's network support maintainers.
276
self.assertEqual(53, rpc_count)
275
self.assertLength(39, self.hpss_calls)
278
277
def test_branch_from_trivial_branch_streaming_acceptance(self):
279
278
self.setup_smart_server_with_call_log()
283
282
self.reset_smart_call_log()
284
283
out, err = self.run_bzr(['branch', self.get_url('from'),
286
rpc_count = len(self.hpss_calls)
287
# This figure represent the amount of work to perform this use case. It
288
# is entirely ok to reduce this number if a test fails due to rpc_count
289
# being too low. If rpc_count increases, more network roundtrips have
290
# become necessary for this use case. Please do not adjust this number
291
# upwards without agreement from bzr's network support maintainers.
292
self.assertEqual(10, rpc_count)
285
# This figure represent the amount of work to perform this use case. It
286
# is entirely ok to reduce this number if a test fails due to rpc_count
287
# being too low. If rpc_count increases, more network roundtrips have
288
# become necessary for this use case. Please do not adjust this number
289
# upwards without agreement from bzr's network support maintainers.
290
self.assertLength(10, self.hpss_calls)
292
def test_branch_from_trivial_stacked_branch_streaming_acceptance(self):
293
self.setup_smart_server_with_call_log()
294
t = self.make_branch_and_tree('trunk')
295
for count in range(8):
296
t.commit(message='commit %d' % count)
297
tree2 = t.branch.bzrdir.sprout('feature', stacked=True
299
tree2.commit('feature change')
300
self.reset_smart_call_log()
301
out, err = self.run_bzr(['branch', self.get_url('feature'),
303
# This figure represent the amount of work to perform this use case. It
304
# is entirely ok to reduce this number if a test fails due to rpc_count
305
# being too low. If rpc_count increases, more network roundtrips have
306
# become necessary for this use case. Please do not adjust this number
307
# upwards without agreement from bzr's network support maintainers.
308
self.assertLength(15, self.hpss_calls)
295
311
class TestRemoteBranch(TestCaseWithSFTPServer):