コード例 #1
0
ファイル: model.py プロジェクト: Ramachandra928/tools
    def get_log(cls, branch, from_rev, to_rev=None, xml=False):

        #Check if we can talk to SVN
        cls.fetch_info(branch)

        if to_rev is None:
            assert(hasattr(cls, 'revision'))
            to_rev = cls.revision

        try:
            #svn log  https://svnsdus.sandisk.com/svn/HEMi2/branch/T3C1 -r 10897:10936 --xml -v > T3C1_svn_n.xml
            command_line = ['svn', 'log', branch, '-r', str(from_rev) + ':' + str(to_rev)]
            if xml:
                command_line.append('--xml')
            output = subprocess.check_output(command_line, stderr=subprocess.STDOUT)
            payload = output.replace('\r\n'.encode(), '\n'.encode())

            if payload is not None:
                filename = cls.path + '-' + str(from_rev) + '-' + str(to_rev)

                if xml:
                    filename += '.xml'
                else:
                    filename += '.txt'

                with epic.open(filename, 'wb') as wb:
                    wb.write(payload)
                    return wb.name

            return None
        except subprocess.CalledProcessError:
            legacy.wprint('ERROR: Epic Svn: Try setting a valid branch URL') # 'ERROR:
コード例 #2
0
ファイル: model.py プロジェクト: Ramachandra928/tools
    def fetch_info(cls, branch):
        try:
#           output = subprocess.check_output(['svn', 'info', branch], stderr=subprocess.STDOUT, shell=True).decode()
#           output = os.popen('svn info %s' % branch).read()
            output = epic.check_output_chars(['svn', 'info', branch])
#           for line in output.split('\r\n'):
            for line in output.splitlines():
                if line.split():
                    [attribute, value] = line.split(': ')

                    # ---> NON trivial design choice warning <---
                    # The following line append every keyword/value pair read from svn info
                    # as properties of the class
                    setattr(cls, attribute.replace(' ', '_').lower(), value)

            assert(hasattr(cls, 'revision'))

        except subprocess.CalledProcessError:
            legacy.wprint('ERROR: Epic Svn: Try setting a valid branch URL') # 'ERROR: