- Old mechanism used a function that first retrieved all commits reachable by the revision to find a single date then created a commit object only to retrieve the commit date - Instead we limit the git query to return only one commit date and avoid a whole lot of wasted cycles Signed-off-by: Mitchell Joblin <mitchell.joblin.ext@xxxxxxxxxxx> --- codeface/VCS.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/codeface/VCS.py b/codeface/VCS.py index 2502c16..76ab290 100644 --- a/codeface/VCS.py +++ b/codeface/VCS.py @@ -122,7 +122,7 @@ class VCS: return self._rev_end_date def getCommitDate(self, rev): - return self._getCommitDate(rev) + return self._getRevDate(rev) def getFileCommitDict(self): return self._fileCommit_dict @@ -199,6 +199,12 @@ class gitVCS (VCS): # and regular/patience diff. return 4 + def _getRevDate(self, rev): + cmd_base = 'git --git-dir={0} log --no-merges --format=%ct -1'.format(self.repo).split() + cmd = cmd_base + [rev] + date = execute_command(cmd) + return(date) + def _prepareCommitLists(self): """Gets the hash values (or whatever is used to identify a commit) and log messages (plus some other metadata, but @@ -307,15 +313,6 @@ class gitVCS (VCS): # and extract the desired subrange return clist - def _getCommitDate(self, rev): - ''' - Return the date of the commit specified by the revision rev - without inserting the commit in any global listings/ - ''' - logmsg = self._getCommitIDsLL((), rev_range=rev, sort=False) - cmt = self._Logstring2Commit(logmsg[0]) - return cmt.cdate - def _getSingleCommitInfo(self, cmtHash): #produces the git log output for a single commit hash -- 1.9.1