[MERGE] branch.has_explicit_nick

Robert Collins robertc at robertcollins.net
Fri Jun 30 15:29:37 BST 2006


On Fri, 2006-06-30 at 09:20 -0400, Aaron Bentley wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Robert Collins wrote:
> > On Fri, 2006-06-30 at 16:50 +1000, Robert Collins wrote:
> > 
> >>I think its useful to discriminate between explicit and implicit nick
> >>setting:
> 
> My initial reaction is that I want my explicit nicks to behave the same
> as my implicit nicks.  Could you say more?

Well they clearly dont: rename a dir with an explicit nickname, and the
nick does not change.

I have a plugin I'm fiddling with, and for it, the nickname needs to be
explicitly set for some operations to make the behaviour when the branch
is renamed consistent.

> The recent puts BranchConfig in charge of policy for determining config
> options.  For example, BranchConfig knows that it should try to read
> .bzr/branch/email to determine the per-branch email address.  And it
> also knows that 'post_commit' should never be determined from a TreeConfig.

Sure, I think my later patch took this into consideration. FWIW I find
having both TreeConfig and Branch config confusing, and TreeConfig is
for Branches and BranchConfig is for branches.

> So if an option like this makes sense, I'd prefer to do:
> === modified file 'bzrlib/config.py'
> - --- bzrlib/config.py    2006-06-21 21:35:06 +0000
> +++ bzrlib/config.py    2006-06-30 13:07:28 +0000
> @@ -512,11 +512,17 @@
>          return self._get_safe_value('_post_commit')
> 
>      def _get_nickname(self):
> - -        value = self._get_best_value('_get_nickname')
> +        value = self._get_explicit_nickname()
>          if value is not None:
>              return value
>          return self.branch.base.split('/')[-2]
> 
> +    def has_explicit_nickname(self):
> +        return bool(self._get_explicit_nickname() is not None)
> +
> +    def _get_explicit_nickname():
> +        return self._get_best_value('_get_nickname')
> +
>      def _log_format(self):
>          """See Config.log_format."""
>          return self._get_best_value('_log_format')

I'm find with that too, though I think that the BranchConfig decision
about the *default* nickname is best delegated to the Branch, not to the
Config class, which is why I did the changes to Branch.

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060701/f21d907f/attachment.pgp 


More information about the bazaar mailing list