Merge lp:~jelmer/bzr/push-overwrite-old-rev into lp:bzr

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 5614
Proposed branch: lp:~jelmer/bzr/push-overwrite-old-rev
Merge into: lp:bzr
Diff against target: 51 lines (+19/-1)
3 files modified
bzrlib/branch.py (+1/-1)
bzrlib/tests/per_branch/test_push.py (+15/-0)
doc/en/release-notes/bzr-2.4.txt (+3/-0)
To merge this branch: bzr merge lp:~jelmer/bzr/push-overwrite-old-rev
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+46337@code.launchpad.net

Commit message

Fix 'bzr push --overwrite -rREV' for old mainline revisions.

Description of the change

Fix "bzr push --overwrite -rREV" where REV is an older mainline revision now works again.

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

Thanks for resurrecting this one !

review: Approve
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

sent to pqm by email

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

sent to pqm by email

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/branch.py'
--- bzrlib/branch.py 2011-01-12 01:01:53 +0000
+++ bzrlib/branch.py 2011-01-15 07:08:49 +0000
@@ -2664,7 +2664,7 @@
2664 result.target_branch = target2664 result.target_branch = target
2665 result.old_revno, result.old_revid = target.last_revision_info()2665 result.old_revno, result.old_revid = target.last_revision_info()
2666 self.update_references(target)2666 self.update_references(target)
2667 if result.old_revid != self.last_revision():2667 if result.old_revid != stop_revision:
2668 # We assume that during 'push' this repository is closer than2668 # We assume that during 'push' this repository is closer than
2669 # the target.2669 # the target.
2670 graph = self.repository.get_graph(target.repository)2670 graph = self.repository.get_graph(target.repository)
26712671
=== modified file 'bzrlib/tests/per_branch/test_push.py'
--- bzrlib/tests/per_branch/test_push.py 2011-01-13 01:02:53 +0000
+++ bzrlib/tests/per_branch/test_push.py 2011-01-15 07:08:49 +0000
@@ -170,6 +170,21 @@
170 self.assertEqual(tree.branch.last_revision(),170 self.assertEqual(tree.branch.last_revision(),
171 to_branch.last_revision())171 to_branch.last_revision())
172172
173 def test_push_overwrite_with_older_mainline_rev(self):
174 """Pushing an older mainline revision with overwrite.
175
176 This was <https://bugs.launchpad.net/bzr/+bug/386576>.
177 """
178 source = self.make_branch_and_tree('source')
179 target = self.make_branch('target')
180
181 source.commit('1st commit')
182 source.commit('2nd commit', rev_id='rev-2')
183 source.commit('3rd commit')
184 source.branch.push(target)
185 source.branch.push(target, stop_revision='rev-2', overwrite=True)
186 self.assertEqual('rev-2', target.last_revision())
187
173 def test_push_overwrite_of_non_tip_with_stop_revision(self):188 def test_push_overwrite_of_non_tip_with_stop_revision(self):
174 """Combining the stop_revision and overwrite options works.189 """Combining the stop_revision and overwrite options works.
175190
176191
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- doc/en/release-notes/bzr-2.4.txt 2011-01-14 21:24:14 +0000
+++ doc/en/release-notes/bzr-2.4.txt 2011-01-15 07:08:49 +0000
@@ -32,6 +32,9 @@
32.. Fixes for situations where bzr would previously crash or give incorrect32.. Fixes for situations where bzr would previously crash or give incorrect
33 or undesirable results.33 or undesirable results.
3434
35* ``bzr push --overwrite`` with an older revision specified will now correctly
36 roll back the target branch. (Jelmer Vernooij, #386576)
37
35* ``bzr serve`` no longer crashes when a server_started hook is installed and IPv638* ``bzr serve`` no longer crashes when a server_started hook is installed and IPv6
36 support is available on the system. (Jelmer Vernooij, #293697)39 support is available on the system. (Jelmer Vernooij, #293697)
3740