Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] please add the number of code lines as a display option #133

Open
mcallegari opened this issue Dec 2, 2017 · 7 comments

Comments

@mcallegari
Copy link

mcallegari commented Dec 2, 2017

Hi, first of all congratulations for the very nice software !

I am playing around with it to create a video of the evolution of my project.
The number of files by language indication is neat, but I believe a powerful indication of a project effort is the number of lines of code. You could have 10 C++ files that changed over time from 1000 lines to 1000000 lines and Gource would not show it.

Having a look at the source code, I think for git you can easily achieve this by adding "--numstat" to the git log command. No idea how this can work on other VCSs.
Then you obviously need to parse the added/removed lines information, where git helps you with an output like this

3       0       engine/src/showrunner.cpp
24      2       engine/src/track.cpp
21      8       engine/src/track.h

What do you think ?

@mcallegari
Copy link
Author

mcallegari commented Dec 6, 2017

I went ahead and did it myself #136
Please test and review

image

@mcallegari
Copy link
Author

mcallegari commented Dec 7, 2017

It seems there's a way to achieve a nice line added/removed summary also on SVN.
Something like:

# svn diff -r21416:21414 | diffstat -f 0
 aaa.c |   10         4 +     6 -     0 !
 bbb.c |   71         53 +    18 -    0 !
 ccc.h |    2         1 +     1 -     0 !
 3 files changed, 58 insertions(+), 25 deletions(-)

However, from the source code I see SVN works with an XML output and the above command should be performed for each single commit, which will be very slow. It also requires diffstat to be installed.
Any insight from @acaudwell ?

@acaudwell
Copy link
Owner

Hi. First of all nice idea. Thanks for contributing the code. I don't think I was aware it was easy to get this information from git.

It looks like it's probably not very viable for SVN.

@acaudwell
Copy link
Owner

It could also maybe be a cool feature to have a +/-NUMLINES value appear next to the user and float upwards and fade out as they zap a file.

@mcallegari
Copy link
Author

mcallegari commented Dec 8, 2017

@acaudwell thanks for the comments.
SVN: alright, let's drop it. Should update the command line help with a 'git only' warning
+/- lines per user: cool but I don't think I have time for that. Just modify the commit method I've added here to
commit.addLines(file, added, removed);
So you can elaborate the delta later and still preserve added/removed for other usages.

Another thing I'd really love to see is an extension/language translation.
Right now there might be a lot of redundancy between extensions and languages.
For example in my project (screenshot above), qxf, qxi, qxmt and qxm are all XML files.

The idea is that Gource could include a map of the usual suspects extensions like:

c,C
cpp,C++
h,C headers
hpp,C++ headers
js,JavaScript
xml,XML

and so on...

However, if the user provides a simple text file with comma separated translations, Gource will extend its internal map. For example (in my case)

qxf,XML
qxmt,XML
qxi,XML
qxm,XML

The command line option name could be
--extension-map FILE

What do you think ?
If you like the idea I might invest some time to implement it.

@acaudwell
Copy link
Owner

Yeah this would be useful.

Maybe implementation wise maybe it should just be a repeatable command line option and if you have a lot of them you can use a config file for that. That would be more consistent with the other options.

A way to set a file extension colour override in a similar way might also be useful.

@mcallegari
Copy link
Author

Since it had a minimum impact on the code, I've added another option --key-threshold, to show extensions only when they reach the specified number of files.
This helps to keep the summary tidy when a project has a number of "not interesting" extensions with just one file (e.g. .md, .txt, .gitignore, etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants