Rev 97: Merge James Westby's patch for bug 195133. in http://bazaar.launchpad.net/~bzr-loom-devs/bzr-loom/trunk/
Robert Collins
robertc at robertcollins.net
Thu Jun 18 07:28:28 BST 2009
At http://bazaar.launchpad.net/~bzr-loom-devs/bzr-loom/trunk/
------------------------------------------------------------
revno: 97 [merge]
revision-id: robertc at robertcollins.net-20090618062818-l5bsw9tz497brtnl
parent: robertc at robertcollins.net-20090618031414-ide5ozp7c1pkza51
parent: jw+debian at jameswestby.net-20080224230029-zisv2nyallbtafu6
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Thu 2009-06-18 16:28:18 +1000
message:
Merge James Westby's patch for bug 195133.
modified:
NEWS news-20080228111444-miryhm4hma987q57-1
TODO TODO-20060619140504-t23oktsxx8wv9lk7-1
tests/blackbox.py blackbox.py-20060620084702-jnrwijq76kg45klj-7
tree.py tree.py-20060701085538-3ajq87mglfa5ryqa-1
=== modified file 'NEWS'
--- a/NEWS 2009-06-18 03:14:14 +0000
+++ b/NEWS 2009-06-18 06:28:18 +0000
@@ -27,6 +27,10 @@
* ``up`` and ``down`` are now aliases for ``up-thread`` and
``down-thread`` respectively.
+ * ``up-thread`` now notifies when a thread becomes empty. This is a step
+ towards removing it automatically/prompting to do so.
+ (James Westby, #195133)
+
BUGFIXES:
* ``pull`` expects the keywork local. (Mark Lee, #379347)
=== modified file 'TODO'
--- a/TODO 2008-01-20 07:34:29 +0000
+++ b/TODO 2009-06-18 06:28:18 +0000
@@ -95,7 +95,7 @@
TODO either means changing 'diff's defaults, adding a flag to diff, or using
a different revspec prefix; or something like that.)
- export-patch to export the diff from this thread to the lower thread (using -ancestry logic) to a file named as the warp is named. (what about / ?)
-- during up-thread, if we could pull or if there is no diff, then the thread has been merged, offer to remove it.
+- during up-thread, if we could pull or if there is no diff, then the thread has been merged, offer to remove it. (Currently suggests to remove it).
- loom to have the same 'tree root id' as its branches, to allow nested looms by reference. EEK!.
- show-loom to allow -r -1.
- combine-thread to warn if the thread being combined has changes not present in the one below it. I.e. by ancestry, or by doing a merge and recording differences. For bonus points, do the merge, but record the lower thread as the last-revision in the tree still, and set no pending-merges. This preserves the difference whilst still combining the threads.
=== modified file 'tests/blackbox.py'
--- a/tests/blackbox.py 2008-10-02 01:24:28 +0000
+++ b/tests/blackbox.py 2009-06-18 06:28:18 +0000
@@ -431,7 +431,9 @@
self.assertEqual('', out)
self.assertEqual(
"All changes applied successfully.\n"
- "Moved to thread 'patch'.\n", err)
+ "Moved to thread 'patch'.\n"
+ 'This thread is now empty, you may wish to run "bzr '
+ 'combine-thread" to remove it.\n', err)
self.assertEqual('patch', tree.branch.nick)
# the tree needs to be updated.
self.assertEqual(patch_rev, tree.last_revision())
@@ -491,6 +493,55 @@
branch = _mod_branch.Branch.open('.')
self.assertEqual('top', branch.nick)
+ def test_up_with_clean_merge_leaving_thread_empty(self):
+ """This tests what happens when a thread becomes empty.
+
+ A thread becomes empty when all its changes are included in
+ a lower thread, and so its diff to the thread below contains
+ nothing.
+
+ The user should be warned when this happens.
+ """
+ tree = self.get_vendor_loom()
+ self.build_tree(['afile'])
+ tree.add('afile')
+ patch_rev = tree.commit('add afile in base')
+ tree.branch.new_thread('patch')
+ tree.branch.nick = 'patch'
+ # make a change to afile in patch.
+ f = open('afile', 'wb')
+ try:
+ f.write('new contents of afile\n')
+ finally:
+ f.close()
+ patch_rev = tree.commit('make a change to afile')
+ # make the same change in vendor.
+ self.run_bzr(['down-thread'])
+ f = open('afile', 'wb')
+ try:
+ f.write('new contents of afile\n')
+ finally:
+ f.close()
+ vendor_release = tree.commit('make the same change to afile')
+ # check that the trees no longer differ after the up merge,
+ # and that we are
+ out, err = self.run_bzr(['up-thread'])
+ self.assertEqual('', out)
+ self.assertEqual("All changes applied successfully.\n"
+ "Moved to thread 'patch'.\n"
+ 'This thread is now empty, you may wish to run "bzr '
+ 'combine-thread" to remove it.\n', err)
+ self.assertEqual('patch', tree.branch.nick)
+ # the tree needs to be updated.
+ self.assertEqual(patch_rev, tree.last_revision())
+ # the branch needs to be updated.
+ self.assertEqual(patch_rev, tree.branch.last_revision())
+ self.assertTrue(tree.has_filename('afile'))
+ # diff should return 0 now as we have no uncommitted changes.
+ self.run_bzr(['diff'])
+ self.assertEqual([patch_rev, vendor_release], tree.get_parent_ids())
+
+
class TestPush(TestsWithLooms):
=== modified file 'tree.py'
--- a/tree.py 2008-10-02 01:24:28 +0000
+++ b/tree.py 2009-06-18 06:28:18 +0000
@@ -128,6 +128,11 @@
# update the branch nick.
self.tree.branch.nick = new_thread_name
bzrlib.trace.note("Moved to thread '%s'." % new_thread_name)
+ if (basis_tree is not None and
+ not result and not
+ self.tree.changes_from(basis_tree).has_changed()):
+ bzrlib.trace.info("This thread is now empty, you may wish to "
+ 'run "bzr combine-thread" to remove it.')
if result != 0:
return 1
else:
More information about the bazaar-commits
mailing list