changeset 170:274d7dc787e3

the rest of the metadata for gitpoller
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 31 Jan 2011 18:26:35 -0800
parents 8e656a659ffa
children af76bbcc4457
files autobot/changes/poller.py
diffstat 1 files changed, 48 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/autobot/changes/poller.py	Mon Jan 31 18:22:01 2011 -0800
+++ b/autobot/changes/poller.py	Mon Jan 31 18:26:35 2011 -0800
@@ -464,3 +464,51 @@
         return self.commitInfo['timestamp'] # for tests
 
     ### commit author ('name')
+
+    def _get_commit_name(self, rev):
+        args = ['log', rev, '--no-walk', r'--format=%aE']
+        d = utils.getProcessOutput(self.binary, args, path=self.workdir,
+                                   env=dict(PATH=os.environ['PATH']),
+                                   errortoo=False )
+        d.addCallback(self._get_commit_name_from_output)
+        return d
+
+    def _get_commit_name_from_output(self, output):
+        stripped_output = output.strip()
+        if len(stripped_output) == 0:
+            raise EnvironmentError('could not get commit name for rev')
+        self.commitInfo['name'] = stripped_output
+        return self.commitInfo['name'] # for tests
+
+    ### files
+
+    def _get_commit_files(self, rev):
+        args = ['log', rev, '--name-only', '--no-walk', r'--format=%n']
+        d = utils.getProcessOutput(self.binary, args, path=self.workdir,
+                                   env=dict(PATH=os.environ['PATH']),
+                                   errortoo=False )
+        d.addCallback(self._get_commit_files_from_output)
+        return d
+
+    def _get_commit_files_from_output(self, output):
+        fileList = output.split()
+        self.commitInfo['files'] = fileList
+        return self.commitInfo['files'] # for tests
+
+
+    ### comments
+
+    def _get_commit_comments(self, rev):
+        args = ['log', rev, '--no-walk', r'--format=%s%n%b']
+        d = utils.getProcessOutput(self.binary, args, path=self.workdir,
+                                   env=dict(PATH=os.environ['PATH']),
+                                   errortoo=False )
+        d.addCallback(self._get_commit_comments_from_output)
+        return d
+
+    def _get_commit_comments_from_output(self, output):
+        stripped_output = output.strip()
+        if len(stripped_output) == 0:
+            raise EnvironmentError('could not get commit comment for rev')
+        self.commitInfo['comments'] = stripped_output
+        return self.commitInfo['comments'] # for tests