[PATCH] indent merges more nicely during merge

Martin Pool mbp at sourcefrog.net
Tue Mar 28 19:01:37 BST 2006


On 29 Mar 2006, Robert Collins <robertc at robertcollins.net> wrote:
> This patch makes log indent merges more prettily and ensures full
> topological order within merge regions.

This looks much much nicer.  +1 to merge, with just a couple of
comments, which need not be done right now.

> ------------------------------------------------------------
> revno: 1591
> committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
> branch nick: +trunk
> timestamp: Mon 2006-03-20 10:33:11 +0000
> message:
>   (mbp) pycurl bugfixes, robert's knit performance stuff
>     ------------------------------------------------------------
>     merged: mbp at sourcefrog.net-20060320095825-ed99032ef9743cc8
>     committer: Martin Pool <mbp at sourcefrog.net>
>     branch nick: bzr.mbp.integration
>     timestamp: Mon 2006-03-20 09:58:25 +0000
>     message:
>       [merge] robert's knit-performance work

I think we could omit the merged revision-id here; the indenting makes
it clear that it was merged.

> +class TestLogMerges(ExternalBase):
> +
> +    def test_merges_are_indented_by_level(self):
> +        self.build_tree(['parent/'])
> +        self.run_bzr('init', 'parent')
> +        self.run_bzr('commit', '-m', 'first post', '--unchanged', 'parent')
> +        self.run_bzr('branch', 'parent', 'child')
> +        self.run_bzr('commit', '-m', 'branch 1', '--unchanged', 'child')
> +        self.run_bzr('branch', 'child', 'smallerchild')
> +        self.run_bzr('commit', '-m', 'branch 2', '--unchanged', 'smallerchild')
> +        os.chdir('child')
> +        self.run_bzr('merge', '../smallerchild')
> +        self.run_bzr('commit', '-m', 'merge branch 2')
> +        os.chdir('../parent')
> +        self.run_bzr('merge', '../child')
> +        self.run_bzr('commit', '-m', 'merge branch 1')
> +        out,err = self.run_bzr('log')
> +        # the log will look something like:
> +#        self.assertEqual("""\
> +#------------------------------------------------------------
> +#revno: 2
> +#committer: Robert Collins <foo at example.com>
> +#branch nick: parent
> +#timestamp: Tue 2006-03-28 22:31:40 +1100
> +#message:
> +#  merge branch 1
> +#    ------------------------------------------------------------
> +#    merged: foo at example.com-20060328113140-91f43cfb46dc2863
> +#    committer: Robert Collins <foo at example.com>
> +#    branch nick: child
> +#    timestamp: Tue 2006-03-28 22:31:40 +1100
> +#    message:
> +#      merge branch 2
> +#        ------------------------------------------------------------
> +#        merged: foo at example.com-20060328113140-1ba24f850a0ef573
> +#        committer: Robert Collins <foo at example.com>
> +#        branch nick: smallerchild
> +#        timestamp: Tue 2006-03-28 22:31:40 +1100
> +#        message:
> +#          branch 2
> +#    ------------------------------------------------------------
> +#    merged: foo at example.com-20060328113140-5749a4757a8ac792
> +#    committer: Robert Collins <foo at example.com>
> +#    branch nick: child
> +#    timestamp: Tue 2006-03-28 22:31:40 +1100
> +#    message:
> +#      branch 1
> +#------------------------------------------------------------
> +#revno: 1
> +#committer: Robert Collins <foo at example.com>
> +#branch nick: parent
> +#timestamp: Tue 2006-03-28 22:31:39 +1100
> +#message:
> +#  first post
> +#""", out)
> +        # but we dont have a nice pattern matcher hooked up yet, so:
> +        # we check for the indenting of the commit message:
> +        self.assertTrue('  merge branch 1' in out)
> +        self.assertTrue('      merge branch 2' in out)
> +        self.assertTrue('          branch 2' in out)
> +        self.assertTrue('      branch 1' in out)
> +        self.assertTrue('  first post' in out)
> +        self.assertEqual('', err)

Well, you can compare the whole string to a sinlge long regexp, which
would allow you just stub out the revision-ids and the dates with .*.
(If there's a mismatch it may be a bit hard to see exactly where the
problem is.)

-- 
Martin




More information about the bazaar mailing list