Rev 5153: (robertc) Do not warn when updating if a pending merge was merged into in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Apr 14 08:26:46 BST 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5153 [merge]
revision-id: pqm at pqm.ubuntu.com-20100414072643-kxva2lpej0ck8m4d
parent: pqm at pqm.ubuntu.com-20100414043547-j4t4napw7duy07if
parent: robertc at robertcollins.net-20100414044800-wda5phry84h497pn
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2010-04-14 08:26:43 +0100
message:
  (robertc) Do not warn when updating if a pending merge was merged into
   trunk. (Robert Collins, bug 562079)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_update.py test_update.py-20060212125639-c4dad1a5c56d5919
=== modified file 'NEWS'
--- a/NEWS	2010-04-14 04:35:47 +0000
+++ b/NEWS	2010-04-14 07:26:43 +0000
@@ -28,6 +28,10 @@
   True explicitly to get the previous behaviour.  
   (Vincent Ladeuil, #519319)
 
+* ``bzr update`` when a pending merge in the working tree has been merged
+  into the master branch will no longer claim that old commits have become
+  pending merges. (Robert Collins, #562079)
+
 * ``bzrlib.mutabletree.MutableTree.commit`` will now support a passed in
   config as in previous versions of bzrlib. (Robert Collins)
 

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2010-04-14 04:35:47 +0000
+++ b/bzrlib/builtins.py	2010-04-14 07:26:43 +0000
@@ -1462,7 +1462,8 @@
             _mod_revision.ensure_null(tree.last_revision()))
         note('Updated to revision %s of branch %s' %
              ('.'.join(map(str, revno)), branch_location))
-        if tree.get_parent_ids()[1:] != existing_pending_merges:
+        parent_ids = tree.get_parent_ids()
+        if parent_ids[1:] and parent_ids[1:] != existing_pending_merges:
             note('Your local commits will now show as pending merges with '
                  "'bzr status', and can be committed with 'bzr commit'.")
         if conflicts != 0:

=== modified file 'bzrlib/tests/blackbox/test_update.py'
--- a/bzrlib/tests/blackbox/test_update.py	2010-03-31 18:11:51 +0000
+++ b/bzrlib/tests/blackbox/test_update.py	2010-04-14 04:48:00 +0000
@@ -241,6 +241,47 @@
         tree.commit('empty commit')
         self.run_bzr('update checkout')
 
+    def test_update_with_merge_merged_to_master(self):
+        # Test that 'bzr update' works correctly when you have
+        # an update in the master tree, and a [lightweight or otherwise]
+        # checkout which has merge a revision merged to master already.
+        master = self.make_branch_and_tree('master')
+        self.build_tree(['master/file'])
+        master.add(['file'])
+        master.commit('one', rev_id='m1')
+
+        self.build_tree(['checkout1/'])
+        checkout_dir = bzrdir.BzrDirMetaFormat1().initialize('checkout1')
+        branch.BranchReferenceFormat().initialize(checkout_dir,
+            target_branch=master.branch)
+        checkout1 = checkout_dir.create_workingtree('m1')
+
+        # Create a second branch, with an extra commit
+        other = master.bzrdir.sprout('other').open_workingtree()
+        self.build_tree(['other/file2'])
+        other.add(['file2'])
+        other.commit('other2', rev_id='o2')
+
+        # Merge the other branch into checkout -  'start reviewing a patch'
+        checkout1.merge_from_branch(other.branch)
+        self.assertEqual(['o2'], checkout1.get_parent_ids()[1:])
+
+        # Create a new commit in the master branch - 'someone else lands its'
+        master.merge_from_branch(other.branch)
+        master.commit('f3', rev_id='m2')
+
+        # This should not report about local commits being pending
+        # merges, because they were real merges (but are now gone).
+        # It should perhaps report on them.
+        out, err = self.run_bzr('update', working_dir='checkout1')
+        self.assertEqual('', out)
+        self.assertEqualDiff('''All changes applied successfully.
+Updated to revision 2 of branch %s
+''' % osutils.pathjoin(self.test_dir, 'master',),
+                         err)
+        # The pending merges should still be there
+        self.assertEqual([], checkout1.get_parent_ids()[1:])
+
     def test_update_dash_r(self):
         master = self.make_branch_and_tree('master')
         os.chdir('master')




More information about the bazaar-commits mailing list