~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_send.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-04-13 09:19:53 UTC
  • mfrom: (5148.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100413091953-ow6ds0g52xn734v5
Warn when the working tree is dirty instead of failing for dpush,
        push and send

Show diffs side-by-side

added added

removed removed

Lines of Context:
317
317
    def assertSendFails(self, args):
318
318
        self.run_send(args, rc=3, err_re=self._default_errors)
319
319
 
320
 
    def assertSendSucceeds(self, args, revs=None):
 
320
    def assertSendSucceeds(self, args, revs=None, with_warning=False):
 
321
        if with_warning:
 
322
            err_re = self._default_errors
 
323
        else:
 
324
            err_re = []
321
325
        if revs is None:
322
326
            revs = self._default_sent_revs
323
 
        out, err = self.run_send(args)
324
 
        self.assertEquals(
325
 
            'Bundling %d revision(s).\n' % len(revs), err)
 
327
        out, err = self.run_send(args, err_re=err_re)
 
328
        bundling_revs = 'Bundling %d revision(s).\n' % len(revs)
 
329
        if with_warning:
 
330
            self.assertEndsWith(err, bundling_revs)
 
331
        else:
 
332
            self.assertEquals(bundling_revs, err)
326
333
        md = merge_directive.MergeDirective.from_lines(StringIO(out))
327
334
        self.assertEqual('parent', md.base_revision_id)
328
335
        br = serializer.read_bundle(StringIO(md.get_raw_bundle()))
396
403
        self._default_sent_revs = ['modified-in-local', 'local']
397
404
 
398
405
    def test_send_default(self):
399
 
        self.assertSendFails([])
 
406
        self.assertSendSucceeds([], with_warning=True)
400
407
 
401
408
    def test_send_with_revision(self):
402
409
        self.assertSendSucceeds(['-r', 'revid:local'], revs=['local'])
412
419
        self.assertSendFails([])
413
420
        self.assertSendSucceeds(['--no-strict'])
414
421
 
415
 
 
416
422
    def test_send_bogus_config_var_ignored(self):
417
423
        self.set_config_send_strict("I'm unsure")
418
 
        self.assertSendFails([])
419
 
 
 
424
        self.assertSendSucceeds([], with_warning=True)
420
425
 
421
426
    def test_send_no_strict_command_line_override_config(self):
422
427
        self.set_config_send_strict('true')