aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/command/init.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/init.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/init.py')
-rw-r--r--libbe/command/init.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/libbe/command/init.py b/libbe/command/init.py
index 017cdc3..b52d8e8 100644
--- a/libbe/command/init.py
+++ b/libbe/command/init.py
@@ -42,7 +42,8 @@ class Init (libbe.command.Command):
... except libbe.storage.ConnectionError:
... True
True
- >>> cmd.run(vcs)
+ >>> cmd._unconnected_storage = vcs
+ >>> cmd.run()
No revision control detected.
BE repository initialized.
>>> bd = libbe.bugdir.BugDir(vcs)
@@ -54,8 +55,9 @@ class Init (libbe.command.Command):
>>> vcs = libbe.storage.vcs.installed_vcs()
>>> vcs.repo = dir.path
>>> vcs._vcs_init(vcs.repo)
+ >>> cmd._unconnected_storage = vcs
>>> if vcs.name in libbe.storage.vcs.base.VCS_ORDER:
- ... cmd.run(vcs) # doctest: +ELLIPSIS
+ ... cmd.run() # doctest: +ELLIPSIS
... else:
... vcs.init()
... vcs.connect()
@@ -70,9 +72,9 @@ class Init (libbe.command.Command):
def __init__(self, *args, **kwargs):
libbe.command.Command.__init__(self, *args, **kwargs)
- self.requires_unconnected_storage = True
- def _run(self, storage, bugdir=None, **params):
+ def _run(self, **params):
+ storage = self._get_unconnected_storage()
if not os.path.isdir(storage.repo):
raise libbe.command.UserError(
'No such directory: %s' % storage.repo)