CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Thu Aug 22, 2019 4:26 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Tue Jul 23, 2019 6:22 pm 
Offline

Joined: Mon Jul 22, 2019 1:03 pm
Posts: 5
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.

Code:
    def unlock_project(self, path):
        output = subprocess.check_output(['svn', 'status', '-u', path]).splitlines()[0:-1]
        for line in output:
            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


Top
   
PostPosted: Mon Jul 29, 2019 9:44 am 
Offline
Frequent User
Frequent User

Joined: Tue Nov 13, 2012 9:20 am
Posts: 254
Hi Varley.

Depending what you want to do you may set the project to offline mode or disable locking.

Code:
proj = projects.primary

# Disable locking for the whole machine
svn.default_auto_locking_mode = SvnAutoLockingMode.Never

# Deisable locking for the current project
proj.svn.project_auto_locking_mode = SvnAutoLockingMode.Never

BR
Martin

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


Top
   
PostPosted: Wed Aug 14, 2019 5:21 pm 
Offline

Joined: Mon Jul 22, 2019 1:03 pm
Posts: 5
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


Top
   
PostPosted: Tue Aug 20, 2019 8:17 am 
Offline
Frequent User
Frequent User

Joined: Tue Nov 13, 2012 9:20 am
Posts: 254
Hi Varley.

varleybullard wrote:
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:
Code:
if obj.svn.is_versioned and obj.svn.is_locked:
   obj.svn.unlock()

BR
Martin

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited