diff --git a/SourceSFSVN/SourceSFSVN.php b/SourceSFSVN/SourceSFSVN.php index a3b673d..414a6d6 100644 --- a/SourceSFSVN/SourceSFSVN.php +++ b/SourceSFSVN/SourceSFSVN.php @@ -107,40 +107,43 @@ return; } - $t_svn_username = ''; - $t_svn_password = ''; - $t_sf_project = ''; - $t_branches = ''; + $t_svn_username = isset( $p_repo->info['svn_password'] ) ? $p_repo->info['svn_password'] : ''; + $t_svn_password = isset( $p_repo->info['svn_username'] ) ? $p_repo->info['svn_username'] : ''; + $t_sf_project = isset( $p_repo->info['sf_project'] ) ? $p_repo->info['sf_project'] : ''; + $t_standard_repo = isset( $p_repo->info['standard_repo'] ) ? $p_repo->info['standard_repo'] : ''; + $t_trunk_path = isset( $p_repo->info['trunk_path'] ) ? $p_repo->info['trunk_path'] : ''; + $t_branch_path = isset( $p_repo->info['branch_path'] ) ? $p_repo->info['branch_path'] : ''; + $t_ignore_paths = isset( $p_repo->info['ignore_paths'] ) ? $p_repo->info['ignore_paths'] : ''; - if ( isset( $p_repo->info['svn_password'] ) ) { - $t_svn_password = $p_repo->info['svn_password']; - } - if ( isset( $p_repo->info['svn_username'] ) ) { - $t_svn_username = $p_repo->info['svn_username']; - } - if ( isset( $p_repo->info['sf_project'] ) ) { - $t_sf_project = $p_repo->info['sf_project']; - } - if ( isset( $p_repo->info['standard_repo'] ) ) { - $t_branches = $p_repo->info['standard_repo']; - } ?> > - + > - + > - + > - + /> +> + + + +> + + + +> + +/> + info['svn_username'] = $f_svn_username; - $p_repo->info['svn_password'] = $f_svn_password; - $p_repo->info['sf_project'] = $f_sf_project; - $p_repo->info['standard_repo'] = $f_standard_repo; + $p_repo->info['svn_username'] = gpc_get_string( 'svn_username' ); + $p_repo->info['svn_password'] = gpc_get_string( 'svn_password' ); + $p_repo->info['sf_project'] = gpc_get_string( 'sf_project' ); + $p_repo->info['standard_repo'] = gpc_get_bool( 'standard_repo', false ); + $p_repo->info['trunk_path'] = gpc_get_string( 'trunk_path' ); + $p_repo->info['branch_path'] = gpc_get_string( 'branch_path' ); + $p_repo->info['ignore_paths'] = gpc_get_bool( 'ignore_paths', false ); return $p_repo; } @@ -269,6 +270,10 @@ $t_comments = ''; $t_count = 0; + $t_trunk_path = $p_repo->info['trunk_path']; + $t_branch_path = $p_repo->info['branch_path']; + $t_ignore_paths = $p_repo->info['ignore_paths']; + foreach( $p_svnlog as $t_line ) { # starting state, do nothing @@ -279,7 +284,7 @@ # Changeset info } elseif ( 1 == $t_state && preg_match( '/^r([0-9]+) \| (\w+) \| ([0-9\-]+) ([0-9:]+)/', $t_line, $t_matches ) ) { - if ( !is_null( $t_changeset ) ) { + if ( !is_null( $t_changeset ) && !is_blank( $t_changeset->branch ) ) { $t_changeset->save(); $t_changesets[] = $t_changeset; } @@ -317,7 +322,16 @@ } } } else { - if ( preg_match( '/\/([^\/]+)/', $t_file->filename, $t_matches ) ) { + # Look for non-standard trunk path + if ( !is_blank( $t_trunk_path ) && preg_match( '@^' . $t_trunk_path . '@i', $t_file->filename ) ) { + $t_changeset->branch = 'trunk'; + + # Look for non-standard branch path + } else if ( !is_blank( $t_branch_path ) && preg_match( '@^' . $t_branch_path . '([^\/]+)@i', $t_file->filename, $t_matches ) ) { + $t_changeset->branch = $t_matches[1]; + + # Fall back to just using the root folder as the branch name + } else if ( !$t_ignore_paths && preg_match( '/\/([^\/]+)/', $t_file->filename, $t_matches ) ) { $t_changeset->branch = $t_matches[1]; } } @@ -343,7 +357,7 @@ } } - if ( !is_null( $t_changeset ) ) { + if ( !is_null( $t_changeset ) && !is_blank( $t_changeset->branch ) ) { $t_changeset->save(); $t_changesets[] = $t_changeset; } diff --git a/SourceSFSVN/lang/strings_english.txt b/SourceSFSVN/lang/strings_english.txt index 9c5c3b5..dc46f85 100644 --- a/SourceSFSVN/lang/strings_english.txt +++ b/SourceSFSVN/lang/strings_english.txt @@ -20,6 +20,9 @@ $s_plugin_SourceSFSVN_svn_password = 'SVN Password'; $s_plugin_SourceSFSVN_sf_project = 'SourceForge Project'; $s_plugin_SourceSFSVN_standard_repo = 'Standard Repository
(trunk/branches/tags)'; +$s_plugin_SourceSFSVN_trunk_path = 'Trunk Path
(Non-standard repository)'; +$s_plugin_SourceSFSVN_branch_path = 'Branch Path
(Non-standard repository)'; +$s_plugin_SourceSFSVN_ignore_paths = 'Ignore Other Paths
(Non-standard repository)'; $s_plugin_SourceSFSVN_configuration = 'Configuration'; $s_plugin_SourceSFSVN_update = 'Configuration'; diff --git a/SourceWebSVN/SourceWebSVN.php b/SourceWebSVN/SourceWebSVN.php index 74748b1..bdf81eb 100644 --- a/SourceWebSVN/SourceWebSVN.php +++ b/SourceWebSVN/SourceWebSVN.php @@ -106,34 +106,16 @@ return; } - $t_svn_username = ''; - $t_svn_password = ''; - $t_url = ''; - $t_name = ''; - $t_path = ''; - $t_branches = ''; + $t_svn_username = isset( $p_repo->info['svn_password'] ) ? $p_repo->info['svn_password'] : ''; + $t_svn_password = isset( $p_repo->info['svn_username'] ) ? $p_repo->info['svn_username'] : ''; + $t_url = isset( $p_repo->info['websvn_url'] ) ? $p_repo->info['websvn_url'] : ''; + $t_name = isset( $p_repo->info['websvn_name'] ) ? $p_repo->info['websvn_name'] : ''; + $t_path = isset( $p_repo->info['websvn_path'] ) ? $p_repo->info['websvn_path'] : ''; + $t_standard_repo = isset( $p_repo->info['standard_repo'] ) ? $p_repo->info['standard_repo'] : ''; + $t_trunk_path = isset( $p_repo->info['trunk_path'] ) ? $p_repo->info['trunk_path'] : ''; + $t_branch_path = isset( $p_repo->info['branch_path'] ) ? $p_repo->info['branch_path'] : ''; + $t_ignore_paths = isset( $p_repo->info['ignore_paths'] ) ? $p_repo->info['ignore_paths'] : ''; - if ( isset( $p_repo->info['svn_password'] ) ) { - $t_svn_password = $p_repo->info['svn_password']; - } - if ( isset( $p_repo->info['svn_username'] ) ) { - $t_svn_username = $p_repo->info['svn_username']; - } - if ( isset( $p_repo->info['websvn_url'] ) ) { - $t_url = $p_repo->info['websvn_url']; - } - if ( isset( $p_repo->info['websvn_url'] ) ) { - $t_url = $p_repo->info['websvn_url']; - } - if ( isset( $p_repo->info['websvn_name'] ) ) { - $t_name = $p_repo->info['websvn_name']; - } - if ( isset( $p_repo->info['websvn_path'] ) ) { - $t_path = $p_repo->info['websvn_path']; - } - if ( isset( $p_repo->info['standard_repo'] ) ) { - $t_branches = $p_repo->info['standard_repo']; - } ?> > @@ -157,7 +139,19 @@ > -/> +/> + +> + + + +> + + + +> + +/> info['svn_username'] = $f_svn_username; - $p_repo->info['svn_password'] = $f_svn_password; - $p_repo->info['websvn_url'] = $f_websvn_url; - $p_repo->info['websvn_name'] = $f_websvn_name; - $p_repo->info['websvn_path'] = $f_websvn_path; - $p_repo->info['standard_repo'] = $f_standard_repo; + $p_repo->info['svn_username'] = gpc_get_string( 'svn_username' ); + $p_repo->info['svn_password'] = gpc_get_string( 'svn_password' ); + $p_repo->info['websvn_url'] = gpc_get_string( 'websvn_url' ); + $p_repo->info['websvn_name'] = gpc_get_string( 'websvn_name' ); + $p_repo->info['websvn_path'] = gpc_get_string( 'websvn_path' ); + $p_repo->info['standard_repo'] = gpc_get_bool( 'standard_repo', false ); + $p_repo->info['trunk_path'] = gpc_get_string( 'trunk_path' ); + $p_repo->info['branch_path'] = gpc_get_string( 'branch_path' ); + $p_repo->info['ignore_paths'] = gpc_get_bool( 'ignore_paths', false ); return $p_repo; } @@ -291,6 +281,10 @@ $t_comments = ''; $t_count = 0; + $t_trunk_path = $p_repo->info['trunk_path']; + $t_branch_path = $p_repo->info['branch_path']; + $t_ignore_paths = $p_repo->info['ignore_paths']; + foreach( $p_svnlog as $t_line ) { # starting state, do nothing @@ -301,7 +295,7 @@ # Changeset info } elseif ( 1 == $t_state && preg_match( '/^r([0-9]+) \| ([^|]+) \| ([0-9\-]+) ([0-9:]+)/', $t_line, $t_matches ) ) { - if ( !is_null( $t_changeset ) ) { + if ( !is_null( $t_changeset ) && !is_blank( $t_changeset->branch ) ) { $t_changeset->save(); $t_changesets[] = $t_changeset; } @@ -339,7 +333,16 @@ } } } else { - if ( preg_match( '/\/([^\/]+)/', $t_file->filename, $t_matches ) ) { + # Look for non-standard trunk path + if ( !is_blank( $t_trunk_path ) && preg_match( '@^' . $t_trunk_path . '@i', $t_file->filename ) ) { + $t_changeset->branch = 'trunk'; + + # Look for non-standard branch path + } else if ( !is_blank( $t_branch_path ) && preg_match( '@^' . $t_branch_path . '([^\/]+)@i', $t_file->filename, $t_matches ) ) { + $t_changeset->branch = $t_matches[1]; + + # Fall back to just using the root folder as the branch name + } else if ( !$t_ignore_paths && preg_match( '/\/([^\/]+)/', $t_file->filename, $t_matches ) ) { $t_changeset->branch = $t_matches[1]; } } @@ -365,7 +368,7 @@ } } - if ( !is_null( $t_changeset ) ) { + if ( !is_null( $t_changeset ) && !is_blank( $t_changeset->branch ) ) { $t_changeset->save(); $t_changesets[] = $t_changeset; } diff --git a/SourceWebSVN/lang/strings_english.txt b/SourceWebSVN/lang/strings_english.txt index 9889d54..d32e2be 100644 --- a/SourceWebSVN/lang/strings_english.txt +++ b/SourceWebSVN/lang/strings_english.txt @@ -22,6 +22,9 @@ $s_plugin_SourceWebSVN_websvn_name = 'WebSVN Name
(Repository directory)'; $s_plugin_SourceWebSVN_websvn_path = 'WebSVN Path
(From repository root)'; $s_plugin_SourceWebSVN_standard_repo = 'Standard Repository
(trunk/branches/tags)'; +$s_plugin_SourceWebSVN_trunk_path = 'Trunk Path
(Non-standard repository)'; +$s_plugin_SourceWebSVN_branch_path = 'Branch Path
(Non-standard repository)'; +$s_plugin_SourceWebSVN_ignore_paths = 'Ignore Other Paths
(Non-standard repository)'; $s_plugin_SourceWebSVN_configuration = 'Configuration'; $s_plugin_SourceWebSVN_update = 'Configuration';