# HG changeset patch # User Jeff Hammel # Date 1296526921 28800 # Node ID 8e656a659ffadc32aba3b7a9de13ae23e0604d46 # Parent 8528311427e0d14af9bbb1c0780ab2dc760d31d6 timestamp diff -r 8528311427e0 -r 8e656a659ffa autobot/changes/poller.py --- a/autobot/changes/poller.py Mon Jan 31 18:18:38 2011 -0800 +++ b/autobot/changes/poller.py Mon Jan 31 18:22:01 2011 -0800 @@ -436,3 +436,31 @@ return changes.split() d.addCallback(split_changes) return d + + ### metadata for commits + + ### timestamp + + def _get_commit_timestamp(self, rev): + # unix timestamp + args = ['log', rev, '--no-walk', r'--format=%ct'] + d = utils.getProcessOutput(self.binary, args, path=self.workdir, + env=dict(PATH=os.environ['PATH']), + errortoo=False ) + d.addCallback(self._get_commit_timestamp_from_output) + return d + + def _get_commit_timestamp_from_output(self, output): + stripped_output = output.strip() + if self.usetimestamps: + try: + stamp = float(stripped_output) + except Exception, e: + self.log('caught exception converting output \'%s\' to timestamp' % stripped_output) + raise e + self.commitInfo['timestamp'] = stamp + else: + self.commitInfo['timestamp'] = None + return self.commitInfo['timestamp'] # for tests + + ### commit author ('name')