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
1=== modified file 'bzrlib/branch.py'
2--- bzrlib/branch.py 2011-01-12 01:01:53 +0000
3+++ bzrlib/branch.py 2011-01-15 07:08:49 +0000
4@@ -2664,7 +2664,7 @@
5 result.target_branch = target
6 result.old_revno, result.old_revid = target.last_revision_info()
7 self.update_references(target)
8- if result.old_revid != self.last_revision():
9+ if result.old_revid != stop_revision:
10 # We assume that during 'push' this repository is closer than
11 # the target.
12 graph = self.repository.get_graph(target.repository)
13
14=== modified file 'bzrlib/tests/per_branch/test_push.py'
15--- bzrlib/tests/per_branch/test_push.py 2011-01-13 01:02:53 +0000
16+++ bzrlib/tests/per_branch/test_push.py 2011-01-15 07:08:49 +0000
17@@ -170,6 +170,21 @@
18 self.assertEqual(tree.branch.last_revision(),
19 to_branch.last_revision())
20
21+ def test_push_overwrite_with_older_mainline_rev(self):
22+ """Pushing an older mainline revision with overwrite.
23+
24+ This was <https://bugs.launchpad.net/bzr/+bug/386576>.
25+ """
26+ source = self.make_branch_and_tree('source')
27+ target = self.make_branch('target')
28+
29+ source.commit('1st commit')
30+ source.commit('2nd commit', rev_id='rev-2')
31+ source.commit('3rd commit')
32+ source.branch.push(target)
33+ source.branch.push(target, stop_revision='rev-2', overwrite=True)
34+ self.assertEqual('rev-2', target.last_revision())
35+
36 def test_push_overwrite_of_non_tip_with_stop_revision(self):
37 """Combining the stop_revision and overwrite options works.
38
39
40=== modified file 'doc/en/release-notes/bzr-2.4.txt'
41--- doc/en/release-notes/bzr-2.4.txt 2011-01-14 21:24:14 +0000
42+++ doc/en/release-notes/bzr-2.4.txt 2011-01-15 07:08:49 +0000
43@@ -32,6 +32,9 @@
44 .. Fixes for situations where bzr would previously crash or give incorrect
45 or undesirable results.
46
47+* ``bzr push --overwrite`` with an older revision specified will now correctly
48+ roll back the target branch. (Jelmer Vernooij, #386576)
49+
50 * ``bzr serve`` no longer crashes when a server_started hook is installed and IPv6
51 support is available on the system. (Jelmer Vernooij, #293697)
52