示例#1
0
    def load_project(self, projdir):
        ''' Activate the project in the specified directory;
            instantiate a file manager and projdirfactory.
        '''
        _clear_insts()
        self.cleanup()

        try:
            # Start a new log file.
            logging.getLogger().handlers[0].doRollover()

            self.files = FileManager('files',
                                     path=projdir,
                                     publish_updates=self.publish_updates)

            self.projdirfactory = ProjDirFactory(projdir,
                                                 observer=self.files.observer)
            register_class_factory(self.projdirfactory)

            self.proj = Project(projdir)
            repo = get_repo(projdir)
            if repo is None:
                find_vcs()[0](projdir).init_repo()
            self.proj.activate()
        except Exception as err:
            self._error(err, sys.exc_info())
    def load_project(self, projdir):
        ''' Activate the project in the specified directory;
            instantiate a file manager and projdirfactory.
        '''
        _clear_insts()
        self.cleanup()

        try:
            # Start a new log file.
            logging.getLogger().handlers[0].doRollover()

            self.files = FileManager('files', path=projdir,
                                     publish_updates=self.publish_updates)

            self.projdirfactory = ProjDirFactory(projdir,
                                                 observer=self.files.observer)
            register_class_factory(self.projdirfactory)

            self.proj = Project(projdir)
            repo = get_repo(projdir)
            if repo is None:
                find_vcs()[0](projdir).init_repo()
            self.proj.activate()
        except Exception as err:
            self._error(err, sys.exc_info())
示例#3
0
 def commit_project(self, comment=''):
     ''' Save the current project macro and commit to the project repo.
     '''
     if self.proj:
         try:
             repo = get_repo(self.proj.path)
             repo.commit(comment)
             print 'Committed project in directory ', self.proj.path
         except Exception as err:
             self._error(err, sys.exc_info())
     else:
         self._print_error('No Project to commit')
 def commit_project(self, comment=''):
     ''' Save the current project macro and commit to the project repo.
     '''
     if self.proj:
         try:
             repo = get_repo(self.proj.path)
             repo.commit(comment)
             print 'Committed project in directory ', self.proj.path
         except Exception as err:
             self._error(err, sys.exc_info())
     else:
         self._print_error('No Project to commit')
 def revert_project(self, commit_id=None):
     ''' Revert to the most recent commit of the project.
     '''
     if self.proj:
         try:
             repo = get_repo(self.proj.path)
             repo.revert(commit_id)
             if commit_id is None:
                 commit_id = 'latest'
             print "Reverted project %s to commit '%s'" % (self.proj.name, commit_id)
         except Exception as err:
             self._error(err, sys.exc_info())
             return err  # give the caller an indication that something went wrong so he can
                         # give the proper error response to the http call if desired. Raising
                         # an exception here doesn't work
     else:
         msg = 'No Project to revert'
         self._print_error(msg)
         return Exception(msg)
示例#6
0
 def revert_project(self, commit_id=None):
     ''' Revert to the most recent commit of the project.
     '''
     if self.proj:
         try:
             repo = get_repo(self.proj.path)
             repo.revert(commit_id)
             if commit_id is None:
                 commit_id = 'latest'
             print "Reverted project %s to commit '%s'" % (self.proj.name, commit_id)
         except Exception as err:
             self._error(err, sys.exc_info())
             return err  # give the caller an indication that something went wrong so he can
                         # give the proper error response to the http call if desired. Raising
                         # an exception here doesn't work
     else:
         msg = 'No Project to revert'
         self._print_error(msg)
         return Exception(msg)