[Bps-public-commit] Test-Chimps-Client branch, master, updated. ff6e85ca3dec69033ef2d3502dba68d4cfa66b0a

Ruslan Zakirov ruz at bestpractical.com
Tue May 26 12:28:41 EDT 2009


The branch, master has been updated
       via  ff6e85ca3dec69033ef2d3502dba68d4cfa66b0a (commit)
       via  7284fb6e48fafca52e9b8767aa836907fd6f4792 (commit)
       via  7f6a1dd2f9bcd8987e3ef7457dfd80ee0650fe92 (commit)
       via  eb0dbcec3189c590a14f79ce27394f616e44d0ed (commit)
      from  8ca639cc3ec198e6bf90ee91e426211bb8997edd (commit)

Summary of changes:
 lib/Test/Chimps/Smoker/Git.pm    |   31 ++++++++++++++++++++++++-------
 lib/Test/Chimps/Smoker/SVN.pm    |    5 +----
 lib/Test/Chimps/Smoker/Source.pm |    8 ++++++++
 3 files changed, 33 insertions(+), 11 deletions(-)

- Log -----------------------------------------------------------------
commit eb0dbcec3189c590a14f79ce27394f616e44d0ed
Author: Ruslan Zakirov <Ruslan.Zakirov at gmail.com>
Date:   Tue May 26 20:24:33 2009 +0400

    * get rid of loops on git repositories with merges
    
    in case of the following topology:
       H
    B1   B2
       R
    `git log B1..H` always has B2 when `git log B2..H` always has B1
    we end up in a loop. let's use date of the current revision to
    to cut of anything older. In this case some commits in branches
    wouldn't be tested

diff --git a/lib/Test/Chimps/Smoker/Git.pm b/lib/Test/Chimps/Smoker/Git.pm
index c81e791..2b1fefd 100644
--- a/lib/Test/Chimps/Smoker/Git.pm
+++ b/lib/Test/Chimps/Smoker/Git.pm
@@ -8,8 +8,19 @@ __PACKAGE__->mk_ro_accessors(qw/uri/);
 sub revision_after {
     my $self = shift;
     my $revision = shift;
-
-    my $cmd = "git log --reverse $revision..origin";
+    
+# in case of the following topology:
+#    H
+# B1   B2
+#    R
+# `git log B1..H` always has B2 when `git log B2..H` always has B1
+# we end up in a loop. let's use date of the current revision to
+# to cut of anything older. In this case some commits in branches
+# wouldn't be tested
+    my $cmd = 'git log -n1 '. $revision;
+    my ($date) = (`$cmd` =~ m/^date:\s*(.*)$/im);
+
+    $cmd = "git log --reverse --since='$date' $revision..origin";
     my ($next)  = (`$cmd` =~ m/^commit\s+([a-f0-9]+)$/im);
 
     return $next;

commit 7f6a1dd2f9bcd8987e3ef7457dfd80ee0650fe92
Author: Ruslan Zakirov <Ruslan.Zakirov at gmail.com>
Date:   Tue May 26 20:25:41 2009 +0400

    * git doesn't like to be in a dir that doesn't exist

diff --git a/lib/Test/Chimps/Smoker/Git.pm b/lib/Test/Chimps/Smoker/Git.pm
index 2b1fefd..9cb3f1f 100644
--- a/lib/Test/Chimps/Smoker/Git.pm
+++ b/lib/Test/Chimps/Smoker/Git.pm
@@ -42,10 +42,11 @@ sub clone {
 # XXX: git 1.5 can not clone into dir that already exists, so we delete dir
 # and clone then
     my $dir = $self->directory;
+    chdir '..' or die "Couldn't change dir to parent of $dir: $!";
     rmdir $dir
         or die "Couldn't remove '$dir' that should be empty tmp dir created for clone: $!";
-    system( qw(git clone), $self->uri, $dir ) == 0
-        or die "couldn't clone ". $self->uri .": $!";
+    $self->run_cmd( qw(clone), $self->uri, $dir );
+    chdir $dir or die "Couldn't change dir to $dir: $!";
 
     return 1;
 }

commit 7284fb6e48fafca52e9b8767aa836907fd6f4792
Author: Ruslan Zakirov <Ruslan.Zakirov at gmail.com>
Date:   Tue May 26 20:27:19 2009 +0400

    * move run_cmd into super class, switch Git.pm

diff --git a/lib/Test/Chimps/Smoker/Git.pm b/lib/Test/Chimps/Smoker/Git.pm
index 9cb3f1f..a5a5fb5 100644
--- a/lib/Test/Chimps/Smoker/Git.pm
+++ b/lib/Test/Chimps/Smoker/Git.pm
@@ -53,15 +53,15 @@ sub clone {
 
 sub clean {
     my $self = shift;
-    system qw(git clean -fd);
-    system qw(git checkout master);
+    $self->run_cmd(qw(clean -fd));
+    $self->run_cmd(qw(checkout master));
 }
 
 sub checkout {
     my $self = shift;
     my %args = @_;
 
-    system qw(git checkout), ($args{'revision'} || 'master');
+    $self->run_cmd(qw(checkout), ($args{'revision'} || 'master'));
 }
 
 sub next {
@@ -75,4 +75,9 @@ sub next {
     return (revision => $revision, committer => $committer);
 }
 
+sub run_cmd {
+    my $self = shift;
+    return $self->SUPER::run_cmd( "git", @_ );
+}
+
 1;
diff --git a/lib/Test/Chimps/Smoker/Source.pm b/lib/Test/Chimps/Smoker/Source.pm
index dcc45f4..2231bd4 100644
--- a/lib/Test/Chimps/Smoker/Source.pm
+++ b/lib/Test/Chimps/Smoker/Source.pm
@@ -31,4 +31,12 @@ sub clean { return 1 }
 
 sub next { return () }
 
+sub run_cmd {
+    my $self = shift;
+    my @args = @_;
+    system(@args) == 0
+        or die "Couldn't run `". join(' ', @args ) ."`: $!";
+    return 1;
+}
+
 1;

commit ff6e85ca3dec69033ef2d3502dba68d4cfa66b0a
Author: Ruslan Zakirov <Ruslan.Zakirov at gmail.com>
Date:   Tue May 26 20:28:13 2009 +0400

    * use run_cmd from base class in SVN.pm

diff --git a/lib/Test/Chimps/Smoker/SVN.pm b/lib/Test/Chimps/Smoker/SVN.pm
index 3b47264..f5ebc0e 100644
--- a/lib/Test/Chimps/Smoker/SVN.pm
+++ b/lib/Test/Chimps/Smoker/SVN.pm
@@ -54,10 +54,7 @@ sub next {
 
 sub run_cmd {
     my $self = shift;
-    my @args = @_;
-    system("svn", @args) == 0
-        or die "Couldn't run `". join(' ', "svn", @args ) ."`: $!";
-    return 1;
+    return $self->SUPER::run_cmd( "svn", @_ );
 }
 
 1;

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list