Merge lp:~abentley/bzr/vpipe into lp:~bzr/bzr/trunk-old

Proposed by Aaron Bentley
Status: Merged
Approved by: Ian Clatworthy
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~abentley/bzr/vpipe
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: None lines
To merge this branch: bzr merge lp:~abentley/bzr/vpipe
Reviewer Review Type Date Requested Status
Ian Clatworthy Approve
Review via email: mp+7843@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

This patch extracts get_merger_from_uncommitted from cmd_merge, so that
bzr-pipeline can subclass cmd_merge and override it.

It also makes Shelver.__init__ take a manager parameter so that
bzr-pipeline can supply it.

With these changes, bzr-pipeline doesn't need to do any monkey patching
to provide its improvements.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpCIgMACgkQ0F+nu1YWqI1OtACfa7D5AkcJrotvDIyyj1A6nnBK
BZYAn1xpyAmCJgqaGdiCGcuMnAqfTBZG
=vw/K
-----END PGP SIGNATURE-----

Revision history for this message
Ian Clatworthy (ian-clatworthy) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/builtins.py'
2--- bzrlib/builtins.py 2009-06-19 09:06:56 +0000
3+++ bzrlib/builtins.py 2009-06-20 16:24:18 +0000
4@@ -3603,13 +3603,9 @@
5 if revision is not None and len(revision) > 0:
6 raise errors.BzrCommandError('Cannot use --uncommitted and'
7 ' --revision at the same time.')
8- location = self._select_branch_location(tree, location)[0]
9- other_tree, other_path = WorkingTree.open_containing(location)
10- merger = _mod_merge.Merger.from_uncommitted(tree, other_tree,
11- pb)
12+ merger = self.get_merger_from_uncommitted(tree, location, pb,
13+ cleanups)
14 allow_pending = False
15- if other_path != '':
16- merger.interesting_files = [other_path]
17
18 if merger is None:
19 merger, allow_pending = self._get_merger_from_branch(tree,
20@@ -3728,6 +3724,22 @@
21 allow_pending = True
22 return merger, allow_pending
23
24+ def get_merger_from_uncommitted(self, tree, location, pb, cleanups):
25+ """Get a merger for uncommitted changes.
26+
27+ :param tree: The tree the merger should apply to.
28+ :param location: The location containing uncommitted changes.
29+ :param pb: The progress bar to use for showing progress.
30+ :param cleanups: A list of operations to perform to clean up the
31+ temporary directories, unfinalized objects, etc.
32+ """
33+ location = self._select_branch_location(tree, location)[0]
34+ other_tree, other_path = WorkingTree.open_containing(location)
35+ merger = _mod_merge.Merger.from_uncommitted(tree, other_tree, pb)
36+ if other_path != '':
37+ merger.interesting_files = [other_path]
38+ return merger
39+
40 def _select_branch_location(self, tree, user_location, revision=None,
41 index=None):
42 """Select a branch location, according to possible inputs.
43
44=== modified file 'bzrlib/shelf_ui.py'
45--- bzrlib/shelf_ui.py 2009-03-23 14:59:43 +0000
46+++ bzrlib/shelf_ui.py 2009-06-20 17:00:49 +0000
47@@ -40,7 +40,7 @@
48
49 def __init__(self, work_tree, target_tree, diff_writer=None, auto=False,
50 auto_apply=False, file_list=None, message=None,
51- destroy=False):
52+ destroy=False, manager=None):
53 """Constructor.
54
55 :param work_tree: The working tree to shelve changes from.
56@@ -52,13 +52,16 @@
57 :param message: The message to associate with the shelved changes.
58 :param destroy: Change the working tree without storing the shelved
59 changes.
60+ :param manager: The shelf manager to use.
61 """
62 self.work_tree = work_tree
63 self.target_tree = target_tree
64 self.diff_writer = diff_writer
65 if self.diff_writer is None:
66 self.diff_writer = sys.stdout
67- self.manager = work_tree.get_shelf_manager()
68+ if manager is None:
69+ manager = work_tree.get_shelf_manager()
70+ self.manager = manager
71 self.auto = auto
72 self.auto_apply = auto_apply
73 self.file_list = file_list