I have started to setup a continuous integration for our project using the python api and have noticed that when loading/running project with the svn add on , codesys can leave some objects in the svn tree locked.
Can anyone advise how python API can be used to request codesys runtime not acquire any SVN locks ?
At the moment we run this code snippet in a non-codesys checkout of the project to clear locks but it would be better to prevent them from being used at all.
  defunlock_project(self,path):
    output=subprocess.check_output(['svn','status','-u',path]).splitlines()[0:-1]
    forlineinoutput:
      line_str=line.decode(encoding='utf-8',errors='replace')
      locked_path=line_str.split()[2]
      print('Found locked path at: "{0}"'.format(locked_path))
      force_lock=subprocess.check_output(['svn','lock', locked_path,'--force'])
      print(force_lock.decode(encoding='utf-8',errors='replace'))
      remove_lock=subprocess.check_output(['svn','unlock',locked_path,'--force'])
      print(remove_lock.decode(encoding='utf-8',errors='replace'))
Any advice gratefully received,
Kind regards
Varley
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
varleybullard hat geschrieben:
Thanks - that works just fine, although we may still need to force the unlock in case some team member has left the project locked by accident.
If it is a object in a project, which is under version control, you can use the following code to unlock it:
ifobj.svn.is_versionedandobj.svn.is_locked:
  obj.svn.unlock()
BR
Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have started to setup a continuous integration for our project using the python api and have noticed that when loading/running project with the svn add on , codesys can leave some objects in the svn tree locked.
Can anyone advise how python API can be used to request codesys runtime not acquire any SVN locks ?
At the moment we run this code snippet in a non-codesys checkout of the project to clear locks but it would be better to prevent them from being used at all.
Any advice gratefully received,
Kind regards
Varley
Hi Varley.
Depending what you want to do you may set the project to offline mode or disable locking.
BR
Martin
Hi Martin,
Thanks - that works just fine, although we may still need to force the unlock in case some team member has left the project locked by accident.
Best regards
Varley
Hi Varley.
If it is a object in a project, which is under version control, you can use the following code to unlock it:
BR
Martin