Patch to allow SourceStamps to be updated from an "original"
SourceStamp (based on a set of Changes) to a "specific"
SourceStamp (with an explicit revision).  Default functionality of
BuildStatus.getSourceStamp() is not altered.
Index: statusgrid/buildbot/interfaces.py
===================================================================
--- statusgrid.orig/buildbot/interfaces.py	2007-07-27 16:59:29.580875956 -0500
+++ statusgrid/buildbot/interfaces.py	2007-07-27 16:59:37.704660129 -0500
@@ -98,6 +98,10 @@
         BuildRequests. This is called by a Build when it starts, to figure
         out what its sourceStamp should be."""
 
+    def getUpdatedSourceStamp(self, got_revision):
+        """Get a new SourceStamp object reflecting the actual revision found
+        by a Source step."""
+
     def getText(self):
         """Returns a list of strings to describe the stamp. These are
         intended to be displayed in a narrow column. If more space is
@@ -346,7 +350,11 @@
 
     def getSourceStamp():
         """Return a SourceStamp object which can be used to re-create
-        the source tree that this build used.
+        the source tree that this build used.  This method will
+        return the most specific information possible, and its results
+        may change as the build progresses.  Specifically, a "HEAD"
+        build may later be more accurately specified with the specific
+        revision information.
 
         This method will return None if the source information is no longer
         available."""
Index: statusgrid/buildbot/sourcestamp.py
===================================================================
--- statusgrid.orig/buildbot/sourcestamp.py	2007-07-27 16:59:29.616875000 -0500
+++ statusgrid/buildbot/sourcestamp.py	2007-07-27 16:59:37.704660129 -0500
@@ -80,6 +80,9 @@
                                 changes=changes)
         return newsource
 
+    def getUpdatedSourceStamp(self, got_revision):
+        return SourceStamp(branch=self.branch, revision=got_revision, patch=self.patch)
+
     def getText(self):
         # XXX this won't work for VC's with huge 'revision' strings
         if self.revision is None: return [ "latest" ]
Index: statusgrid/buildbot/status/builder.py
===================================================================
--- statusgrid.orig/buildbot/status/builder.py	2007-07-27 16:59:29.608875212 -0500
+++ statusgrid/buildbot/status/builder.py	2007-07-27 16:59:37.704660129 -0500
@@ -951,8 +951,10 @@
             return None
         return self.builder.getBuild(self.number-1)
 
-    def getSourceStamp(self):
-        return self.source
+    def getSourceStamp(self, specific=False):
+        if not specific or not self.properties.has_key('got_revision'):
+            return self.source
+        return self.source.getUpdatedSourceStamp(self.properties['got_revision'])
 
     def getReason(self):
         return self.reason
Index: statusgrid/buildbot/process/builder.py
===================================================================
--- statusgrid.orig/buildbot/process/builder.py	2007-07-27 16:59:29.604875319 -0500
+++ statusgrid/buildbot/process/builder.py	2007-07-27 16:59:38.328643547 -0500
@@ -672,9 +672,7 @@
             return
 
         # get a source stamp, possibly more specific than the original
-        ss = bs.getSourceStamp()
-        changes = bs.getChanges()
-        ss = sourcestamp.SourceStamp(ss.branch, ss.revision, ss.patch, changes)
+        ss = bs.getSourceStamp(specific=True)
 
         req = base.BuildRequest(reason, ss, self.original.name)
         self.requestBuild(req)

