[xs_svn]
Description
Provides Subversion services to Lasso.
Allows a developer to utilize subversion control of their remote web apps.
activate :
activates the latest revision of the module on this server
status :
returns a status list of all files changed since current revision, plus the
latest revision number
version :
returns the latest revision number in the current working copy
list :
um, could get rather long if you have a large module!
To do:
-->making a ctype inside this to store various infomation like the 2 types
of usernames and passwords, repository info, etc.
-->less reliance on page level variables!
Parameters
-user
string, required
username for passthru
-pass
string, required
password for passthru
-subdir
string, required
subdirectory inside which the module lives on the drive
-repository
string, required
repository url
-module
string, required
module name on the svn server
Sample Usage
xs_svn->(activate(
-user=(#ptauth->get(1)),
-pass=(#ptauth->get(2)),
-subdir=$gv_svnSubDir,
-repository=$gv_svnRepository,
-module=$gv_svnModule));
xs_svn->(version(
-user=(#ptauth->get(1)),
-pass=(#ptauth->get(2)),
-subdir=$gv_svnSubDir));
xs_svn->(status(
-user=(#ptauth->get(1)),
-pass=(#ptauth->get(2)),
-subdir=$gv_svnSubDir));
xs_svn->(list(
-user=(#ptauth->get(1)),
-pass=(#ptauth->get(2)),
-repository=$gv_svnRepository,
-module=$gv_svnModule));
Source Code
Click the "Download" button below to retrieve a copy of this tag,
including the complete documentation and sample usage shown
on this page. Place the downloaded ".inc" file in your
LassoStartup folder, restart Lasso, and you can begin using this
tag immediately.
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
define_type('svn',
-namespace='xs_',
-priority='replace',
-description='provides subversion services',
-prototype);
// ---------------------------------------------------------------------------------------------------
// activates the latest revision of the module on this server
// ---------------------------------------------------------------------------------------------------
define_tag:'activate',
-Required='user',
-Required='pass',
-Required='subdir',
-Required='repository',
-Required='module',
-Priority='replace';
local:'out' = '';
local:'ptstring' = 'cd '+$gv_svnDir+'; /usr/local/bin/svn checkout --username '$gv_svnU' --password '$gv_svnP' --no-auth-cache '+#repository+'/'+#module+' '+#subdir;
// protect;
local:'out' = string(PassThru: #ptstring, -username=#user, -password=#pass);
// /protect;
return:#out;
/define_tag;
// ---------------------------------------------------------------------------------------------------
// returns a status list of all files changed since current revision, plus the latest revision number
// ---------------------------------------------------------------------------------------------------
define_tag('status',
-Required='user',
-Required='pass',
-Required='subdir',
-Priority='replace');
local:'out' = '';
local:'ptstring' = '/usr/local/bin/svn status '$gv_svnDir+#subdir' --username '$gv_svnU' --password '$gv_svnP' --no-auth-cache --show-updates';
protect;
local:'out' = string(PassThru: #ptstring, -username=#user, -password=#pass);
/protect;
#out->(Replace($gv_svnDir+#subdir, ''));
return:#out;
/define_tag;
// ---------------------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------------
// returns the latest revision number in the current working copy
// ---------------------------------------------------------------------------------------------------
define_tag('version',
-Required='user',
-Required='pass',
-Required='subdir',
-Priority='replace');
local:'out' = '';
local:'ptstring' = '/usr/local/bin/svnversion '$gv_svnDir+#subdir;
protect;
local:'out' = string(PassThru: #ptstring, -username=#user, -password=#pass);
/protect;
#out->(Replace($gv_svnDir+#subdir, ''));
return:#out;
/define_tag;
// ---------------------------------------------------------------------------------------------------
define_tag:'list',
-Required='user',
-Required='pass',
-Required='repository',
-Required='module',
-Priority='replace';
local:'out' = '';
local:'ptstring' = '/usr/local/bin/svn list --xml --username '$gv_svnU' --password '$gv_svnP' --no-auth-cache '+#repository+'/'+#module;
protect;
local:'out' = XML(PassThru: #ptstring, -username=#user, -password=#pass);
/protect;
local('x' = array);
iterate:(#out->(Extract:'(/lists/list/*)')),(local('temp'));
local('tempa' = map);
#temp = xml(#temp);
#tempa->insert('parent' = '/');
#tempa->insert('name' = #temp->(Extract:'normalize-space(name/text())'));
#tempa->insert('kind' = #temp->(Extract:'normalize-space(@kind)'));
#tempa->insert('version' = #temp->(Extract:'normalize-space(commit/@revision)'));
#tempa->insert('author' = #temp->(Extract:'normalize-space(commit/author/text())'));
local('thisdate' = #temp->(Extract:'normalize-space(commit/date/text())'));
#thisdate = date(#thisdate,-format='%QT%T');
#tempa->insert('date' = #thisdate);
local('thisname' = #tempa->find('name'));
// now get non-trunk commits
if(#thisname != 'trunk');
local:'ptstring' = '/usr/local/bin/svn list --xml --username lasso --password bl4hblahbl4h --no-auth-cache '+#repository+'/'+#module+'/'+#thisname;
protect;
local:'out2' = XML(PassThru: #ptstring, -username=#user, -password=#pass);
/protect;
iterate:(#out2->(Extract:'(/lists/list/*)')),(local('temp2'));
local('tempa' = map);
#temp2 = xml(#temp2);
#tempa->insert('parent' = ('/'+#thisname+'/'));
#tempa->insert('name' = #temp2->(Extract:'normalize-space(name/text())'));
#tempa->insert('kind' = #temp2->(Extract:'normalize-space(@kind)'));
#tempa->insert('version' = #temp2->(Extract:'normalize-space(commit/@revision)'));
#tempa->insert('author' = #temp2->(Extract:'normalize-space(commit/author/text())'));
local('thisdate2' = #temp2->(Extract:'normalize-space(commit/date/text())'));
#thisdate2 = date(#thisdate2,-format='%QT%T');
#tempa->insert('date' = #thisdate2);
#x->insert(#tempa);
/iterate;
else;
#x->insert(#tempa);
/if;
/iterate;
return:#x;
/define_tag;
/define_type;
Comments
none
Newest
Most Popular
Support tagSwap.net