diff --git a/SourceWebSVN/SourceWebSVN.php b/SourceWebSVN/SourceWebSVN.php index 164a227..b7a051c 100644 --- a/SourceWebSVN/SourceWebSVN.php +++ b/SourceWebSVN/SourceWebSVN.php @@ -218,9 +218,21 @@ $t_url = $p_repo->url; $t_rev = ( false === $t_db_revision ? 0 : $t_db_revision + 1 ); - $t_svnlog = explode( "\n", shell_exec( "$svn log -v -r $t_rev:HEAD --limit 200 $t_url" ) ); - return $this->process_svn_log( $p_repo, $t_svnlog ); + while( true ) { + $t_svnlog = explode( "\n", shell_exec( "$svn log -v -r $t_rev:HEAD --limit 200 $t_url" ) ); + + $t_changesets = $this->process_svn_log( $p_repo, $t_svnlog ); + + # if an array is returned, processing is done + if ( is_array( $t_changesets ) ) { + return $t_changesets; + + # if a number is returned, repeat from given revision + } else if ( is_numeric( $t_changesets ) ) { + $t_rev = $t_changesets; + } + } } function import_latest( $p_event, $p_repo ) { @@ -292,6 +304,8 @@ $t_tag_path = $p_repo->info['tag_path']; $t_ignore_paths = $p_repo->info['ignore_paths']; + $t_discarded = false; + foreach( $p_svnlog as $t_line ) { # starting state, do nothing @@ -302,9 +316,13 @@ # Changeset info } elseif ( 1 == $t_state && preg_match( '/^r([0-9]+) \| ([^|]+) \| ([0-9\-]+) ([0-9:]+)/', $t_line, $t_matches ) ) { - if ( !is_null( $t_changeset ) && !is_blank( $t_changeset->branch ) ) { - $t_changeset->save(); - $t_changesets[] = $t_changeset; + if ( !is_null( $t_changeset ) ) { + if ( !is_blank( $t_changeset->branch ) ) { + $t_changeset->save(); + $t_changesets[] = $t_changeset; + } else { + $t_discarded = $t_changeset->revision; + } } $t_changeset = new SourceChangeset( $p_repo->id, $t_matches[1], '', $t_matches[3] . ' ' . $t_matches[4], $t_matches[2], '' ); @@ -355,6 +373,9 @@ # 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]; + + } else { + var_dump( "here $t_changeset->revision -- $t_file->filename
\n" ); } } } @@ -379,11 +400,19 @@ } } - if ( !is_null( $t_changeset ) && !is_blank( $t_changeset->branch ) ) { - $t_changeset->save(); - $t_changesets[] = $t_changeset; + if ( !is_null( $t_changeset ) ) { + if ( !is_blank( $t_changeset->branch ) ) { + $t_changeset->save(); + $t_changesets[] = $t_changeset; + } else { + $t_discarded = $t_changeset->revision; + } } - return $t_changesets; + if ( count( $t_changesets ) < 1 && $t_discarded !== false ) { + return $t_discarded; + } else { + return $t_changesets; + } } }