Merge lp:~lifeless/bzr/update into lp:bzr

Proposed by Robert Collins
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~lifeless/bzr/update
Merge into: lp:bzr
Diff against target: 80 lines (+47/-1)
3 files modified
NEWS (+4/-0)
bzrlib/builtins.py (+2/-1)
bzrlib/tests/blackbox/test_update.py (+41/-0)
To merge this branch: bzr merge lp:~lifeless/bzr/update
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+23372@code.launchpad.net

Commit message

(robertc) Do not warn when updating if a pending merge was merged into trunk. (Robert Collins, bug 562079)

Description of the change

This should go into 2.2 I think. I had thought it was a regression, but its not, however a partial fix is very simple - attached. A more comprehensive fix would need changed apis or history analysis, neither of which is worth it at the moment, I think.

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

Looks good. Doesn't seem like this would be a regression, but it is a positive improvement.

review: Approve
Revision history for this message
Robert Collins (lifeless) wrote :

Queued on 2010-04-14 04:57:09.021514+00:00 now submitted to PQM.

Revision history for this message
Robert Collins (lifeless) wrote :

Queued on 2010-04-14 04:57:09.021514+00:00 now submitted to PQM.

Revision history for this message
Robert Collins (lifeless) wrote :

Sorry for the spam, was testing-live a tweak.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2010-04-14 04:35:47 +0000
3+++ NEWS 2010-04-14 04:51:18 +0000
4@@ -28,6 +28,10 @@
5 True explicitly to get the previous behaviour.
6 (Vincent Ladeuil, #519319)
7
8+* ``bzr update`` when a pending merge in the working tree has been merged
9+ into the master branch will no longer claim that old commits have become
10+ pending merges. (Robert Collins, #562079)
11+
12 * ``bzrlib.mutabletree.MutableTree.commit`` will now support a passed in
13 config as in previous versions of bzrlib. (Robert Collins)
14
15
16=== modified file 'bzrlib/builtins.py'
17--- bzrlib/builtins.py 2010-04-14 04:35:47 +0000
18+++ bzrlib/builtins.py 2010-04-14 04:51:18 +0000
19@@ -1462,7 +1462,8 @@
20 _mod_revision.ensure_null(tree.last_revision()))
21 note('Updated to revision %s of branch %s' %
22 ('.'.join(map(str, revno)), branch_location))
23- if tree.get_parent_ids()[1:] != existing_pending_merges:
24+ parent_ids = tree.get_parent_ids()
25+ if parent_ids[1:] and parent_ids[1:] != existing_pending_merges:
26 note('Your local commits will now show as pending merges with '
27 "'bzr status', and can be committed with 'bzr commit'.")
28 if conflicts != 0:
29
30=== modified file 'bzrlib/tests/blackbox/test_update.py'
31--- bzrlib/tests/blackbox/test_update.py 2010-03-31 18:11:51 +0000
32+++ bzrlib/tests/blackbox/test_update.py 2010-04-14 04:51:18 +0000
33@@ -241,6 +241,47 @@
34 tree.commit('empty commit')
35 self.run_bzr('update checkout')
36
37+ def test_update_with_merge_merged_to_master(self):
38+ # Test that 'bzr update' works correctly when you have
39+ # an update in the master tree, and a [lightweight or otherwise]
40+ # checkout which has merge a revision merged to master already.
41+ master = self.make_branch_and_tree('master')
42+ self.build_tree(['master/file'])
43+ master.add(['file'])
44+ master.commit('one', rev_id='m1')
45+
46+ self.build_tree(['checkout1/'])
47+ checkout_dir = bzrdir.BzrDirMetaFormat1().initialize('checkout1')
48+ branch.BranchReferenceFormat().initialize(checkout_dir,
49+ target_branch=master.branch)
50+ checkout1 = checkout_dir.create_workingtree('m1')
51+
52+ # Create a second branch, with an extra commit
53+ other = master.bzrdir.sprout('other').open_workingtree()
54+ self.build_tree(['other/file2'])
55+ other.add(['file2'])
56+ other.commit('other2', rev_id='o2')
57+
58+ # Merge the other branch into checkout - 'start reviewing a patch'
59+ checkout1.merge_from_branch(other.branch)
60+ self.assertEqual(['o2'], checkout1.get_parent_ids()[1:])
61+
62+ # Create a new commit in the master branch - 'someone else lands its'
63+ master.merge_from_branch(other.branch)
64+ master.commit('f3', rev_id='m2')
65+
66+ # This should not report about local commits being pending
67+ # merges, because they were real merges (but are now gone).
68+ # It should perhaps report on them.
69+ out, err = self.run_bzr('update', working_dir='checkout1')
70+ self.assertEqual('', out)
71+ self.assertEqualDiff('''All changes applied successfully.
72+Updated to revision 2 of branch %s
73+''' % osutils.pathjoin(self.test_dir, 'master',),
74+ err)
75+ # The pending merges should still be there
76+ self.assertEqual([], checkout1.get_parent_ids()[1:])
77+
78 def test_update_dash_r(self):
79 master = self.make_branch_and_tree('master')
80 os.chdir('master')