aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/command/merge.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@tremily.us>2012-08-29 23:26:17 -0400
committerW. Trevor King <wking@tremily.us>2012-08-29 23:31:03 -0400
commit4db1a045a0606bead191a563abc54dfa8352efe0 (patch)
tree51c891d731555340ffd4432cd889fb67795ae1b6 /libbe/command/merge.py
parent5a32d82284e54facf2f5dcb03ba37afe3805a609 (diff)
downloadbugseverywhere-4db1a045a0606bead191a563abc54dfa8352efe0.tar.gz
Rewrite commands to use bugdirs instead of a single bugdir.
The bulk of the work is in regard to XML, with new BugDir.xml and .from_xml methods to support the new <bugdir> entity. I also split the guts import_xml's ._run method into sub-methods to make the import logic more obvious.
Diffstat (limited to 'libbe/command/merge.py')
-rw-r--r--libbe/command/merge.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/libbe/command/merge.py b/libbe/command/merge.py
index e2c8951..5d74c7e 100644
--- a/libbe/command/merge.py
+++ b/libbe/command/merge.py
@@ -35,7 +35,7 @@ class Merge (libbe.command.Command):
>>> io = libbe.command.StringInputOutput()
>>> io.stdout = sys.stdout
>>> ui = libbe.command.UserInterface(io=io)
- >>> ui.storage_callbacks.set_bugdir(bd)
+ >>> ui.storage_callbacks.set_storage(bd.storage)
>>> cmd = Merge(ui=ui)
>>> a = bd.bug_from_uuid('a')
@@ -61,7 +61,8 @@ class Merge (libbe.command.Command):
... cmp=libbe.comment.cmp_time)
>>> mergeA = a_comments[0]
>>> mergeA.time = 3
- >>> print a.string(show_comments=True) # doctest: +ELLIPSIS
+ >>> print a.string(show_comments=True)
+ ... # doctest: +ELLIPSIS, +REPORT_UDIFF
ID : a
Short name : abc/a
Severity : minor
@@ -107,7 +108,8 @@ class Merge (libbe.command.Command):
... libbe.comment.cmp_time)
>>> mergeB = b_comments[0]
>>> mergeB.time = 3
- >>> print b.string(show_comments=True) # doctest: +ELLIPSIS
+ >>> print b.string(show_comments=True)
+ ... # doctest: +ELLIPSIS, +REPORT_UDIFF
ID : b
Short name : abc/b
Severity : minor
@@ -154,14 +156,15 @@ class Merge (libbe.command.Command):
])
def _run(self, **params):
- bugdir = self._get_bugdir()
- bugA,dummy_comment = \
- libbe.command.util.bug_comment_from_user_id(
- bugdir, params['bug-id'])
+ storage = self._get_storage()
+ bugdirs = self._get_bugdirs()
+ bugdirA,bugA,comment = (
+ libbe.command.util.bugdir_bug_comment_from_user_id(
+ bugdirs, params['bug-id']))
bugA.load_comments()
- bugB,dummy_comment = \
- libbe.command.util.bug_comment_from_user_id(
- bugdir, params['bug-id-to-merge'])
+ bugdirB,bugB,dummy_comment = (
+ libbe.command.util.bugdir_bug_comment_from_user_id(
+ bugdirs, params['bug-id-to-merge']))
bugB.load_comments()
mergeA = bugA.new_comment('Merged from bug #%s#' % bugB.id.long_user())
newCommTree = copy.deepcopy(bugB.comment_root)
@@ -171,7 +174,7 @@ class Merge (libbe.command.Command):
if comment.alt_id == None:
comment.storage = None
comment.alt_id = comment.uuid
- comment.storage = bugdir.storage
+ comment.storage = storage
comment.uuid = libbe.util.id.uuid_gen()
comment.save() # force onto disk under bugA