Exemple #1
0
    def pullFromRemote(self, local_workspace_dir):
        workspace = CmdWorkspace(local_workspace_dir, get_cmd_by_name(self._git_implementation))
        cmd = workspace.cmd

        remote_workspace_url = cmd.read_remote(workspace)
        creds = self.requestTemporaryPassword(remote_workspace_url)
        stdout, stderr = cmd.pull(workspace,
            username=creds['user'], password=creds['key'])

        if stdout:
            logger.info(stdout)
        if stderr:
            logger.info(stderr)

        return stdout, stderr
    def pushToRemote(self, local_workspace_dir, remote_workspace_url=None):
        workspace = CmdWorkspace(local_workspace_dir, auto=True)
        cmd = workspace.cmd

        if remote_workspace_url is None:
            remote_workspace_url = cmd.read_remote(workspace)
        # acquire temporary creds
        creds = self.requestTemporaryPassword(remote_workspace_url)

        stdout, stderr = cmd.push(workspace,
            username=creds['user'], password=creds['key'])

        if stderr:
            raise PMRToolError('Error pushing changes to PMR',
                'The command line tool gave us this error message:\n\n' +
                    stderr)

        return stdout, stderr
Exemple #3
0
    def pushToRemote(self, credit, remote_workspace_url=None):
        workspace = CmdWorkspace(self._currentDirectory,
                                 get_cmd_by_name(self._git_implementation)())
        cmd = workspace.cmd

        if remote_workspace_url is None:
            remote_workspace_url = cmd.read_remote(workspace)

        stderr, stdout = cmd.push(workspace,
                                  username=credit['user'],
                                  password=credit['key'])

        if stdout:
            print(stdout)
        if stderr:
            print(stderr)

        return stdout, stderr
Exemple #4
0
    def pullFromRemote(self, credit):
        workspace = CmdWorkspace(self._currentDirectory,
                                 get_cmd_by_name(self._git_implementation)())
        cmd = workspace.cmd

        remote_workspace_url = cmd.read_remote(workspace)
        if credit:
            stdout, stderr = cmd.pull(workspace,
                                      username=credit['user'],
                                      password=credit['key'])
        else:
            stdout, stderr = cmd.pull(workspace)

        if stdout:
            print(stdout)
        if stderr:
            print(stderr)

        return stdout, stderr
Exemple #5
0
    def pushToRemote(self, local_workspace_dir, remote_workspace_url=None):
        workspace = CmdWorkspace(local_workspace_dir, get_cmd_by_name(self._git_implementation))
        cmd = workspace.cmd

        if remote_workspace_url is None:
            remote_workspace_url = cmd.read_remote(workspace)
        # Acquire temporary creds
        creds = self.requestTemporaryPassword(remote_workspace_url)

        stdout, stderr = cmd.push(workspace,
            username=creds['user'], password=creds['key'])

        if stdout:
            logger.info(stdout)
        if stderr:
            logger.error(stderr)
#             raise PMRToolError('Error pushing changes to PMR',
#                 'The command line tool gave us this error message:\n\n' +
#                     stderr)

        return stdout, stderr
Exemple #6
0
    def addFileToIndexer(self, local_workspace_dir, workspace_file):
        """
        Add the given workspace file in the remote workspace to the
        indexer for ontological searching.
        """
        if not self.hasAccess():
            return

        workspace = CmdWorkspace(local_workspace_dir, get_cmd_by_name(self._git_implementation))
        cmd = workspace.cmd
        remote_workspace_url = cmd.read_remote(workspace)
        target = '/'.join([remote_workspace_url, 'rdf_indexer'])
#         {u'fields': {u'paths': {u'items': None, u'error': None, u'description': u'Paths that will be indexed as RDF.', u'value': u'', u'klass': u'textarea-widget list-field'}}, u'actions': {u'apply': {u'title': u'Apply'}, u'export_rdf': {u'title': u'Apply Changes and Export To RDF Store'}}}
        session = self.make_session()
        r = session.post(target,
            data=make_form_request('export_rdf',
                paths=[workspace_file],
            ),
            allow_redirects=False)

        r.raise_for_status()
        return r.json()
    def addFileToIndexer(self, local_workspace_dir, workspace_file):
        '''
        Add the given workspace file in the remote workspace to the 
        indexer for ontological searching.
        '''
        if not self.hasAccess():
            return

        workspace = CmdWorkspace(local_workspace_dir, auto=True)
        cmd = workspace.cmd
        remote_workspace_url = cmd.read_remote(workspace)
        target = '/'.join([remote_workspace_url, 'rdf_indexer'])
#         {u'fields': {u'paths': {u'items': None, u'error': None, u'description': u'Paths that will be indexed as RDF.', u'value': u'', u'klass': u'textarea-widget list-field'}}, u'actions': {u'apply': {u'title': u'Apply'}, u'export_rdf': {u'title': u'Apply Changes and Export To RDF Store'}}}
        session = self.make_session()
        r = session.post(target,
            data=make_form_request('export_rdf',
                paths=[workspace_file],
            ),
            allow_redirects=False)

        r.raise_for_status()
        return r.json()