Rev 6475: (abentley) Use colocated branch names as nicknames. (Aaron Bentley) in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/2.5/

Patch Queue Manager pqm at pqm.ubuntu.com
Thu Feb 16 18:01:58 UTC 2012


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/2.5/

------------------------------------------------------------
revno: 6475 [merge]
revision-id: pqm at pqm.ubuntu.com-20120216180157-yegt0ppjq6tvfu7w
parent: pqm at pqm.ubuntu.com-20120216085757-uqko416ihb9h0url
parent: aaron at aaronbentley.com-20120216164243-2p3cl04r5lbg69ph
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.5
timestamp: Thu 2012-02-16 18:01:57 +0000
message:
  (abentley) Use colocated branch names as nicknames. (Aaron Bentley)
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/test_config.py    testconfig.py-20051011041908-742d0c15d8d8c8eb
  doc/developers/revision-properties.txt revisionproperties.t-20070807133526-w57m8zv5o7t5kugm-1
  doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2012-01-31 15:43:17 +0000
+++ b/bzrlib/builtins.py	2012-02-16 16:42:43 +0000
@@ -3872,8 +3872,9 @@
 class cmd_nick(Command):
     __doc__ = """Print or set the branch nickname.
 
-    If unset, the tree root directory name is used as the nickname.
-    To print the current nickname, execute with no argument.
+    If unset, the colocated branch name is used for colocated branches, and
+    the branch directory name is used for other branches.  To print the
+    current nickname, execute with no argument.
 
     Bound branches use the nickname of its master branch unless it is set
     locally.

=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2012-02-01 17:02:56 +0000
+++ b/bzrlib/config.py	2012-02-15 22:43:50 +0000
@@ -1482,6 +1482,8 @@
         value = self._get_explicit_nickname()
         if value is not None:
             return value
+        if self.branch.name:
+            return self.branch.name
         return urlutils.unescape(self.branch.base.split('/')[-2])
 
     def has_explicit_nickname(self):

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2012-01-27 13:33:53 +0000
+++ b/bzrlib/tests/__init__.py	2012-02-15 22:43:50 +0000
@@ -2658,10 +2658,11 @@
         self.test_home_dir = self.test_dir + "/MemoryTransportMissingHomeDir"
         self.permit_dir(self.test_dir)
 
-    def make_branch(self, relpath, format=None):
+    def make_branch(self, relpath, format=None, name=None):
         """Create a branch on the transport at relpath."""
         repo = self.make_repository(relpath, format=format)
-        return repo.bzrdir.create_branch(append_revisions_only=False)
+        return repo.bzrdir.create_branch(append_revisions_only=False,
+                                         name=name)
 
     def get_default_format(self):
         return 'default'

=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py	2012-02-01 17:02:56 +0000
+++ b/bzrlib/tests/test_config.py	2012-02-15 22:43:50 +0000
@@ -1196,6 +1196,10 @@
         b = self.make_branch('!repo')
         self.assertEqual('!repo', b.get_config().get_nickname())
 
+    def test_autonick_uses_branch_name(self):
+        b = self.make_branch('foo', name='bar')
+        self.assertEqual('bar', b.get_config().get_nickname())
+
     def test_warn_if_masked(self):
         warnings = []
         def warning(*args):

=== modified file 'doc/developers/revision-properties.txt'
--- a/doc/developers/revision-properties.txt	2011-05-25 13:07:26 +0000
+++ b/doc/developers/revision-properties.txt	2012-02-16 16:42:43 +0000
@@ -35,9 +35,9 @@
  * ``author`` - Single author of the change. This property is deprecated in
    favour of ``authors``. It should no longer be set by any code, but will
    still be read. It is ignored if ``authors`` is set in the same revision.
- * ``branch-nick`` - Nickname of the branch. It's either the directory name
-   or manually set by ``bzr nick``. The value is set automatically in
-   ``MutableTree.commit``.
+ * ``branch-nick`` - Nickname of the branch. This can be specified by the user,
+   but it defaults to the colocated branch name or the branch's directory name.
+   The value is set automatically in ``MutableTree.commit``.
  * ``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'. See

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2012-02-16 08:29:59 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2012-02-16 18:01:57 +0000
@@ -27,6 +27,9 @@
 .. Improvements to existing commands, especially improved performance 
    or memory usage, or better results.
 
+* The names of colocated branches are used as branch nicks if no nick is
+  specified. (Aaron Bentley)
+
 Bug Fixes
 *********
 




More information about the bazaar-commits mailing list