Example #1
0
File: init.py Project: gitmob/yabbe
 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)
     try:
         storage.connect()
         raise libbe.command.UserError(
             'Directory already initialized: %s' % storage.repo)
     except libbe.storage.ConnectionError:
         pass
     storage.init()
     storage.connect()
     self.ui.storage_callbacks.set_storage(storage)
     bd = libbe.bugdir.BugDir(storage, from_storage=False)
     self.ui.storage_callbacks.set_bugdirs({bd.uuid: bd})
     if bd.storage.name is not 'None':
         print >> self.stdout, \
             'Using %s for revision control.' % storage.name
     else:
         print >> self.stdout, 'No revision control detected.'
     print >> self.stdout, 'BE repository initialized.'
Example #2
0
 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)
     try:
         storage.connect()
         raise libbe.command.UserError('Directory already initialized: %s' %
                                       storage.repo)
     except libbe.storage.ConnectionError:
         pass
     storage.init()
     storage.connect()
     self.ui.storage_callbacks.set_storage(storage)
     bd = libbe.bugdir.BugDir(storage, from_storage=False)
     self.ui.storage_callbacks.set_bugdir(bd)
     if bd.storage.name is not 'None':
         print >> self.stdout, \
             'Using %s for revision control.' % storage.name
     else:
         print >> self.stdout, 'No revision control detected.'
     print >> self.stdout, 'BE repository initialized.'
 def __init__(self, memory=True, versioned=False):
     if memory == True:
         storage = None
     else:
         dir = utility.Dir()
         self._dir_ref = dir  # postpone cleanup since dir.cleanup() removes dir.
         if versioned == False:
             storage = libbe.storage.base.Storage(dir.path)
         else:
             storage = libbe.storage.base.VersionedStorage(dir.path)
         storage.init()
         storage.connect()
     BugDir.__init__(self, storage=storage, uuid='abc123')
     bug_a = self.new_bug(summary='Bug A', _uuid='a')
     bug_a.creator = 'John Doe <*****@*****.**>'
     bug_a.time = 0
     bug_b = self.new_bug(summary='Bug B', _uuid='b')
     bug_b.creator = 'Jane Doe <*****@*****.**>'
     bug_b.time = 0
     bug_b.status = 'closed'
     if self.storage != None:
         self.storage.disconnect()  # flush to storage
         self.storage.connect()
Example #4
0
 def __init__(self, memory=True, versioned=False):
     if memory == True:
         storage = None
     else:
         dir = utility.Dir()
         self._dir_ref = dir # postpone cleanup since dir.cleanup() removes dir.
         if versioned == False:
             storage = libbe.storage.base.Storage(dir.path)
         else:
             storage = libbe.storage.base.VersionedStorage(dir.path)
         storage.init()
         storage.connect()
     BugDir.__init__(self, storage=storage, uuid='abc123')
     bug_a = self.new_bug(summary='Bug A', _uuid='a')
     bug_a.creator = 'John Doe <*****@*****.**>'
     bug_a.time = 0
     bug_b = self.new_bug(summary='Bug B', _uuid='b')
     bug_b.creator = 'Jane Doe <*****@*****.**>'
     bug_b.time = 0
     bug_b.status = 'closed'
     if self.storage != None:
         self.storage.disconnect() # flush to storage
         self.storage.connect()