Merge lp:~abentley/bzr/name-nick into lp:bzr/2.5

Proposed by Aaron Bentley
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 6474
Merged at revision: 6475
Proposed branch: lp:~abentley/bzr/name-nick
Merge into: lp:bzr/2.5
Diff against target: 91 lines (+18/-7)
6 files modified
bzrlib/builtins.py (+3/-2)
bzrlib/config.py (+2/-0)
bzrlib/tests/__init__.py (+3/-2)
bzrlib/tests/test_config.py (+4/-0)
doc/developers/revision-properties.txt (+3/-3)
doc/en/release-notes/bzr-2.5.txt (+3/-0)
To merge this branch: bzr merge lp:~abentley/bzr/name-nick
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) Approve
Review via email: mp+93319@code.launchpad.net

Commit message

(abentley) Use colocated branch names as nicknames. (Aaron Bentley)

Description of the change

This branch uses the colocated branch name as the default branch nick. This allows the branch nick to continue providing the most specific name the user has given the branch. It makes it likely that colocated branches will have unique nicknames. It also fixes pipeline, which works on the assumption that nicknames are unique.

To post a comment you must log in.
Revision history for this message
Martin Pool (mbp) wrote :

I'll let jelmer comment too, but that makes sense to me.

[fix] It seems it ought to be mentioned in the user guide about branch nicks, and maybe in the help strings for them (if any).

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

This seems like a good idea.

review: Approve
lp:~abentley/bzr/name-nick updated
6475. By Aaron Bentley

Update docs.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/builtins.py'
2--- bzrlib/builtins.py 2012-01-31 15:43:17 +0000
3+++ bzrlib/builtins.py 2012-02-16 16:48:22 +0000
4@@ -3872,8 +3872,9 @@
5 class cmd_nick(Command):
6 __doc__ = """Print or set the branch nickname.
7
8- If unset, the tree root directory name is used as the nickname.
9- To print the current nickname, execute with no argument.
10+ If unset, the colocated branch name is used for colocated branches, and
11+ the branch directory name is used for other branches. To print the
12+ current nickname, execute with no argument.
13
14 Bound branches use the nickname of its master branch unless it is set
15 locally.
16
17=== modified file 'bzrlib/config.py'
18--- bzrlib/config.py 2012-02-01 17:02:56 +0000
19+++ bzrlib/config.py 2012-02-16 16:48:22 +0000
20@@ -1482,6 +1482,8 @@
21 value = self._get_explicit_nickname()
22 if value is not None:
23 return value
24+ if self.branch.name:
25+ return self.branch.name
26 return urlutils.unescape(self.branch.base.split('/')[-2])
27
28 def has_explicit_nickname(self):
29
30=== modified file 'bzrlib/tests/__init__.py'
31--- bzrlib/tests/__init__.py 2012-01-27 13:33:53 +0000
32+++ bzrlib/tests/__init__.py 2012-02-16 16:48:22 +0000
33@@ -2658,10 +2658,11 @@
34 self.test_home_dir = self.test_dir + "/MemoryTransportMissingHomeDir"
35 self.permit_dir(self.test_dir)
36
37- def make_branch(self, relpath, format=None):
38+ def make_branch(self, relpath, format=None, name=None):
39 """Create a branch on the transport at relpath."""
40 repo = self.make_repository(relpath, format=format)
41- return repo.bzrdir.create_branch(append_revisions_only=False)
42+ return repo.bzrdir.create_branch(append_revisions_only=False,
43+ name=name)
44
45 def get_default_format(self):
46 return 'default'
47
48=== modified file 'bzrlib/tests/test_config.py'
49--- bzrlib/tests/test_config.py 2012-02-01 17:02:56 +0000
50+++ bzrlib/tests/test_config.py 2012-02-16 16:48:22 +0000
51@@ -1196,6 +1196,10 @@
52 b = self.make_branch('!repo')
53 self.assertEqual('!repo', b.get_config().get_nickname())
54
55+ def test_autonick_uses_branch_name(self):
56+ b = self.make_branch('foo', name='bar')
57+ self.assertEqual('bar', b.get_config().get_nickname())
58+
59 def test_warn_if_masked(self):
60 warnings = []
61 def warning(*args):
62
63=== modified file 'doc/developers/revision-properties.txt'
64--- doc/developers/revision-properties.txt 2011-05-25 13:07:26 +0000
65+++ doc/developers/revision-properties.txt 2012-02-16 16:48:22 +0000
66@@ -35,9 +35,9 @@
67 * ``author`` - Single author of the change. This property is deprecated in
68 favour of ``authors``. It should no longer be set by any code, but will
69 still be read. It is ignored if ``authors`` is set in the same revision.
70- * ``branch-nick`` - Nickname of the branch. It's either the directory name
71- or manually set by ``bzr nick``. The value is set automatically in
72- ``MutableTree.commit``.
73+ * ``branch-nick`` - Nickname of the branch. This can be specified by the user,
74+ but it defaults to the colocated branch name or the branch's directory name.
75+ The value is set automatically in ``MutableTree.commit``.
76 * ``bugs`` - A list of bug URLs and their statuses. The list is separated
77 by the new-line character (\\n) and each entry is in format
78 '<URL> <status>'. Currently, bzrlib uses only status 'fixed'. See
79
80=== modified file 'doc/en/release-notes/bzr-2.5.txt'
81--- doc/en/release-notes/bzr-2.5.txt 2012-02-16 08:29:59 +0000
82+++ doc/en/release-notes/bzr-2.5.txt 2012-02-16 16:48:22 +0000
83@@ -27,6 +27,9 @@
84 .. Improvements to existing commands, especially improved performance
85 or memory usage, or better results.
86
87+* The names of colocated branches are used as branch nicks if no nick is
88+ specified. (Aaron Bentley)
89+
90 Bug Fixes
91 *********
92

Subscribers

People subscribed via source and target branches