(self, vcs, command)
return (status, root)
call a vsc, getting its output if any
call a vsc, getting its output if any
call a vsc getting its output if any
def get_output(self, vcs, command):
        '''call a vsc, getting its output if any'''
        args = {'git_status': ['status', '--untracked-files=all', '-z'],
                'git_root':   ['rev-parse', '--show-toplevel'],
                'hg_status':  ['status'],
                'hg_root':    ['root']}
        sep = {'hg': '\n', 'git': '\x00' if ST3 else '\00'}
        status, root, shell = '', '', True if NT else False
        path = self.vcs_state['path']
        try:
            p = subprocess.Popen([command] + args['%s_status' % vcs], stdin=subprocess.PIPE, stdout=subprocess.PIPE, cwd=path, shell=shell)
            status = p.communicate()[0]
            status = str(status, 'utf-8').split(sep[vcs]) if ST3 else status.split(sep[vcs])
            p = subprocess.Popen([command] + args['%s_root' % vcs], stdin=subprocess.PIPE, stdout=subprocess.PIPE, cwd=path, shell=shell)
            root = p.communicate()[0].decode('utf-8').strip('\n')
        except:
            # on Windows exception is not being raised if cwd is not None and shell=True
            self.vcs_state.update({vcs: False})
        return (status, root)
def get_output ( self , vcs , command ) : args = { 'git_status' : [ 'status' , '--untracked-files=all' , '-z' ] , 'git_root' : [ 'rev-parse' , '--show-toplevel' ] , 'hg_status' : [ 'status' ] , 'hg_root' : [ 'root' ] } sep = { 'hg' : '\n' , 'git' : '\x00' if ST3 else '\00' } status , root , shell = '' , '' , True if NT else False path = self . vcs_state [ 'path' ] try : p = subprocess . Popen ( [ command ] + args [ '%s_status' % vcs ] , stdin = subprocess . PIPE , stdout = subprocess . PIPE , cwd = path , shell = shell ) status = p . communicate ( ) [ 0 ] status = str ( status , 'utf-8' ) . split ( sep [ vcs ] ) if ST3 else status . split ( sep [ vcs ] ) p = subprocess . Popen ( [ command ] + args [ '%s_root' % vcs ] , stdin = subprocess . PIPE , stdout = subprocess . PIPE , cwd = path , shell = shell ) root = p . communicate ( ) [ 0 ] . decode ( 'utf-8' ) . strip ( '\n' ) except : # on Windows exception is not being raised if cwd is not None and shell=True self . vcs_state . update ( { vcs : False } ) return ( status , root )