~bzr/bzr/bzr-pull-verbose-shows-tip-before-pull

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2009-12-07 15:52:22 UTC
  • Revision ID: v.ladeuil+lp@free.fr-20091207155222-jk9xdb2endwrbs0u
Small tweaks and a NEWS entry.

* bzrlib/tests/blackbox/test_pull.py:
(TestPull.test_pull_verbose_prints_tip_before_pull,
TestPull.test_pull_verbose_does_not_print_tip_when_nothing_is_pulled):
Force the revids to simplify the tests.

* bzrlib/builtins.py:
(cmd_pull.run): Display both the revno and revid before pulling.

Show diffs side-by-side

added added

removed removed

Lines of Context:
392
392
        self.assertEndsWith(remote.get_stacked_on_url(), '/parent')
393
393
 
394
394
    def test_pull_verbose_prints_tip_before_pull(self):
395
 
        a_tree = self.example_branch('a')
396
 
        a_rev_id = a_tree.branch.get_rev_id(1)
397
 
        a_tree.bzrdir.sprout('b', revision_id=a_rev_id)
398
 
        os.chdir('b')
399
 
        out = self.run_bzr('pull -v')[0]
400
 
        # not using assertContainsRe because revision id contains hostname
401
 
        # which may contain '(' ')' which are special regex characters,
402
 
        # which could make the regex matching fail.
403
 
        # Alternative: implement assertContains().
404
 
        self.assertNotEqual(out.find(r'Tip revision before pull was: {' +
405
 
                                     a_rev_id + r'}') , -1)
 
395
        parent = self.make_branch_and_tree('parent')
 
396
        rev1 = parent.commit(message='first commit', rev_id='number-one')
 
397
        rev2 = parent.commit(message='second commit', rev_id='number-two')
 
398
        parent.bzrdir.sprout('branch', revision_id=rev1)
 
399
        out = self.run_bzr('pull -d branch -v')[0]
 
400
        self.assertContainsRe(out, 'Tip revision before pull was:'
 
401
                              ' 1, revid:%s' % rev1)
406
402
 
407
 
    def test_pull_non_verbose_does_not_print_tip_before_pull(self):
408
 
        a_tree = self.example_branch('a')
409
 
        a_rev_id = a_tree.branch.get_rev_id(1)
410
 
        a_tree.bzrdir.sprout('b', revision_id=a_rev_id)
411
 
        os.chdir('b')
412
 
        out = self.run_bzr('pull')[0]
413
 
        self.assertNotContainsRe(out, r'Tip revision before pull was: {')
 
403
    def test_pull_verbose_does_not_print_tip_when_nothing_is_pulled(self):
 
404
        parent = self.make_branch_and_tree('parent')
 
405
        rev1 = parent.commit(message='first commit', rev_id='number-one')
 
406
        rev2 = parent.commit(message='second commit', rev_id='number-two')
 
407
        parent.bzrdir.sprout('branch', revision_id=rev2)
 
408
        out = self.run_bzr('pull -d branch -v')[0]
 
409
        self.assertNotContainsRe(out, 'Tip revision before pull was')