[PATCH] bzr whoami

John Arbash Meinel john at arbash-meinel.com
Thu Jun 29 14:25:17 BST 2006


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

Martin Pool wrote:
> On 28 Jun 2006, Robey Pointer <robey at lag.net> wrote:
>> I spent some time today fixing up my ancient 'whoami' patch to fit  
>> the current bzr.dev trunk.  The patch adds:
>>
>> 	* bzr whoami <identity> -- to set your global id
>> 	* bzr whoami --branch <identity> -- to set your id just on this 
>> 	branch
>> 	* unicode-safe identity
> 
> I'd be happy to have that come in.
> 
>> +class TestWhoami(ExternalBase):
>> +
>> +    def test_whoami(self):
>> +        # this should always identify something, if only "john at localhost"
>> +        self.run_bzr("whoami")
>> +        self.run_bzr("whoami", "--email")
> 
> You don't make any assertions about the result, other than that the
> command succeeds.  Is it intentional?
> 

Probably he could assert that the text isn't empty. But he is intending
that it gives something without being configured.



...

>>      @display_command
>> -    def run(self, email=False):
>> -        try:
>> -            c = WorkingTree.open_containing(u'.')[0].branch.get_config()
>> -        except NotBranchError:
>> -            c = config.GlobalConfig()
>> +    def run(self, email=False, branch=False, name=None):
>> +        if name is None:
>> +            # use branch if we're inside one; otherwise global config
>> +            try:
>> +                c = WorkingTree.open_containing(u'.')[0].branch.get_config()
>> +            except NotBranchError:
>> +                c = config.GlobalConfig()
>> +        else:
>> +            # why is this necessary?
>> +            name = name.decode(bzrlib.user_encoding)

^- This decode should not be required. name should already be in
Unicode, the argument parser does it ahead of time.


> Could you please add a note to NEWS, and please update the user
> documentation to explain that the userid can be set this way.
> 
> 

I agree with Martin's other comments as well.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEo9S9JdeBCYSNAAMRAvifAKCWGBJQnp2iWf10XfQHqWIjp6OI+gCeOeUj
mVVo7cE+Xt2mky7zSjnMgyY=
=A2e/
-----END PGP SIGNATURE-----




More information about the bazaar mailing list