[Buildbot-commits] buildbot/buildbot/scripts tryclient.py, 1.19, 1.20
Brian Warner
warner at users.sourceforge.net
Thu Nov 22 01:04:36 UTC 2007
Update of /cvsroot/buildbot/buildbot/buildbot/scripts
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32481/buildbot/scripts
Modified Files:
tryclient.py
Log Message:
[project @ improve Git support, plus docs and tests. Thanks to Haavard Skinnemoen for the amazing patch. Closes #130.]
Original author: warner at lothar.com
Date: 2007-11-22 01:03:37+00:00
Index: tryclient.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/scripts/tryclient.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- tryclient.py 6 Feb 2007 20:36:09 -0000 1.19
+++ tryclient.py 22 Nov 2007 01:04:34 -0000 1.20
@@ -203,6 +203,32 @@
d.addCallback(self.readPatch, self.patchlevel)
return d
+class GitExtractor(SourceStampExtractor):
+ patchlevel = 1
+ vcexe = "git"
+
+ def getBaseRevision(self):
+ d = self.dovc(["branch", "--no-color", "-v", "--no-abbrev"])
+ d.addCallback(self.parseStatus)
+ return d
+
+ def parseStatus(self, res):
+ # The current branch is marked by '*' at the start of the
+ # line, followed by the branch name and the SHA1.
+ #
+ # Branch names may contain pretty much anything but whitespace.
+ m = re.search(r'^\* (\S+)\s+([0-9a-f]{40})', res, re.MULTILINE)
+ if m:
+ self.branch = m.group(1)
+ self.baserev = m.group(2)
+ return
+ raise IndexError("Could not find current GIT branch: %s" % res)
+
+ def getPatch(self, res):
+ d = self.dovc(["diff", self.baserev])
+ d.addCallback(self.readPatch, self.patchlevel)
+ return d
+
def getSourceStamp(vctype, treetop, branch=None):
if vctype == "cvs":
e = CVSExtractor(treetop, branch)
@@ -218,6 +244,8 @@
e = MercurialExtractor(treetop, branch)
elif vctype == "darcs":
e = DarcsExtractor(treetop, branch)
+ elif vctype == "git":
+ e = GitExtractor(treetop, branch)
else:
raise KeyError("unknown vctype '%s'" % vctype)
return e.get()
More information about the Commits
mailing list