[MERGE] pull -v respects log_format config var

Vincent Ladeuil v.ladeuil+lp at free.fr
Tue Dec 9 08:05:24 GMT 2008


>>>>> "aaron" == Aaron Bentley <aaron at aaronbentley.com> writes:

    aaron> Hi all,

    aaron> This patch fixes pull -v to respect the log_format
    aaron> configuration variable.  This is related to bug
    aaron> #53872, but is not a complete fix for it.

<snip/>

    aaron> === modified file 'bzrlib/builtins.py'
    aaron> --- bzrlib/builtins.py	2008-11-28 02:32:40 +0000
    aaron> +++ bzrlib/builtins.py	2008-12-09 03:34:07 +0000
    aaron> @@ -798,8 +798,10 @@
    aaron>                      result.old_revid))
    aaron>                  old_rh.reverse()
    aaron>                  new_rh = branch_to.revision_history()
    aaron> +                log_format = log_format = branch_to.get_config().log_format()

Don't say it twice, don't say it twice, even if it's for verbose :)

    aaron>                  log.show_changed_revisions(branch_to, old_rh, new_rh,
    aaron> -                                           to_file=self.outf)
    aaron> +                                           to_file=self.outf,
    aaron> +                                           log_format=log_format)
    aaron>          finally:
    aaron>              branch_to.unlock()
 

    aaron> === modified file 'bzrlib/tests/blackbox/test_pull.py'
    aaron> --- bzrlib/tests/blackbox/test_pull.py	2008-03-25 05:40:55 +0000
    aaron> +++ bzrlib/tests/blackbox/test_pull.py	2008-12-09 01:41:07 +0000
    aaron> @@ -340,3 +340,18 @@
    aaron>          self.addCleanup(lambda: directories.remove('foo:'))
    aaron>          self.run_bzr('pull foo:bar -d target')
    aaron>          self.assertEqual(source_last, target.last_revision())
    aaron> +
    aaron> +    def test_pull_verbose_defaults_to_long(self):
    aaron> +        tree = self.example_branch('source')
    aaron> +        target = self.make_branch_and_tree('target')
    aaron> +        out = self.run_bzr('pull -v source -d target')[0]
    aaron> +        self.assertContainsRe(out,
    aaron> +                              r'revno: 1\ncommitter: .*\nbranch nick: source')
    aaron> +
    aaron> +    def test_pull_verbose_uses_default_log(self):
    aaron> +        tree = self.example_branch('source')
    aaron> +        target = self.make_branch_and_tree('target')
    aaron> +        target_config = target.branch.get_config()
    aaron> +        target_config.set_user_option('log_format', 'short')
    aaron> +        out = self.run_bzr('pull -v source -d target')[0]
    aaron> +        self.assertContainsRe(out, r'\n {4}1 .*\n {6}setup\n')

This looks a bit brittle, how about adding:

        self.assertNotContainsRe(out,
                              r'revno: 1\ncommitter: .*\nbranch nick: source')

I realized this may be overly cautious but better safe than sorry.

BB:tweak

        Vincent



More information about the bazaar mailing list