Rev 122: ``bzr nick`` will now rename a thread rather than setting the current thread in http://bazaar.launchpad.net/~bzr-loom-devs/bzr-loom/trunk/
Robert Collins
robertc at robertcollins.net
Fri Jul 2 05:49:02 BST 2010
At http://bazaar.launchpad.net/~bzr-loom-devs/bzr-loom/trunk/
------------------------------------------------------------
revno: 122
revision-id: robertc at robertcollins.net-20100702044855-8de5fffpvm03txvy
parent: robertc at robertcollins.net-20100702042717-vmrmbshreukz3091
fixes bug(s): https://launchpad.net/bugs/203203 https://launchpad.net/bugs/260947 https://launchpad.net/bugs/304608
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Fri 2010-07-02 14:48:55 +1000
message:
``bzr nick`` will now rename a thread rather than setting the current thread
pointer to an invalid value. (Robert Collins, #203203, #260947, #304608)
=== modified file 'HOWTO'
--- a/HOWTO 2010-07-02 04:27:17 +0000
+++ b/HOWTO 2010-07-02 04:48:55 +0000
@@ -49,7 +49,8 @@
loom plugin to use bzr on it. It will also create a thread called 'upstream'.
The bzr ``nick`` is used to index into the threads in the loom. The current
-thread is the bzr nick for the branch and is recorded in commits as such.
+thread is the bzr nick for the branch and is recorded in commits as such. You
+can use ``bzr nick newname`` to change the name of a thread.
If you do 'bzr push' to a new branch now, it will make the remote branch be a
loom as well. If you push to an existing normal bzr branch, then the current
=== modified file 'NEWS'
--- a/NEWS 2010-07-01 04:18:08 +0000
+++ b/NEWS 2010-07-02 04:48:55 +0000
@@ -42,6 +42,9 @@
when the thread being removed has work not merged into either the thread
above or below. (Robert Collins, #506235)
+* ``bzr nick`` will now rename a thread rather than setting the current thread
+ pointer to an invalid value. (Robert Collins, #203203, #260947, #304608)
+
* ``switch`` now accepts the ``--directory`` option. (Vincent Ladeuil, #595563)
* The ``thread:`` revision specifier will no longer throw an attribute error
=== modified file 'branch.py'
--- a/branch.py 2010-07-02 04:27:17 +0000
+++ b/branch.py 2010-07-02 04:48:55 +0000
@@ -380,7 +380,12 @@
def _rename_thread(self, nick):
"""Rename the current thread to nick."""
- return self._set_nick(nick)
+ state = self.get_loom_state()
+ threads = state.get_threads()
+ current_index = state.thread_index(self.nick)
+ threads[current_index] = (nick,) + threads[current_index][1:]
+ state.set_threads(threads)
+ self._set_last_loom(state)
nick = property(_loom_get_nick, _rename_thread)
=== modified file 'tests/test_branch.py'
--- a/tests/test_branch.py 2010-07-02 04:27:17 +0000
+++ b/tests/test_branch.py 2010-07-02 04:48:55 +0000
@@ -660,3 +660,13 @@
export_branch = Branch.open_from_transport(
root_transport.clone('thread1'))
self.assertEqual('thread1-id', export_branch.last_revision())
+
+ def test_set_nick_renames_thread(self):
+ tree = self.get_tree_with_loom()
+ tree.branch.new_thread(tree.branch.nick)
+ orig_threads = tree.branch.get_loom_state().get_threads()
+ new_thread_name = 'new thread name'
+ tree.branch.nick = new_thread_name
+ new_threads = tree.branch.get_loom_state().get_threads()
+ self.assertNotEqual(orig_threads, new_threads)
+ self.assertEqual(new_thread_name, new_threads[0][0])
More information about the bazaar-commits
mailing list