Diff of /trunk/SVN_Plugin/PLC_AC500_V3/_05_svn_commit/svnobj [r5] .. [r6]  Maximize  Restore

Switch to unified view

a/trunk/SVN_Plugin/PLC_AC500_V3/_05_svn_commit/svnobj b/trunk/SVN_Plugin/PLC_AC500_V3/_05_svn_commit/svnobj
1
Gx_l©!0…jüooŠ4´ZŸ´System.StringL{1b2bcd16-2426-4c4a-bd24-c0ad32e0aa99}ScriptContentfrom ScriptEngine import *  #First Line is readonly.
1
Gx_l;   !0…jüo Y¼ª#ZŸ´System.StringL{1b2bcd16-2426-4c4a-bd24-c0ad32e0aa99}ScriptContent–from ScriptEngine import *  #First Line is readonly.
2

2
from __future__ import print_function
3
def set_username(req):
3

4

5
def goodbye():
4

6
    print("Oops.. goodbye")
5
    res = system.ui.query_credentials("Credentials for SVN Repo")
7
    print("--- Script finished. ---")
6
    if res:
8
    exit()
7
        ## tuple containing vowels
9

8
        #vowels = ('a', 'e', 'i', 'o', 'u')
10

9
        #
11
def print_all( thistuple ):
10
        ## index of 'e' in vowels
12
    for i in range( len( thistuple ) ):
13
        print( thistuple[i] ) 
14

15

16
def set_username( req ):
17
    res = system.ui.query_credentials("Credentials for SVN Repo")
18
    if not res:
11
        #index = vowels.index('e')
19
        goodbye()
12
        #
20

13
        #> print(index)
21
    print_all( res )
14
        #
22
    req.username = res[0] # username
15
        #> Output: 1
23
    req.password = res[1] # password
16

24
    req.save = True # Optional
17
        print("Username '%s' and password '%s'" % res) # res is a 2-tuple
25

18
        req.username = res.index(0)
26

27
def set_commitmsg( msg ):
28
    message = system.ui.query_string("Add a commit message", multi_line=True)
29
    if (message):
30
        msg = message    
19
        req.password = res.index(1)
31
        print("Your commit message: " % message)
20
    else:
32
    else:
21
        print("Oops.. goodbye")
33
        print("A commit message may not not be empty")
22
        exit()
34
        goodbye()
23

35

24
    req.save = False # Optional
36

25

37
proj = projects.primary
26
svn.auth_username_password += set_username
38
if proj.svn.is_versioned:
39
    svn.auth_username_password += set_username
27
#svn.commit(message)ScriptFileName 05_svn_commit.py ScriptParametersÐÐ-Ð-
40
    proj.svn.commit( set_commitmsg )
41

42
print("--- Script finished. ---")
43
ScriptFileName 05_svn_commit.py ScriptParametersÐÐ-Ð-