Example #1
0
 def init(self):
     '''
     Initialize an empty base repository
     '''
     config = self.config
     # check local repository
     if not self.local:
         raise ISError(u"Repository creation must be local")
     # create base directories
     arrow("Creating base directories")
     arrowlevel(1)
     # creating local directory
     try:
         if os.path.exists(config.path):
             arrow(u"%s already exists" % config.path)
         else:
             istools.mkdir(config.path, config.uid, config.gid, config.dmod)
             arrow(u"%s directory created" % config.path)
     except Exception as e:
         raise ISError(u"Unable to create directory %s" % config.path, e)
     arrowlevel(-1)
     # create database
     d = Database.create(config.dbpath)
     istools.chrights(config.dbpath, uid=config.uid,
                      gid=config.gid, mode=config.fmod)
     # load database
     self.db = Database(config.dbpath)
     # mark repo as not offline
     self.config.offline = False
     # create/update last file
     self.update_last()