Lasso Soft Inc. > Home

[xs_svn]

Linkxs_svn
AuthorJonathan Guthrie
CategoryCustom Tag
Version8.x
Licensehttp://creativecommons.org/licenses/by/2.5/
Posted08 Mar 2006
Updated08 Mar 2006
More by this author...

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!

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.

	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

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft