On Mon, Aug 4, 2014 at 1:38 AM, Wolfgang Mauerer <wm@xxxxxxxxxxxxxxxx> wrote: > Hi Mitchell, > > On 02/08/2014 12:42, Mitchell Joblin wrote: > > - We need the start and end date for limiting the history for the > > git blame analysis > > > > - In the old approach there is a case where no cmt list exists > > and then the retrieval fails, it also wastefully looped through > > the whole list of commits > > > > - We now retrieve the dates immediately after finding and sorting > > the dates for all commits and thus avoid looping though the > could you add a comment to the code that we rely on the > commits being sorted time-wise from the preparatory code > (and add a hint as to where this is done)? This assumption is not > required in the old version (by looping over all commits), but > is in your approach. > There is already a comment in the code that says the following code relies on the commits being sorted (see below: "# relies on sorting of commits based on commit date"). The sorting is also performed in the same function just a few lines out of the diff context. Is this sufficient? Kind regards, Mitchell > > Thanks, Wolfgang > > > entire commit list again and simultaneously fixing the emtpy > > commit list issue > > > > Signed-off-by: Mitchell Joblin <mitchell.joblin.ext@xxxxxxxxxxx> > > --- > > codeface/VCS.py | 19 ++++++++++++------- > > 1 file changed, 12 insertions(+), 7 deletions(-) > > > > diff --git a/codeface/VCS.py b/codeface/VCS.py > > index 25f91a5..81b2af3 100644 > > --- a/codeface/VCS.py > > +++ b/codeface/VCS.py > > @@ -80,7 +80,8 @@ class VCS: > > def __init__(self): > > # "None" represents HEAD for end and the inital > > # commit for start > > - self.rev_startDate = None; > > + self._rev_start_date = None; > > + self._rev_end_date = None; > > self.rev_start = None; > > self.rev_end = None; > > self.repo = None > > @@ -115,7 +116,10 @@ class VCS: > > return self._commit_dict > > > > def getRevStartDate(self): > > - return self.rev_startDate > > + return self._rev_start_date > > + > > + def getRevEndDate(self): > > + return self._rev_end_date > > > > def getCommitDate(self, rev): > > return self._getCommitDate(rev) > > @@ -393,6 +397,12 @@ class gitVCS (VCS): > > for cmt in self._commit_list_dict["__main__"]: > > self._commit_dict[cmt.id] = cmt > > > > + # Retrieve the dates for the first and last commits, > > + # relies on sorting of commits based on commit date > > + first_cmt = self._commit_list_dict["__main__"][0] > > + last_cmt = self._commit_list_dict["__main__"][-1] > > + self._rev_start_date = min(first_cmt.getCdate(), > last_cmt.getCdate()) > > + self._rev_end_date = max(first_cmt.getCdate(), > last_cmt.getCdate()) > > > > def _Logstring2ID(self, str): > > """Extract the commit ID from a log string.""" > > @@ -850,11 +860,6 @@ class gitVCS (VCS): > > #end for fnameList > > pbar.finish() > > > > - #find the date of earliest commit made for this revision > > - #Check if time zones influence this or its already normalized > > - self.rev_startDate = min( [cmt.getCdate() for cmt in > self._commit_dict.values()] ) > > - > > - > > #------------------------------- > > #capture old commits > > #------------------------------- > > > >