Rev 4482: (abentley) Refactor code to allow easier reuse by bzr-pipeline in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Jun 26 05:45:21 BST 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4482 [merge]
revision-id: pqm at pqm.ubuntu.com-20090626044519-uc47aufeyqmml40o
parent: pqm at pqm.ubuntu.com-20090626033227-k6uokcs5iehqp80h
parent: aaron at aaronbentley.com-20090626034430-5btbqa44ikywccsu
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2009-06-26 05:45:19 +0100
message:
(abentley) Refactor code to allow easier reuse by bzr-pipeline
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/shelf_ui.py shelver.py-20081005210102-33worgzwrtdw0yrm-1
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2009-06-22 09:01:51 +0000
+++ b/bzrlib/builtins.py 2009-06-26 03:44:30 +0000
@@ -3604,13 +3604,9 @@
if revision is not None and len(revision) > 0:
raise errors.BzrCommandError('Cannot use --uncommitted and'
' --revision at the same time.')
- location = self._select_branch_location(tree, location)[0]
- other_tree, other_path = WorkingTree.open_containing(location)
- merger = _mod_merge.Merger.from_uncommitted(tree, other_tree,
- pb)
+ merger = self.get_merger_from_uncommitted(tree, location, pb,
+ cleanups)
allow_pending = False
- if other_path != '':
- merger.interesting_files = [other_path]
if merger is None:
merger, allow_pending = self._get_merger_from_branch(tree,
@@ -3729,6 +3725,22 @@
allow_pending = True
return merger, allow_pending
+ def get_merger_from_uncommitted(self, tree, location, pb, cleanups):
+ """Get a merger for uncommitted changes.
+
+ :param tree: The tree the merger should apply to.
+ :param location: The location containing uncommitted changes.
+ :param pb: The progress bar to use for showing progress.
+ :param cleanups: A list of operations to perform to clean up the
+ temporary directories, unfinalized objects, etc.
+ """
+ location = self._select_branch_location(tree, location)[0]
+ other_tree, other_path = WorkingTree.open_containing(location)
+ merger = _mod_merge.Merger.from_uncommitted(tree, other_tree, pb)
+ if other_path != '':
+ merger.interesting_files = [other_path]
+ return merger
+
def _select_branch_location(self, tree, user_location, revision=None,
index=None):
"""Select a branch location, according to possible inputs.
=== modified file 'bzrlib/shelf_ui.py'
--- a/bzrlib/shelf_ui.py 2009-06-19 21:16:31 +0000
+++ b/bzrlib/shelf_ui.py 2009-06-26 03:44:30 +0000
@@ -57,7 +57,7 @@
def __init__(self, work_tree, target_tree, diff_writer=None, auto=False,
auto_apply=False, file_list=None, message=None,
- destroy=False, reporter=None):
+ destroy=False, manager=None, reporter=None):
"""Constructor.
:param work_tree: The working tree to shelve changes from.
@@ -69,13 +69,16 @@
:param message: The message to associate with the shelved changes.
:param destroy: Change the working tree without storing the shelved
changes.
+ :param manager: The shelf manager to use.
"""
self.work_tree = work_tree
self.target_tree = target_tree
self.diff_writer = diff_writer
if self.diff_writer is None:
self.diff_writer = sys.stdout
- self.manager = work_tree.get_shelf_manager()
+ if manager is None:
+ manager = work_tree.get_shelf_manager()
+ self.manager = manager
self.auto = auto
self.auto_apply = auto_apply
self.file_list = file_list
More information about the bazaar-commits
mailing list