Merge lp:~oddbloke/bzr/183559-switch-r into lp:bzr
- 183559-switch-r
- Merge into bzr.dev
Status: | Rejected | ||||
---|---|---|---|---|---|
Rejected by: | Andrew Bennetts | ||||
Proposed branch: | lp:~oddbloke/bzr/183559-switch-r | ||||
Merge into: | lp:bzr | ||||
Diff against target: |
434 lines (+309/-1) 5 files modified
NEWS (+200/-0) bzrlib/builtins.py (+35/-1) bzrlib/switch.py (+25/-0) bzrlib/tests/blackbox/test_switch.py (+32/-0) bzrlib/tests/test_switch.py (+17/-0) |
||||
To merge this branch: | bzr merge lp:~oddbloke/bzr/183559-switch-r | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrew Bennetts | Disapprove | ||
John A Meinel | Needs Fixing | ||
Review via email: mp+16827@code.launchpad.net |
Commit message
Description of the change
Martin Pool (mbp) wrote : | # |
John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Pool wrote:
> Martin Pool has proposed merging lp:~daniel-thewatkins/bzr/183559-switch-r into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
> Related bugs:
> #183559 bzr switch should have a -r option
> https:/
>
>
> Fix for https:/
>
> I haven't read it yet but it would be good for someone to review it and if necessary pick it up.
>
1) Lots of conflicts. Looks like it was done back in 1.12 or so. A lot
of stuff doesn't line up. Probably mostly shallow
2)
=== modified file 'bzrlib/
- --- bzrlib/builtins.py 2009-12-23 05:42:33 +0000
+++ bzrlib/builtins.py 2010-01-05 03:39:25 +0000
@@ -5493,22 +5493,42 @@
that of the master.
"""
- - takes_args = ['to_location']
+ takes_args = ['to_location?']
takes_options = [Option('force',
+<<<<<<< TREE
before'
+=======
+ help='Switch even if local commits will be lost.'),
+ 'revision'
+>>>>>>> MERGE-SOURCE
^- This looks like he made it so "bzr switch -r XXX" changes the local
tree to a different rev. Which sounds like overlap with the new "bzr
update -r" functionality.
I would probably pick one and stick with it, rather than having 2 ways
to do it.
TBH switch comes to mind faster than update, though I think update fits
SVN usage better.
The rest of the code just passing down a revision_id to switch, and
having it use that RevisionTree rather than just the
to_branch.
review: needs_fixing
I'm not setting this to WIP yet, as maybe the patch-pilot wants to pick
it up?
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAkt
9lQAn0Rxvuw4TIs
=po4T
-----END PGP SIGNATURE-----
Andrew Bennetts (spiv) wrote : | # |
Sure, I'll pick it up.
Andrew Bennetts (spiv) wrote : | # |
Daniel, I just noticed you haven't signed the Canonical's contributor's agreement... would you mind doing so? <http://
I've put an updated version of this up for review at <https:/
(Marking "Disapprove/
Updating diff...
An updated diff will be available in a few minutes. Reload to see the changes.
Preview Diff
1 | === modified file 'NEWS' |
2 | --- NEWS 2010-01-04 05:40:01 +0000 |
3 | +++ NEWS 2010-01-05 03:39:25 +0000 |
4 | @@ -1,5 +1,6 @@ |
5 | #################### |
6 | Bazaar Release Notes |
7 | +<<<<<<< TREE |
8 | #################### |
9 | |
10 | .. contents:: List of Releases |
11 | @@ -3360,6 +3361,205 @@ |
12 | |
13 | :Codename: "Eyes up!" |
14 | :Released: 2009-01-19 |
15 | +======= |
16 | +-------------------- |
17 | + |
18 | +.. contents:: |
19 | + |
20 | +IN DEVELOPMENT |
21 | +-------------- |
22 | + |
23 | + COMPATIBILITY BREAKS: |
24 | + |
25 | + * By default, ``bzr status`` after a merge now shows just the pending |
26 | + merge tip revisions. This improves the signal-to-noise ratio after |
27 | + merging from trunk and completes much faster. To see all merged |
28 | + revisions, use the new ``-v`` flag. (Ian Clatworthy) |
29 | + |
30 | + * ``bzr log --line`` now shows any tags after the date and before |
31 | + the commit message. If you have scripts which parse the output |
32 | + from this command, you may need to adjust them accordingly. |
33 | + (Ian Clatworthy) |
34 | + |
35 | + * ``bzr log --short`` now shows any additional revision properties |
36 | + after the date and before the commit message. Scripts that parse |
37 | + output of the log command in this situation may need to adjust. |
38 | + (Neil Martinsen-Burrell) |
39 | + |
40 | + * The experimental formats ``1.12-preview`` and ``1.12-preview-rich-root`` |
41 | + have been renamed ``development-wt5`` and ``development-wt5-rich-root`` |
42 | + respectively, given they are not ready for release in 1.12. |
43 | + (Ian Clatworthy) |
44 | + |
45 | + NEW FEATURES: |
46 | + |
47 | + * Add support for filtering `bzr missing` on revisions. Remote revisions |
48 | + can be filtered using `bzr missing -r -20..-10` and local revisions can |
49 | + be filtered using `bzr missing --my-revision -20..-10`. |
50 | + (Marius Kruger) |
51 | + |
52 | + * ``bzr log -p`` displays the patch diff for each revision. |
53 | + When logging a file, the diff only includes changes to that file. |
54 | + (Ian Clatworthy, #202331, #227335) |
55 | + |
56 | + * ``bzr log`` supports a new option called ``-n N`` or ``--level N``. |
57 | + A value of 0 (zero) means "show all nested merge revisions" while |
58 | + a value of 1 (one) means "show just the top level". Values above |
59 | + 1 can be used to see a limited amount of nesting. That can be |
60 | + useful for seeing the level or two below PQM submits for example. |
61 | + To force the ``--short`` and ``--line`` formats to display all nested |
62 | + merge revisions just like ``--long`` does by default, use a command |
63 | + like ``bzr log --short -n0``. To display just the mainline using |
64 | + ``--long`` format, ``bzr log --long -n1``. |
65 | + (Ian Clatworthy) |
66 | + |
67 | + IMPROVEMENTS: |
68 | + |
69 | + * ``bzr add`` more clearly communicates success vs failure. |
70 | + (Daniel Watkins) |
71 | + |
72 | + * ``bzr init`` will now print a little less verbose output. |
73 | + (Marius Kruger) |
74 | + |
75 | + * ``bzr log`` is now much faster in many use cases, particularly |
76 | + at incrementally displaying results and filtering by a |
77 | + revision range. (Ian Clatworthy) |
78 | + |
79 | + * ``bzr log --short`` and ``bzr log --line`` now show tags, if any, |
80 | + for each revision. The tags are shown comma-separated inside |
81 | + ``{}``. For short format, the tags appear at the end of line |
82 | + before the optional ``[merge]`` indicator. For line format, |
83 | + the tags appear after the date. (Ian Clatworthy) |
84 | + |
85 | + * ``bzr switch`` now takes a ``--revision`` option, to allow switching to a |
86 | + specific revision of a branch. (Daniel Watkins, #183559) |
87 | + |
88 | + * Progress bars now show the rate of activity for some sftp |
89 | + operations, and they are drawn different. (Martin Pool, #172741) |
90 | + |
91 | + * Progress bars now show the rate of activity for urllib and pycurl based |
92 | + http client implementations. The operations are tracked at the socket |
93 | + level for better precision. |
94 | + (Vincent Ladeuil) |
95 | + |
96 | + * Rule-based preferences can now accept multiple patterns for a set of |
97 | + rules. (Marius Kruger) |
98 | + |
99 | + * The ``ancestor:`` revision spec will now default to referring to the |
100 | + parent of the branch if no other location is given. |
101 | + (Daniel Watkins, #198417) |
102 | + |
103 | + * The debugger started as a result of setting ``$BZR_PDB`` works |
104 | + around a bug in ``pdb``, http://bugs.python.org/issue4150. The bug |
105 | + can cause truncated tracebacks in Python versions before 2.6. |
106 | + (Andrew Bennetts) |
107 | + |
108 | + * VirtualVersionedFiles now implements |
109 | + ``iter_lines_added_or_present_in_keys``. This allows the creation of |
110 | + new branches based on stacked bzr-svn branches. (#311997) |
111 | + |
112 | + BUG FIXES: |
113 | + |
114 | + * ``bzr annotate --show-ids`` doesn't give a backtrace on empty files |
115 | + anymore. |
116 | + (Anne Mohsen, Vincent Ladeuil, #314525) |
117 | + |
118 | + * ``bzr log FILE`` now correctly shows mainline revisions merging |
119 | + a change to FILE when the ``--short`` and ``--line`` log formats |
120 | + are used. (Ian Clatworthy, #317417) |
121 | + |
122 | + * ``bzr log -rX..Y FILE`` now shows the history of FILE provided |
123 | + it existed in Y or X, even if the file has since been deleted or |
124 | + renamed. If no range is given, the current/basis tree and |
125 | + initial tree are searched in that order. More generally, log |
126 | + now interprets filenames in their historical context. |
127 | + (Ian Clatworthy, #175520) |
128 | + |
129 | + * ``bzr status`` now reports nonexistent files and continues, then |
130 | + errors (with code 3) at the end. (Karl Fogel, #306394) |
131 | + |
132 | + * Don't require the present compression base in knits to be the same |
133 | + when adding records in knits. (Jelmer Vernooij, #307394) |
134 | + |
135 | + * Fix a problem with CIFS client/server lag on Windows colliding with |
136 | + an invariant-per-process algorithm for generating AtomicFile names |
137 | + (Adrian Wilkins, #304023) |
138 | + |
139 | + * Many socket operations now handle EINTR by retrying the operation. |
140 | + Previously EINTR was treated as an unrecoverable failure. There is |
141 | + a new ``until_no_eintr`` helper function in ``bzrlib.osutils``. |
142 | + (Andrew Bennetts) |
143 | + |
144 | + * Support symlinks with non-ascii characters in the symlink filename. |
145 | + (Jelmer Vernooij, #319323) |
146 | + |
147 | + * There was a bug in how we handled resolving when a file is deleted |
148 | + in one branch, and modified in the other. If there was a criss-cross |
149 | + merge, we would cause the deletion to conflict a second time. |
150 | + (Vincent Ladeuil, John Arbash Meinel) |
151 | + |
152 | + * There was another bug in how we chose the correct intermediate LCA in |
153 | + criss-cross merges leading to several kind of changes be incorrectly |
154 | + handled. |
155 | + (John Arbash Meinel, Vincent Ladeuil) |
156 | + |
157 | + * Unshelve now handles deleted paths without crashing. (Robert Collins) |
158 | + |
159 | + DOCUMENTATION: |
160 | + |
161 | + * Improved plugin developer documentation. (Martin Pool) |
162 | + |
163 | + API CHANGES: |
164 | + |
165 | + * ``ProgressBarStack`` is deprecated; instead use |
166 | + ``ui_factory.nested_progress_bar`` to create new progress bars. |
167 | + |
168 | + * ForeignVcsMapping() now requires a ForeignVcs object as first |
169 | + argument. (Jelmer Vernooij) |
170 | + |
171 | + * ForeignVcsMapping.show_foreign_revid() has been moved to |
172 | + ForeignVcs. (Jelmer Vernooij) |
173 | + |
174 | + * Revision specifiers are now registered in |
175 | + ``bzrlib.revisionspec.revspec_registry``, and the old list of |
176 | + revisionspec classes (``bzrlib.revisionspec.SPEC_TYPES``) has been |
177 | + deprecated. (Jelmer Vernooij, #321183) |
178 | + |
179 | + * The progress and UI classes have changed; the main APIs remain the |
180 | + same but code that provides a new UI or progress bar class may |
181 | + need to be updated. (Martin Pool) |
182 | + |
183 | + TESTING: |
184 | + |
185 | + INTERNALS: |
186 | + |
187 | + * Default User Interface (UI) is CLIUIFactory when bzr runs in a dumb |
188 | + terminal. It is sometimes desirable do override this default by forcing |
189 | + bzr to use TextUIFactory. This can be achieved by setting the |
190 | + BZR_USE_TEXT_UI environment variable (emacs shells, as opposed to |
191 | + compile buffers, are such an example). |
192 | + (Vincent Ladeuil) |
193 | + |
194 | + * New API ``Branch.iter_merge_sorted_revisions()`` that iterates over |
195 | + ``(revision_id, depth, revno, end_of_merge)`` tuples. |
196 | + (Ian Clatworthy) |
197 | + |
198 | + * New ``Branch.dotted_revno_to_revision_id()`` and |
199 | + ``Branch.revision_id_to_dotted_revno()`` APIs that pick the most |
200 | + efficient way of doing the mapping. |
201 | + (Ian Clatworthy) |
202 | + |
203 | + * Refactor cmd_serve so that it's a little easier to build commands that |
204 | + extend it, and perhaps even a bit easier to read. (Jonathan Lange) |
205 | + |
206 | + * ``TreeDelta.show()`` now accepts a ``filter`` parameter allowing log |
207 | + formatters to retrict the output. |
208 | + (Vincent Ladeuil) |
209 | + |
210 | + |
211 | +bzr 1.11 "Eyes up!" 2009-01-19 |
212 | +------------------------------ |
213 | +>>>>>>> MERGE-SOURCE |
214 | |
215 | This first monthly release of Bazaar for 2009 improves Bazaar's operation |
216 | in Windows, Mac OS X, and other situations where file names are matched |
217 | |
218 | === modified file 'bzrlib/builtins.py' |
219 | --- bzrlib/builtins.py 2009-12-23 05:42:33 +0000 |
220 | +++ bzrlib/builtins.py 2010-01-05 03:39:25 +0000 |
221 | @@ -5493,22 +5493,42 @@ |
222 | that of the master. |
223 | """ |
224 | |
225 | - takes_args = ['to_location'] |
226 | + takes_args = ['to_location?'] |
227 | takes_options = [Option('force', |
228 | +<<<<<<< TREE |
229 | help='Switch even if local commits will be lost.'), |
230 | Option('create-branch', short_name='b', |
231 | help='Create the target branch from this one before' |
232 | ' switching to it.'), |
233 | +======= |
234 | + help='Switch even if local commits will be lost.'), |
235 | + 'revision' |
236 | +>>>>>>> MERGE-SOURCE |
237 | ] |
238 | |
239 | +<<<<<<< TREE |
240 | def run(self, to_location, force=False, create_branch=False): |
241 | +======= |
242 | + def run(self, to_location=None, force=False, revision=None): |
243 | +>>>>>>> MERGE-SOURCE |
244 | from bzrlib import switch |
245 | tree_location = '.' |
246 | + revision = _get_one_revision('switch', revision) |
247 | control_dir = bzrdir.BzrDir.open_containing(tree_location)[0] |
248 | +<<<<<<< TREE |
249 | +======= |
250 | + branch = control_dir.open_branch() |
251 | + if to_location is None: |
252 | + if revision is None: |
253 | + raise errors.BzrCommandError('You must supply either a' |
254 | + ' revision or a location') |
255 | + to_location = '.' |
256 | +>>>>>>> MERGE-SOURCE |
257 | try: |
258 | branch = control_dir.open_branch() |
259 | had_explicit_nick = branch.get_config().has_explicit_nickname() |
260 | except errors.NotBranchError: |
261 | +<<<<<<< TREE |
262 | branch = None |
263 | had_explicit_nick = False |
264 | if create_branch: |
265 | @@ -5540,6 +5560,20 @@ |
266 | urlutils.join(this_url, '..', to_location)) |
267 | switch.switch(control_dir, to_branch, force) |
268 | if had_explicit_nick: |
269 | +======= |
270 | + this_branch = control_dir.open_branch() |
271 | + # This may be a heavy checkout, where we want the master branch |
272 | + this_url = this_branch.get_bound_location() |
273 | + # If not, use a local sibling |
274 | + if this_url is None: |
275 | + this_url = this_branch.base |
276 | + to_branch = Branch.open( |
277 | + urlutils.join(this_url, '..', to_location)) |
278 | + if revision is not None: |
279 | + revision = revision.as_revision_id(to_branch) |
280 | + switch.switch(control_dir, to_branch, force, revision) |
281 | + if branch.get_config().has_explicit_nickname(): |
282 | +>>>>>>> MERGE-SOURCE |
283 | branch = control_dir.open_branch() #get the new branch! |
284 | branch.nick = to_branch.nick |
285 | note('Switched to branch: %s', |
286 | |
287 | === modified file 'bzrlib/switch.py' |
288 | --- bzrlib/switch.py 2009-06-19 21:16:31 +0000 |
289 | +++ bzrlib/switch.py 2010-01-05 03:39:25 +0000 |
290 | @@ -22,7 +22,11 @@ |
291 | from bzrlib.trace import note |
292 | |
293 | |
294 | +<<<<<<< TREE |
295 | def switch(control_dir, to_branch, force=False, quiet=False): |
296 | +======= |
297 | +def switch(control_dir, to_branch, force=False, revision_id=None): |
298 | +>>>>>>> MERGE-SOURCE |
299 | """Switch the branch associated with a checkout. |
300 | |
301 | :param control_dir: BzrDir of the checkout to change |
302 | @@ -36,7 +40,11 @@ |
303 | source_repository = to_branch.repository |
304 | _set_branch_location(control_dir, to_branch, force) |
305 | tree = control_dir.open_workingtree() |
306 | +<<<<<<< TREE |
307 | _update(tree, source_repository, quiet) |
308 | +======= |
309 | + _update(tree, source_repository, revision_id) |
310 | +>>>>>>> MERGE-SOURCE |
311 | |
312 | |
313 | def _check_pending_merges(control, force=False): |
314 | @@ -118,7 +126,11 @@ |
315 | return False |
316 | |
317 | |
318 | +<<<<<<< TREE |
319 | def _update(tree, source_repository, quiet=False): |
320 | +======= |
321 | +def _update(tree, source_repository, revision_id=None): |
322 | +>>>>>>> MERGE-SOURCE |
323 | """Update a working tree to the latest revision of its branch. |
324 | |
325 | :param tree: the working tree |
326 | @@ -127,14 +139,27 @@ |
327 | tree.lock_tree_write() |
328 | try: |
329 | to_branch = tree.branch |
330 | +<<<<<<< TREE |
331 | if tree.last_revision() == to_branch.last_revision(): |
332 | if not quiet: |
333 | note("Tree is up to date at revision %d.", to_branch.revno()) |
334 | +======= |
335 | + if revision_id is None: |
336 | + revision_id = to_branch.last_revision() |
337 | + if tree.last_revision() == revision_id: |
338 | + note("Tree is up to date at revision %d.", to_branch.revno()) |
339 | +>>>>>>> MERGE-SOURCE |
340 | return |
341 | base_tree = source_repository.revision_tree(tree.last_revision()) |
342 | +<<<<<<< TREE |
343 | merge.Merge3Merger(tree, tree, base_tree, to_branch.basis_tree()) |
344 | tree.set_last_revision(to_branch.last_revision()) |
345 | if not quiet: |
346 | note('Updated to revision %d.' % to_branch.revno()) |
347 | +======= |
348 | + merge.Merge3Merger(tree, tree, base_tree, to_branch.repository.revision_tree(revision_id)) |
349 | + tree.set_last_revision(revision_id) |
350 | + note('Updated to revision %d.' % to_branch.revno()) |
351 | +>>>>>>> MERGE-SOURCE |
352 | finally: |
353 | tree.unlock() |
354 | |
355 | === modified file 'bzrlib/tests/blackbox/test_switch.py' |
356 | --- bzrlib/tests/blackbox/test_switch.py 2009-12-11 17:04:09 +0000 |
357 | +++ bzrlib/tests/blackbox/test_switch.py 2010-01-05 03:39:25 +0000 |
358 | @@ -27,6 +27,15 @@ |
359 | |
360 | class TestSwitch(ExternalBase): |
361 | |
362 | + def _create_sample_tree(self): |
363 | + tree = self.make_branch_and_tree('branch-1') |
364 | + self.build_tree(['branch-1/file-1', 'branch-1/file-2']) |
365 | + tree.add('file-1') |
366 | + tree.commit('rev1') |
367 | + tree.add('file-2') |
368 | + tree.commit('rev2') |
369 | + return tree |
370 | + |
371 | def test_switch_up_to_date_light_checkout(self): |
372 | self.make_branch_and_tree('branch') |
373 | self.run_bzr('branch branch branch2') |
374 | @@ -134,6 +143,7 @@ |
375 | self.run_bzr(['switch', 'branchb'], working_dir='heavyco/a') |
376 | self.assertEqual(branchb_id, checkout.last_revision()) |
377 | self.assertEqual(tree2.branch.base, checkout.branch.get_bound_location()) |
378 | +<<<<<<< TREE |
379 | |
380 | def prepare_lightweight_switch(self): |
381 | branch = self.make_branch('branch') |
382 | @@ -197,3 +207,25 @@ |
383 | tree = WorkingTree.open('tree') |
384 | self.assertEndsWith(tree.branch.base, 'foo-branch2/') |
385 | |
386 | +======= |
387 | + |
388 | + def test_switch_revision(self): |
389 | + tree = self._create_sample_tree() |
390 | + checkout = tree.branch.create_checkout('checkout', lightweight=True) |
391 | + self.run_bzr(['switch', 'branch-1', '-r1'], working_dir='checkout') |
392 | + self.failUnlessExists('checkout/file-1') |
393 | + self.failIfExists('checkout/file-2') |
394 | + |
395 | + def test_switch_only_revision(self): |
396 | + tree = self._create_sample_tree() |
397 | + checkout = tree.branch.create_checkout('checkout', lightweight=True) |
398 | + self.failUnlessExists('checkout/file-1') |
399 | + self.failUnlessExists('checkout/file-2') |
400 | + self.run_bzr(['switch', '-r1'], working_dir='checkout') |
401 | + self.failUnlessExists('checkout/file-1') |
402 | + self.failIfExists('checkout/file-2') |
403 | + # Check that we don't accept a range |
404 | + self.run_bzr_error( |
405 | + ['bzr switch --revision takes exactly one revision identifier'], |
406 | + ['switch', '-r0..2'], working_dir='checkout') |
407 | +>>>>>>> MERGE-SOURCE |
408 | |
409 | === modified file 'bzrlib/tests/test_switch.py' |
410 | --- bzrlib/tests/test_switch.py 2009-05-07 05:08:46 +0000 |
411 | +++ bzrlib/tests/test_switch.py 2010-01-05 03:39:25 +0000 |
412 | @@ -100,6 +100,23 @@ |
413 | self.assertContainsRe(str(err), |
414 | "Pending merges must be committed or reverted before using switch") |
415 | |
416 | + def test_switch_with_revision(self): |
417 | + """Test switch when a revision is given.""" |
418 | + # Create a tree with 2 revisions |
419 | + tree = self.make_branch_and_tree('branch-1') |
420 | + self.build_tree(['branch-1/file-1']) |
421 | + tree.add('file-1') |
422 | + tree.commit(rev_id='rev1', message='rev1') |
423 | + self.build_tree(['branch-1/file-2']) |
424 | + tree.add('file-2') |
425 | + tree.commit(rev_id='rev2', message='rev2') |
426 | + # Check it out and switch to revision 1 |
427 | + checkout = tree.branch.create_checkout('checkout', |
428 | + lightweight=self.lightweight) |
429 | + switch.switch(checkout.bzrdir, tree.branch, revision_id="rev1") |
430 | + self.failUnlessExists('checkout/file-1') |
431 | + self.failIfExists('checkout/file-2') |
432 | + |
433 | |
434 | class TestSwitchHeavyweight(TestSwitch): |
435 |
Fix for https:/ /bugs.edge. launchpad. net/bzr/ +bug/183559 adding "switch -r".
I haven't read it yet but it would be good for someone to review it and if necessary pick it up.