Rev 5614: (jelmer) Fix 'bzr push --overwrite -rREV' for old mainline revisions. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Sat Jan 15 07:42:19 UTC 2011


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

------------------------------------------------------------
revno: 5614 [merge]
revision-id: pqm at pqm.ubuntu.com-20110115074217-fefylwf2f7wf9vz5
parent: pqm at pqm.ubuntu.com-20110114234114-r4hdusue691ekeg6
parent: jelmer at samba.org-20110115070545-pjtpj34tjios0vhk
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sat 2011-01-15 07:42:17 +0000
message:
  (jelmer) Fix 'bzr push --overwrite -rREV' for old mainline revisions.
   (Jelmer Vernooij)
modified:
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/tests/per_branch/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
  doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2011-01-12 01:01:53 +0000
+++ b/bzrlib/branch.py	2011-01-14 20:52:48 +0000
@@ -2664,7 +2664,7 @@
         result.target_branch = target
         result.old_revno, result.old_revid = target.last_revision_info()
         self.update_references(target)
-        if result.old_revid != self.last_revision():
+        if result.old_revid != stop_revision:
             # We assume that during 'push' this repository is closer than
             # the target.
             graph = self.repository.get_graph(target.repository)

=== modified file 'bzrlib/tests/per_branch/test_push.py'
--- a/bzrlib/tests/per_branch/test_push.py	2011-01-13 01:02:53 +0000
+++ b/bzrlib/tests/per_branch/test_push.py	2011-01-14 20:52:48 +0000
@@ -170,6 +170,21 @@
         self.assertEqual(tree.branch.last_revision(),
                          to_branch.last_revision())
 
+    def test_push_overwrite_with_older_mainline_rev(self):
+        """Pushing an older mainline revision with overwrite.
+
+        This was <https://bugs.launchpad.net/bzr/+bug/386576>.
+        """
+        source = self.make_branch_and_tree('source')
+        target = self.make_branch('target')
+
+        source.commit('1st commit')
+        source.commit('2nd commit', rev_id='rev-2')
+        source.commit('3rd commit')
+        source.branch.push(target)
+        source.branch.push(target, stop_revision='rev-2', overwrite=True)
+        self.assertEqual('rev-2', target.last_revision())
+
     def test_push_overwrite_of_non_tip_with_stop_revision(self):
         """Combining the stop_revision and overwrite options works.
 

=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt	2011-01-14 21:24:14 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-01-15 07:05:45 +0000
@@ -32,6 +32,9 @@
 .. Fixes for situations where bzr would previously crash or give incorrect
    or undesirable results.
 
+* ``bzr push --overwrite`` with an older revision specified will now correctly
+  roll back the target branch. (Jelmer Vernooij, #386576)
+
 * ``bzr serve`` no longer crashes when a server_started hook is installed and IPv6
   support is available on the system. (Jelmer Vernooij, #293697)
 




More information about the bazaar-commits mailing list