-# Copyright (C) 2005-2009 Aaron Bentley and Panometrics, Inc.
+# Copyright (C) 2005-2011 Aaron Bentley <abentley@panoramicfeedback.com>
+# Chris Ball <cjb@laptop.org>
# Gianluca Montecchi <gian@grys.it>
# W. Trevor King <wking@drexel.edu>
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
+# This file is part of Bugs Everywhere.
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# Bugs Everywhere is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 2 of the License, or (at your
+# option) any later version.
#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# Bugs Everywhere is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Bugs Everywhere. If not, see <http://www.gnu.org/licenses/>.
import os.path
>>> import libbe.storage.vcs
>>> import libbe.storage.vcs.base
>>> import libbe.util.utility
+ >>> io = libbe.command.StringInputOutput()
+ >>> io.stdout = sys.stdout
+ >>> ui = libbe.command.UserInterface(io=io)
>>> cmd = Init()
- >>> cmd._setup_io = lambda i_enc,o_enc : None
- >>> cmd.stdout = sys.stdout
>>> dir = libbe.util.utility.Dir()
>>> vcs = libbe.storage.vcs.vcs_by_name('None')
>>> try:
... vcs.connect()
... except libbe.storage.ConnectionError:
- ... True
- True
- >>> cmd.run(vcs)
+ ... 'got error'
+ 'got error'
+ >>> ui.storage_callbacks.set_unconnected_storage(vcs)
+ >>> ui.run(cmd)
No revision control detected.
BE repository initialized.
>>> bd = libbe.bugdir.BugDir(vcs)
>>> vcs.disconnect()
+ >>> vcs.connect()
+ >>> bugdir = libbe.bugdir.BugDir(vcs, from_storage=True)
+ >>> vcs.disconnect()
>>> vcs.destroy()
>>> dir.cleanup()
>>> vcs = libbe.storage.vcs.installed_vcs()
>>> vcs.repo = dir.path
>>> vcs._vcs_init(vcs.repo)
+ >>> ui.storage_callbacks.set_unconnected_storage(vcs)
>>> if vcs.name in libbe.storage.vcs.base.VCS_ORDER:
- ... cmd.run(vcs) # doctest: +ELLIPSIS
+ ... ui.run(cmd) # doctest: +ELLIPSIS
... else:
... vcs.init()
... vcs.connect()
Using ... for revision control.
BE repository initialized.
>>> vcs.disconnect()
+ >>> vcs.connect()
+ >>> bugdir = libbe.bugdir.BugDir(vcs, from_storage=True)
+ >>> vcs.disconnect()
>>> vcs.destroy()
>>> dir.cleanup()
"""
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)
pass
storage.init()
storage.connect()
+ self.ui.storage_callbacks.set_storage(storage)
bd = libbe.bugdir.BugDir(storage, from_storage=False)
- bd.save()
+ self.ui.storage_callbacks.set_bugdir(bd)
if bd.storage.name is not 'None':
print >> self.stdout, \
'Using %s for revision control.' % storage.name