You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Rick Hillegas (JIRA)" <ji...@apache.org> on 2013/07/09 15:33:48 UTC
[jira] [Commented] (DERBY-5899) Modify the SubversionLogVTI demo
to have a jira_issue column
[ https://issues.apache.org/jira/browse/DERBY-5899?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13703259#comment-13703259 ]
Rick Hillegas commented on DERBY-5899:
--------------------------------------
I don't recommend putting any more effort into the demo VTIs. Instead, I recommend using the XmlVTI which was moved into the engine jar by the work on DERBY-6256.
I think that the following would be a better way to solve this problem:
1) Create a method which parses the svn message text, looking for the leading jira id. Something like this:
public class ParseJiraID
{
public static String parseJiraID( String svnMessage )
{
if ( svnMessage == null ) { return null; }
svnMessage = svnMessage.toUpperCase();
int colonIdx = svnMessage.indexOf( ":" );
if ( (colonIdx < 0) || ( !svnMessage.startsWith( "DERBY-" ) ) ) { return null; }
else { return svnMessage.substring( 0, colonIdx ); }
}
}
2) Extract an svn report in xml format:
svn log --xml > svn.log
3) Run a script to register a table function and view against the svn log file and query the information needed. Something like this:
connect 'jdbc:derby:memory:db;create=true';
create function svnlog
(
xmlResourceName varchar( 32672 ),
rowTag varchar( 32672 ),
childTags varchar( 32672 ) ...
)
returns table
(
revision bigint,
author varchar( 20 ),
commitTime varchar( 30 ),
message varchar( 32672 )
)
language java parameter style derby_jdbc_result_set no sql
external name 'org.apache.derby.vti.XmlVTI.xmlVTI';
create function parseJiraID( svnMessage varchar( 32672 ) ) returns varchar( 12 )
language java parameter style java no sql
external name 'ParseJiraID.parseJiraID';
create view svnlog( jiraID, revision, author, commitTime, message )
as select parseJiraID( v.message ), v.* from table
(
svnlog
(
'svn.log',
'logentry',
'revision', 'author', 'date', 'msg'
)
) v;
select * from svnlog where revision > 1499257;
Hope this helps,
-Rick
> Modify the SubversionLogVTI demo to have a jira_issue column
> -------------------------------------------------------------
>
> Key: DERBY-5899
> URL: https://issues.apache.org/jira/browse/DERBY-5899
> Project: Derby
> Issue Type: Improvement
> Components: Demos/Scripts
> Affects Versions: 10.10.1.1
> Reporter: Kathey Marsden
>
> As it looks as though the subversion plugin won't be back anytime soon. It would be nice to modify the SubversionLogVTI demo to have another column for jira_issue which would be null if there is nothing matching the jira issue pattern in the description.
> This would make it easier to load up the log in a derby db for queries to use as a alternative to the plugin in the short term.
> It would be good to somehow indicate a branch as well, but not sure how that would work in a generic way for the demo.. Maybe a second VTI could load up the detail that prints with svn log -v to another table or handle it outside of the demo VTI all together by just generating different svn log output files for each branch and specify the branch with the load.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira