Rev 5641: (jameinel) Bug #760152, in file:///home/pqm/archives/thelove/bzr/2.3/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Apr 20 12:54:23 UTC 2011


At file:///home/pqm/archives/thelove/bzr/2.3/

------------------------------------------------------------
revno: 5641 [merge]
revision-id: pqm at pqm.ubuntu.com-20110420125422-wrx3wdv6b9t4s6l6
parent: pqm at pqm.ubuntu.com-20110416002029-nbeg4p8wwlh4wtkj
parent: john at arbash-meinel.com-20110420094854-13j3nmstmeaq3iko
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.3
timestamp: Wed 2011-04-20 12:54:22 +0000
message:
  (jameinel) Bug #760152,
   'bzr merge --preview --pull' should not change the last-revision (be
   equivalent to "bzr merge --preview") (John A Meinel)
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
  doc/en/release-notes/bzr-2.3.txt NEWS-20050323055033-4e00b5db738777ff
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2011-01-12 01:01:53 +0000
+++ b/bzrlib/builtins.py	2011-04-20 09:46:28 +0000
@@ -3948,7 +3948,7 @@
             merger.other_rev_id is not None):
             note('Nothing to do.')
             return 0
-        if pull:
+        if pull and not preview:
             if merger.interesting_files is not None:
                 raise errors.BzrCommandError('Cannot pull individual files')
             if (merger.base_rev_id == tree.last_revision()):

=== modified file 'bzrlib/tests/blackbox/test_merge.py'
--- a/bzrlib/tests/blackbox/test_merge.py	2010-12-02 10:41:05 +0000
+++ b/bzrlib/tests/blackbox/test_merge.py	2011-04-20 09:46:28 +0000
@@ -19,8 +19,11 @@
 """Black-box tests for bzr merge.
 """
 
+import doctest
 import os
 
+from testtools import matchers
+
 from bzrlib import (
     branch,
     branchbuilder,
@@ -352,13 +355,13 @@
 
     def pullable_branch(self):
         tree_a = self.make_branch_and_tree('a')
-        self.build_tree(['a/file'])
+        self.build_tree_contents([('a/file', 'bar\n')])
         tree_a.add(['file'])
         self.id1 = tree_a.commit('commit 1')
 
         tree_b = self.make_branch_and_tree('b')
         tree_b.pull(tree_a.branch)
-        file('b/file', 'wb').write('foo')
+        self.build_tree_contents([('b/file', 'foo\n')])
         self.id2 = tree_b.commit('commit 2')
 
     def test_merge_pull(self):
@@ -369,6 +372,21 @@
         tree_a = workingtree.WorkingTree.open('.')
         self.assertEqual([self.id2], tree_a.get_parent_ids())
 
+    def test_merge_pull_preview(self):
+        self.pullable_branch()
+        (out, err) = self.run_bzr('merge --pull --preview -d a b')
+        self.assertThat(out, matchers.DocTestMatches(
+"""=== modified file 'file'
+--- file\t...
++++ file\t...
+@@ -1,1 +1,1 @@
+-bar
++foo
+
+""", doctest.ELLIPSIS | doctest.REPORT_UDIFF))
+        tree_a = workingtree.WorkingTree.open('a')
+        self.assertEqual([self.id1], tree_a.get_parent_ids())
+
     def test_merge_kind_change(self):
         tree_a = self.make_branch_and_tree('tree_a')
         self.build_tree_contents([('tree_a/file', 'content_1')])

=== modified file 'doc/en/release-notes/bzr-2.3.txt'
--- a/doc/en/release-notes/bzr-2.3.txt	2011-04-08 08:03:30 +0000
+++ b/doc/en/release-notes/bzr-2.3.txt	2011-04-20 09:48:54 +0000
@@ -49,6 +49,10 @@
    plugins because it's often too long.
    (Martin Pool, #716389)
 
+* ``bzr merge --preview --pull`` should respect the ``--preview`` option
+  first, and not actually change the branch tip revision.
+  (John Arbash Meinel, Dennis Duchier, #760152)
+
 * ``bzr push`` into a repository (that doesn't have a branch), will no
   longer copy all revisions in the repository. Only the ones in the
   ancestry of the source branch, like it does in all other cases.




More information about the bazaar-commits mailing list