Diff of /trunk/cforge/cforge/Package/CFORGE/Scripts/commit.py [000000] .. [r45]  Maximize  Restore

Switch to unified view

a b/trunk/cforge/cforge/Package/CFORGE/Scripts/commit.py
1
import sys, os
2
import cds_script
3
import ui
4
import pysvn
5
6
7
# This is a cforge command (script file)
8
# this will be run as ironpython script.
9
# the filename of this script is automatically the corresponding cforge command 
10
# with some magic functions you can easily integrate it nicely into cforge tool
11
12
# cforge_usage: 
13
# here you can return an array of all possible arguments and options that can 
14
# be passed to this command script
15
def cforge_usage():
16
    help = [ 
17
        ["<path to CODESYS project>", "---"]
18
    ]
19
20
    return help
21
22
if len(sys.argv) <= 1:
23
    print("Oh, there are no arguments. Perhaps you forgot something?")
24
    sys.exit()
25
26
folder = sys.argv[1]
27
stat = pysvn.svn_get_stat(folder)
28
config = ui.Dialog("Commit", Credentials=True, Info=True, InfoText=stat, Message=True)
29
30
if config != None:
31
    scriptpath = os.path.abspath(os.path.dirname(sys.argv[0]))
32
    scriptname = os.path.join(scriptpath, "action.svn.commit.py")
33
    scriptargs = "%s %s %s %s" % (config["user"], config["pass"], folder, config["msg"])
34
35
    cds_script.RunCodesysWithScript(scriptname, scriptargs, False)