[MERGE] branch.has_explicit_nick
Robert Collins
robertc at robertcollins.net
Fri Jun 30 09:34:55 BST 2006
On Fri, 2006-06-30 at 16:50 +1000, Robert Collins wrote:
> I think its useful to discriminate between explicit and implicit nick
> setting:
A better patch, now I've got the sense of the config rearrangement.
=== modified file 'bzrlib/branch.py'
--- bzrlib/branch.py 2006-06-27 00:58:18 +0000
+++ bzrlib/branch.py 2006-06-30 08:28:28 +0000
@@ -142,7 +142,10 @@
return bzrlib.config.BranchConfig(self)
def _get_nick(self):
- return self.get_config().get_nickname()
+ result = self.get_config().get_nickname()
+ if result is not None:
+ return result
+ return self.base.split('/')[-2]
def _set_nick(self, nick):
self.get_config().set_user_option('nickname', nick)
@@ -571,6 +574,15 @@
mainline_parent_id = revision_id
return BranchCheckResult(self)
+ def has_explicit_nick(self):
+ """Does this branch have an explicitly set nickname.
+
+ :return: True if it does.
+ """
+ cfg = self.get_config()
+ nick = cfg.get_nickname()
+ return nick is not None
+
class BranchFormat(object):
"""An encapsulation of the initialization and open routines for a
format.
=== modified file 'bzrlib/config.py'
--- bzrlib/config.py 2006-06-21 21:35:06 +0000
+++ bzrlib/config.py 2006-06-30 08:25:53 +0000
@@ -512,10 +512,7 @@
return self._get_safe_value('_post_commit')
def _get_nickname(self):
- value = self._get_best_value('_get_nickname')
- if value is not None:
- return value
- return self.branch.base.split('/')[-2]
+ return self._get_best_value('_get_nickname')
def _log_format(self):
"""See Config.log_format."""
-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/20060630/5b359992/attachment.pgp
More information about the bazaar
mailing list