Merge lp:~thumper/pqm/record-elapsed-time into lp:pqm
Proposed by
Tim Penhey
Status: | Merged | ||||
---|---|---|---|---|---|
Merge reported by: | Robert Collins | ||||
Merged at revision: | 179 | ||||
Proposed branch: | lp:~thumper/pqm/record-elapsed-time | ||||
Merge into: | lp:pqm | ||||
To merge this branch: | bzr merge lp:~thumper/pqm/record-elapsed-time | ||||
Related bugs: |
|
To post a comment you must log in.
I was only going to do merge and precommit hook, but it seemed better to do all of them.
I'm not entirely sure how to test this.
=== modified file 'pqm/__init__.py'
[" Sender not authorised to commit to branch %s"
% branch])
--- pqm/__init__.py 2007-11-29 21:40:54 +0000
+++ pqm/__init__.py 2008-06-16 02:49:46 +0000
@@ -21,6 +21,7 @@
import cgi
import config_manager
from copy import copy
+from datetime import datetime
import errno
import logging
import os
@@ -501,6 +502,12 @@
+ def _success_ output( self, command_name, start_time): '%c'), elapsed_time), '\n']
self. log_with_ status( logger, "cleaning working directory")
self. rm_rf(os. path.join( possible_ dir, top))
+ """The success output strings with current and elapsed time."""
+ elapsed_time = datetime.now() - start_time
+ return ['\n', '%s succeeded at %s (%s)' % (
+ command_name, time.strftime(
+
def cleanup_wd(self):
"""Cleans up all possible working dirs."""
@@ -516,6 +523,8 @@
def do_merge(self, from_repo_revision, to_repo_revision, merge_name, merge_method, line): getSender( )
self. check_target( to_repo_ revision, line)
os.chdir( origdir)
self. log_with_ status( logger, "success: %s", line)
self. successful. append( line) '%c')), '\n'] output( merge_name, start_time)
self. get_vcs( ).commit( sender, dir, self.commitmsg, to_repo_revision, config)
+ # Record the start time for elapsed time calculation.
+ start_time = datetime.now()
sender = self.script.
# Star-merge
@@ -543,7 +552,7 @@
- self.output += ['\n', '%s succeeded at %s' % (merge_name, time.strftime(
+ self.output += self._success_
def get_arch_ impl(self) :
logger. info("running precommit hook: %s" % (hook,))
self. output. extend( ['\n', 'Executing pre-commit hook %s at %s' % (hook, time.strftime( '%c')), '\n']) in_dir( self.dir, popen2.Popen4, hook)
self. output. append( '\npre- commit hook failed with error code %d at %s\n' % (ecode - 255, time.strftime( '%c')))
raise PQMCmdFailure( self.sender, self.successful, self.line, self.output) '%c')), '\n'] output( 'pre-commit hook', start_time)
@@ -862,6 +871,7 @@
if not hook:
hook = precommit_hook
if hook:
+ start_time = datetime.now()
child = self.run_
@@ -874,7 +884,7 @@
if not ((ecode is None) or (ecode == 0)):
- self.output += ['\n', 'pre-commit hook succeeded at %s' % (time.strftime(
+ self.output += self._success_
return self.successful, self.unrecognized, self.output
@@ -924,6 +934,7 @@
self. run_command( line)
self. patch_target, config = self.getBranchC onfig(self. patch_target)
self. set_current_ vcs(self. patch_target)
self. validate_ revision( self.patch_ target)
logger. info("executing patch")
for line in self.lines:
if self.patch_content != []:
+ start_time = datetime.now()
@@ -951,7 +962,7 @@
se...