[SCM] build.samba.org - branch master updated

Jelmer Vernooij jelmer at samba.org
Fri Nov 12 12:16:16 MST 2010


The branch, master has been updated
       via  2bed1d2 More fixes, implement Build.__repr__.
      from  b5385e7 Provide stub get_previous_revision.

http://gitweb.samba.org/?p=build-farm.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 2bed1d2b6c98b303021497e312831053a1d9eb37
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Fri Nov 12 20:17:09 2010 +0100

    More fixes, implement Build.__repr__.

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

Summary of changes:
 buildfarm/data.py            |    8 +++++++-
 buildfarm/tests/test_data.py |    5 +++++
 import-and-analyse.py        |    2 +-
 3 files changed, 13 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 24e05d7..8c30b7e 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -177,6 +177,12 @@ class Build(object):
         self.compiler = compiler
         self.rev = rev
 
+    def __repr__(self):
+        if self.rev:
+            return "<%s: revision %s of %s on %s using %s>" % (self.__class__.__name__, self.rev, self.tree, self.host, self.compiler)
+        else:
+            return "<%s: %s on %s using %s>" % (self.__class__.__name__, self.tree, self.host, self.compiler)
+
     def remove(self):
         os.unlink(self.basename + ".log")
         if os.path.exists(self.basename+".err"):
@@ -460,7 +466,7 @@ class BuildResultStore(object):
         # $st->execute($tree, $rev, $commit, $host, $compiler, $checksum, $stat->ctime, $status_html)
 
     def get_previous_revision(self, tree, host, compiler, revision):
-        raise NoSuchBuildError(self):
+        raise NoSuchBuildError(tree, host, compiler, revision)
 
 """
     def get_previous_revision(self, tree, host, compiler, revision):
diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index 43451da..f89cfb1 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -47,6 +47,11 @@ class BuildResultStoreTestBase(object):
         self.assertFalse(os.path.exists(path))
         self.assertRaises(data.NoSuchBuildError, self.x.get_build, "tdb", "charis", "cc", "12")
 
+    def test_build_repr(self):
+        path = self.create_mock_logfile("tdb", "charis", "cc", "12")
+        build = self.x.get_build("tdb", "charis", "cc", "12")
+        self.assertEquals("<%s: revision 12 of tdb on charis using cc>" % build.__class__.__name__, repr(build))
+
     def test_build_age_mtime(self):
         path = self.create_mock_logfile("tdb", "charis", "cc", "12")
         # Set mtime to something in the past
diff --git a/import-and-analyse.py b/import-and-analyse.py
index 89dae0a..9431f56 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -94,7 +94,7 @@ for build in buildfarm.get_new_builds():
 
     try:
         prev_rev = buildfarm.builds.get_previous_revision(build.tree, build.host, build.compiler, rev)
-    except data.NoSuchBuild:
+    except data.NoSuchBuildError:
         # Can't send a nastygram until there are 2 builds..
         continue
     else:


-- 
build.samba.org


More information about the samba-cvs mailing list