aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/command/merge.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-12-14 23:15:58 -0500
committerW. Trevor King <wking@drexel.edu>2009-12-14 23:15:58 -0500
commit1b9c628529848af370adbc67b5ba298236a1b86d (patch)
treedd16c447d971297637b59128c383c942a5578d1e /libbe/command/merge.py
parent0786fc6693e40cdfaca7876b504acb3e5e7dc4d2 (diff)
downloadbugseverywhere-1b9c628529848af370adbc67b5ba298236a1b86d.tar.gz
Transitioned severity to Command-format, also added Command._get_*()
The old .requires_* thing was rediculous. The new ._get_*() callbacks allow the caller to provide a means for getting the expensive structures, which the command can use, or not, as required. This will also make it easier to implement the completion callbacks. The callbacks should probably have matching .set_*() methods, to avoid the current cache tweaking cmd._storage = ... etc. But that can wait for now...
Diffstat (limited to 'libbe/command/merge.py')
-rw-r--r--libbe/command/merge.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/libbe/command/merge.py b/libbe/command/merge.py
index 4624ab7..e3bf943 100644
--- a/libbe/command/merge.py
+++ b/libbe/command/merge.py
@@ -31,6 +31,7 @@ class Merge (libbe.command.Command):
>>> import libbe.comment
>>> bd = libbe.bugdir.SimpleBugDir(memory=False)
>>> cmd = Merge()
+ >>> cmd._storage = bd.storage
>>> cmd._setup_io = lambda i_enc,o_enc : None
>>> cmd.stdout = sys.stdout
@@ -48,7 +49,7 @@ class Merge (libbe.command.Command):
>>> dummy = dummy.new_reply('1 2 3 4')
>>> dummy.time = 2
- >>> ret = cmd.run(bd.storage, bd, {}, ['/a', '/b'])
+ >>> ret = cmd.run(args=['/a', '/b'])
Merged bugs #abc/a# and #abc/b#
>>> bd.flush_reload()
>>> a = bd.bug_from_uuid('a')
@@ -139,7 +140,6 @@ class Merge (libbe.command.Command):
def __init__(self, *args, **kwargs):
libbe.command.Command.__init__(self, *args, **kwargs)
- self.requires_bugdir = True
self.args.extend([
libbe.command.Argument(
name='bug-id', metavar='BUG-ID', default=None,
@@ -149,7 +149,8 @@ class Merge (libbe.command.Command):
completion_callback=libbe.command.util.complete_bug_id),
])
- def _run(self, storage, bugdir, **params):
+ def _run(self, **params):
+ bugdir = self._get_bugdir()
bugA,dummy_comment = \
libbe.command.util.bug_comment_from_user_id(
bugdir, params['bug-id'])
@@ -166,7 +167,7 @@ class Merge (libbe.command.Command):
if comment.alt_id == None:
comment.storage = None
comment.alt_id = comment.uuid
- comment.storage = storage
+ comment.storage = bugdir.storage
comment.uuid = libbe.util.id.uuid_gen()
comment.save() # force onto disk under bugA