On Mon, Nov 17, 2014 at 9:35 PM, Wolfgang Mauerer <wm@xxxxxxxxxxxxxxxx> wrote: > > > Am 17/10/2014 21:10, schrieb Mitchell Joblin: >> - Ctags indexes the lines starting at 1 but our convention for >> the source layout starting at 0 >> >> Signed-off-by: Mitchell Joblin <mitchell.joblin.ext@xxxxxxxxxxx> >> --- >> codeface/VCS.py | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/codeface/VCS.py b/codeface/VCS.py >> index b16cc33..d918dd7 100644 >> --- a/codeface/VCS.py >> +++ b/codeface/VCS.py >> @@ -753,7 +753,7 @@ class gitVCS (VCS): >> #the lines we want to match start with a commit hash >> if(self.cmtHashPattern.match( line[0] ) ): >> >> - lineNum = line[2] >> + lineNum = str(int(line[2]) - 1) > this converts a string to and int and then back to a string > (which is understandable since you want to perform some > arithmetic)... >> commitHash = line[0] >> >> commitLineDict[lineNum] = commitHash >> @@ -986,7 +986,9 @@ class gitVCS (VCS): >> >> while(tags.next(entry)): >> if entry['kind'] in structures: >> - funcLines[int(entry['lineNumber'])] = entry['name'] >> + ## Ctags indexes starting at 1 >> + lineNum = int(entry['lineNumber']) - 1 > ... but then, it's converted back to int. So why not just keep int > in the first place? These line numbers are different variables that arise from different sources. The first one is from parsing the git blame output and the second one is from parsing the Ctags file output. Even if we avoid recasting to string in the first case (blame output) the output of the Ctags file is anyway still a string and therefore would still need to be casted to int. I don't see the relationship here. Maybe you thought these variables related but I don't see the relationship. Maybe I am missing something? --Mitchell > > Cheers, Wolfgang >> + funcLines[lineNum] = entry['name'] >> >> # clean up temporary files >> srcFile.close() >> >