[MERGE] New option --author for commit

Aaron Bentley aaron.bentley at utoronto.ca
Tue Aug 7 19:09:16 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

!resubmit (but this is nearly mergeable)

Lukáš Lalinský wrote:
> + * ``author`` - Author of the change, the value is in the same format as
                                       ^ should be period.  You could
argue for semi-colon, but the current text is a comma-splice.  Maybe
"This value", would be better than "The value".

> + * ``branch-nick`` - Nick of the branch. It's either the directory name
                            ^ "Nickname" is probably more helpful.

> + * ``bugs`` - A list of bug URLs and their statuses. The list is separated
> +   by the new-line character (\n) and each entry is in format
> +   '<URL> <status>'. Currently bzrlib uses only status 'fixed'.
                                 ^ needs comma here

> === modified file 'bzrlib/log.py'
> --- bzrlib/log.py	2007-07-19 03:40:54 +0000
> +++ bzrlib/log.py	2007-08-07 13:08:29 +0000
> @@ -634,11 +634,14 @@
>                  print >>to_file, indent+'parent:', parent_id
>          print >>to_file, indent+'committer:', revision.rev.committer
>  
> -        try:
> -            print >>to_file, indent+'branch nick: %s' % \
> -                revision.rev.properties['branch-nick']
> -        except KeyError:
> -            pass
> +        author = revision.rev.properties.get('author', None)
> +        if author is not None:
> +            print >>to_file, indent+'author:', author

This is improved, but you still need spaces around that '+'.


> +        branch_nick = revision.rev.properties.get('branch-nick', None)
> +        if branch_nick is not None:
> +            print >>to_file, indent+'branch nick:', branch_nick

Oh, thanks.  (But again, '+' needs spaces)

> === modified file 'bzrlib/mutabletree.py'
> --- bzrlib/mutabletree.py	2007-07-04 18:24:24 +0000
> +++ bzrlib/mutabletree.py	2007-08-07 13:08:29 +0000
> @@ -201,6 +201,9 @@
>              revprops = {}
>          if not 'branch-nick' in revprops:
>              revprops['branch-nick'] = self.branch.nick
> +        author = kwargs.pop('author', None)
> +        if not 'author' in revprops and author:
> +            revprops['author'] = author

The explicit "if author is not None" is clearer than "if author".  It
also distinguishes between None and ''.

This allows the author variable to supersede the ['author'] revprop.
I'm not sure that's right.  Did you have a particular reason for that
precedence?

Personally, I'm inclined to think that's a programming error, so I'd
rather this:

        if author is not None:
            assert author not in revprops
            revprops['author'] = author

> === modified file 'bzrlib/tests/test_log.py'
> --- bzrlib/tests/test_log.py	2007-07-05 00:29:29 +0000
> +++ bzrlib/tests/test_log.py	2007-08-04 12:27:04 +0000
> @@ -428,6 +428,35 @@
>    simple log message
>  """)
>  
> +    def test_author_in_log(self):
> +        """Log includes the author name if it's set in
> +        the revision properties
> +        """
> +        wt = self.make_branch_and_tree('.')
> +        b = wt.branch
> +        self.build_tree(['a'])
> +        wt.add('a')
> +        b.nick = 'test_author_log'
> +        wt.commit(message='add a',
> +                  timestamp=1132711707,
> +                  timezone=36000,
> +                  committer='Lorem Ipsum <test at example.com>',
> +                  revprops={'author': 'John Doe <jdoe at example.com>'})

I think this should be updated to use the author parameter.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGuLVM0F+nu1YWqI0RAlkuAJ9TgzFwssrR4G+3bHqOKP2+Pnbw6gCePpn4
xpn0+jCZLNmqiEW48cP3aVc=
=kCxi
-----END PGP SIGNATURE-----



More information about the bazaar mailing list