tools: Added git_log.
This commit is contained in:
parent
4a02b26fb0
commit
c6250b2803
4 changed files with 18 additions and 4 deletions
|
|
@ -25,7 +25,7 @@ then to run:
|
|||
|
||||
Extensions | Tools
|
||||
---------- | -----
|
||||
.* | [contents](http://pygments.org/) • metadata • [git_blame](https://git-scm.com/)
|
||||
.* | [contents](http://pygments.org/) • metadata • [git_blame](https://git-scm.com/docs/git-blame) • [git_log](https://git-scm.com/docs/git-log)
|
||||
.py | [python_syntax](https://en.wikipedia.org/wiki/Python_syntax_and_semantics) • [python_unittests](https://docs.python.org/3/library/unittest.html) • [pydoc](https://docs.python.org/3/library/pydoc.html) • [mypy](http://www.mypy-lang.org/) • [python_coverage](http://nedbatchelder.com/code/coverage/) • [pycodestyle](https://pypi.python.org/pypi/pycodestyle) • [pyflakes](https://launchpad.net/pyflakes) • [pylint](http://www.pylint.org/) • [python_gut](https://github.com/ahamilton/vigil/blob/master/gut.py) • [python_modulefinder](https://docs.python.org/3/library/modulefinder.html) • [dis](https://docs.python.org/3/library/dis.html) • [python_mccabe](https://github.com/flintwork/mccabe) • [bandit](https://wiki.openstack.org/wiki/Security/Projects/Bandit)
|
||||
.pl .pm .t | [perl_syntax](https://en.wikipedia.org/wiki/Perl) • [perldoc](http://perldoc.perl.org/) • [perltidy](http://perltidy.sourceforge.net/)
|
||||
.pod .pod6 | [perldoc](http://perldoc.perl.org/)
|
||||
|
|
|
|||
1
TODO
1
TODO
|
|
@ -166,6 +166,7 @@ Done
|
|||
- Created a setup.py file.
|
||||
- Add cppcheck tool for C and C++.
|
||||
- Add shellcheck tool for shell scripts.
|
||||
- Add "git log <path>".
|
||||
|
||||
A-syntax, B-tests, C-auto docs, D-lint, E-coverage, F-profile, G-tidy, H-import deps
|
||||
A B C D E F G H
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ then to run:
|
|||
|
||||
Extensions | Tools
|
||||
---------- | -----""")
|
||||
all_tools = ([(["*"], tools.generic_tools() + [tools.git_blame])] +
|
||||
all_tools = ([(["*"], tools.generic_tools() +
|
||||
[tools.git_blame, tools.git_log])] +
|
||||
tools.TOOLS_FOR_EXTENSIONS)
|
||||
for extensions, tools_ in all_tools:
|
||||
print("%s | %s" % (" ".join("." + extension for extension in extensions),
|
||||
|
|
|
|||
|
|
@ -680,7 +680,8 @@ def shellcheck(path):
|
|||
return _run_command(["shellcheck", path])
|
||||
|
||||
|
||||
@deps(deps={"git"}, url="git", executables={"git"})
|
||||
@deps(deps={"git"}, url="https://git-scm.com/docs/git-blame",
|
||||
executables={"git"})
|
||||
def git_blame(path): # FIX: Add to tools_test.py
|
||||
stdout, stderr, returncode = _do_command(
|
||||
["git", "blame", "--show-stats", "--date=short", path])
|
||||
|
|
@ -690,6 +691,16 @@ def git_blame(path): # FIX: Add to tools_test.py
|
|||
return Status.not_applicable, fill3.Text("")
|
||||
|
||||
|
||||
@deps(deps={"git"}, url="https://git-scm.com/docs/git-log",
|
||||
executables={"git"})
|
||||
def git_log(path):
|
||||
stdout, stderr, returncode = _do_command(["git", "log", "--stat", path])
|
||||
if returncode == 0:
|
||||
return Status.normal, fill3.Text(stdout)
|
||||
else:
|
||||
return Status.not_applicable, fill3.Text("")
|
||||
|
||||
|
||||
#############################
|
||||
|
||||
|
||||
|
|
@ -852,6 +863,7 @@ def _tools_for_extension():
|
|||
def tools_all():
|
||||
tools_ = set(generic_tools())
|
||||
tools_.add(git_blame)
|
||||
tools_.add(git_log)
|
||||
for tool_list in _tools_for_extension().values():
|
||||
tools_.update(set(tool_list))
|
||||
return tools_
|
||||
|
|
@ -881,7 +893,7 @@ def splitext(path):
|
|||
|
||||
|
||||
def tools_for_path(path):
|
||||
git_tools = [git_blame] if os.path.exists(".git") else []
|
||||
git_tools = [git_blame, git_log] if os.path.exists(".git") else []
|
||||
root, ext = splitext(path)
|
||||
extra_tools = [] if ext == "" else _tools_for_extension().get(ext[1:], [])
|
||||
return generic_tools() + git_tools + extra_tools
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue