Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Subversion PlugIn - Handle invalid repository URL in python script

DBaur
2018-01-18
2018-03-08
  • DBaur - 2018-01-18

    Hello,
    an invalid repository URL given to
    svn.checkout
    function leads to an exception.
    How can this be handeled?
    Is there a possibility to check the validity of the URL before call the interface function?

    Thanks in advance.

    Kind regards
    D. Baur

     
  • DanSi - 2018-03-08

    Hi,

    we use the commandline option from TortoiseSVN with the subprocess module to check the path:

    def svn_check_path(URL):
       command = 'CD C:\Program Files\TortoiseSVN\bin' # the shell command
       process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=None, shell=True)
       process.communicate()
       
       command = "svn ls " + URL 
       process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
       #Launch the shell command:
       output = process.communicate()
       log = output[1].decode("cp1252");
       #Split the logs 
       infos = log.splitlines();
       path_missing = False;
       for logs in infos:
          if 'warning' in logs or 'E200009' in logs:
             path_missing = True
       return(path_missing)
    
     

    Related

    Talk.ru: 1


Log in to post a comment.