Merge lp:~gz/bzr/484516-push-revspec-tree into lp:bzr

Proposed by Martin Packman
Status: Merged
Approved by: Martin Packman
Approved revision: no longer in the source branch.
Merged at revision: 6545
Proposed branch: lp:~gz/bzr/484516-push-revspec-tree
Merge into: lp:bzr
Diff against target: 80 lines (+36/-2)
3 files modified
bzrlib/tests/blackbox/test_push.py (+27/-0)
bzrlib/workingtree.py (+6/-1)
doc/en/release-notes/bzr-2.6.txt (+3/-1)
To merge this branch: bzr merge lp:~gz/bzr/484516-push-revspec-tree
Reviewer Review Type Date Requested Status
bzr-core Pending
Review via email: mp+117158@code.launchpad.net

Commit message

Create working tree at specified revision when doing a local push

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) 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/tests/blackbox/test_push.py'
2--- bzrlib/tests/blackbox/test_push.py 2012-04-16 11:08:11 +0000
3+++ bzrlib/tests/blackbox/test_push.py 2012-07-28 14:54:21 +0000
4@@ -452,6 +452,8 @@
5 self.assertTrue(repo_to.has_revision('from-1'))
6 self.assertFalse(repo_to.has_revision('from-2'))
7 self.assertEqual(tree_to.branch.last_revision_info()[1], 'from-1')
8+ self.assertFalse(
9+ tree_to.changes_from(tree_to.basis_tree()).has_changed())
10
11 self.run_bzr_error(
12 ['bzr: ERROR: bzr push --revision '
13@@ -917,3 +919,28 @@
14 2>All changes applied successfully.
15 2>Pushed up to revision 1.
16 """)
17+
18+ def test_push_with_revspec(self):
19+ self.run_script("""
20+ $ bzr init-repo .
21+ Shared repository with trees (format: 2a)
22+ Location:
23+ shared repository: .
24+ $ bzr init trunk
25+ Created a repository tree (format: 2a)
26+ Using shared repository...
27+ $ cd trunk
28+ $ bzr commit -m 'first rev' --unchanged
29+ 2>Committing to:...trunk/
30+ 2>Committed revision 1.
31+ $ echo foo > file
32+ $ bzr add
33+ adding file
34+ $ bzr commit -m 'we need some foo'
35+ 2>Committing to:...trunk/
36+ 2>added file
37+ 2>Committed revision 2.
38+ $ bzr push -r 1 ../other
39+ 2>Created new branch.
40+ $ bzr st ../other # checking that file is not created (#484516)
41+ """)
42
43=== modified file 'bzrlib/workingtree.py'
44--- bzrlib/workingtree.py 2012-07-18 20:06:21 +0000
45+++ bzrlib/workingtree.py 2012-07-28 14:54:21 +0000
46@@ -535,7 +535,12 @@
47 else:
48 # TODO now merge from tree.last_revision to revision (to preserve
49 # user local changes)
50- merge.transform_tree(tree, self)
51+ try:
52+ other_tree = self.revision_tree(revision_id)
53+ except errors.NoSuchRevision:
54+ other_tree = self.branch.repository.revision_tree(revision_id)
55+
56+ merge.transform_tree(tree, other_tree)
57 if revision_id == _mod_revision.NULL_REVISION:
58 new_parents = []
59 else:
60
61=== modified file 'doc/en/release-notes/bzr-2.6.txt'
62--- doc/en/release-notes/bzr-2.6.txt 2012-07-25 10:11:07 +0000
63+++ doc/en/release-notes/bzr-2.6.txt 2012-07-28 14:54:21 +0000
64@@ -39,6 +39,9 @@
65 * When a missing referenced chk root error is encountered, bzr now suggests
66 running ``bzr reconcile --canonicalize-chks``. (Jelmer Vernooij, #1021537)
67
68+* When pushing a specific revision, create the new working tree at
69+ that revision. (#484516, Neil Martinsen-Burrell)
70+
71 Documentation
72 *************
73
74@@ -113,7 +116,6 @@
75 * Option values set on locked branches should be saved only when the branch
76 is finally unlocked. (Vincent Ladeuil, #948339)
77
78-
79 Documentation
80 *************
81