[r46]: / trunk / cforge / cforge / Package / CFORGE / Scripts / action.svn.update.py  Maximize  Restore  History

Download this file

45 lines (34 with data), 1.2 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Example Batch:
# set WD=%~d0%~p0
# set USER=<username>
# set PASS=<password>
# set URL=https://forge.codesys.com/svn/drv,gpio-mod,code/trunk/GPIOMods
# "C:\Program Files (x86)\3S CODESYS-V3.5.12.0\CODESYS\Common\CODESYS.exe" --profile="CODESYS V3.5 SP12" --runscript="%WD%\action.svn.checkout.py" --scriptargs="%URL% %USER% %PASS% %WD%" --noUI

import sys
import os.path
import pysvn

if len(sys.argv) <= 1:
    print("usage: <user> <pass> <working dir>")
    sys.exit()

if len(sys.argv) > 2:
	username = sys.argv[1].replace("`````", "'")
	password = sys.argv[2].replace("`````", "'")

if len(sys.argv) > 3:
	path = sys.argv[3].replace("`````", "'")

def set_username(req):
    req.username = username
    req.password = password
    req.save = True # Optional

svn.auth_username_password += set_username
# checkout plain SVN files
pysvn.svn_update_non_codesys(username, password, path)

# iterate over all projects and libraries
for root, dirs, files in os.walk(path):
    for file in files:
        if file.endswith(".project") or file.endswith(".library"):
			filepath = os.path.join(root, file)
			proj = projects.open(filepath)
			proj.svn.update()
			proj.save()
			proj.close()

system.exit()