Skip to content

Commit

Permalink
bump version, merge pull request #58 from casperdcl/devel
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl authored Jul 31, 2021
2 parents 222f8de + 08447a4 commit 4e6a091
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 62 deletions.
28 changes: 6 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,35 +116,19 @@ jobs:
echo ::set-output name=docker_tags::devel
echo ::set-output name=snap_channel::edge
fi
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD > _CHANGES.md
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
id: create_release
uses: actions/create-release@v1
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: git-fame ${{ github.ref }} stable
name: git-fame ${{ steps.collect_assets.outputs.tag }} stable
body_path: _CHANGES.md
draft: true
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/${{ steps.dist.outputs.whl }}
asset_name: ${{ steps.dist.outputs.whl }}
asset_content_type: application/zip
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/${{ steps.dist.outputs.whl_asc }}
asset_name: ${{ steps.dist.outputs.whl_asc }}
asset_content_type: text/plain
files: |
dist/${{ steps.dist.outputs.whl }}
dist/${{ steps.dist.outputs.whl_asc }}
- uses: snapcore/action-build@v1
id: snap_build
- if: github.event_name == 'push' && steps.collect_assets.outputs.snap_channel
Expand Down
23 changes: 5 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,17 @@
*.py[cod]

# C extensions
*.so
__pycache__/

# Packages
/gitfame/_dist_ver.py
/.eggs/
/*.egg-info
/*.egg*/
/build/
/dist/
/git-fame_*_amd64.snap
/.dockerignore

# Unit test / coverage reports
.tox/
.coverage
__pycache__/
/.tox/
/.coverage*
/coverage.xml
nosetests.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# PyCharm
.idea
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.0.1
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand Down Expand Up @@ -38,16 +38,16 @@ repos:
- tabulate
- tqdm
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
rev: 3.9.2
hooks:
- id: flake8
args: ['-j8']
args: [-j8]
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-debugger
- flake8-string-format
- repo: https://github.com/PyCQA/isort
rev: 5.7.0
rev: 5.9.2
hooks:
- id: isort
17 changes: 11 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,26 +202,31 @@ Documentation
May be multiple comma-separated values.
Alters `--loc` default to imply 'ins' (COCOMO) or
'ins,del' (hours).
-R, --recurse Recursively find repositories & submodules within <gitdir>.
-n, --no-regex Assume <f> are comma-separated exact matches
rather than regular expressions [default: False].
NB: if regex is enabled ',' is equivalent to '|'.
-s, --silent-progress Suppress `tqdm` [default: False].
--warn-binary Don't silently skip files which appear to be binary data
[default: False].
--warn-binary Don't silently skip files which appear to be binary data
[default: False].
-e, --show-email Show author email instead of name [default: False].
--enum Show row numbers [default: False].
--enum Show row numbers [default: False].
-t, --bytype Show stats per file extension [default: False].
-w, --ignore-whitespace Ignore whitespace when comparing the parent's
version and the child's to find where the lines
came from [default: False].
-M Detect intra-file line moves and copies [default: False].
-C Detect inter-file line moves and copies [default: False].
-M Detect intra-file line moves and copies [default: False].
-C Detect inter-file line moves and copies [default: False].
--ignore-rev=<rev> Ignore changes made by the given revision
(requires `--loc=surviving`).
--ignore-revs-file=<f> Ignore revisions listed in the given file
(requires `--loc=surviving`).
--format=<format> Table format
[default: pipe]|md|markdown|yaml|yml|json|csv|tsv|tabulate.
May require `git-fame[<format>]`, e.g. `pip install git-fame[yaml]`.
Any `tabulate.tabulate_formats` is also accepted.
--manpath=<path> Directory in which to install git-fame man pages.
--log=<lvl> FATAL|CRITICAL|ERROR|WARN(ING)|[default: INFO]|DEBUG|NOTSET.
--log=<lvl> FATAL|CRITICAL|ERROR|WARN(ING)|[default: INFO]|DEBUG|NOTSET.
If multiple user names and/or emails correspond to the same user, aggregate
Expand Down
11 changes: 7 additions & 4 deletions git-fame_completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ _git_fame()
prv="${COMP_WORDS[COMP_CWORD-1]}"
case ${COMP_CWORD} in
1)
COMPREPLY=($(compgen -W "fame" ${cur}))
COMPREPLY=($(compgen -W "fame" "${cur}"))
;;
*)
case ${prv} in
Expand All @@ -27,15 +27,18 @@ _git_fame()
--branch)
COMPREPLY=($(compgen -W "$(git branch | sed 's/*/ /')" -- ${cur}))
;;
--ignore-revs-file)
COMPREPLY=($(compgen -f -- "${cur}"))
;;
--manpath)
COMPREPLY=($(compgen -d -- ${cur}))
COMPREPLY=($(compgen -d -- "${cur}"))
;;
--incl|--excl|--since)
--incl|--excl|--since|--ignore-rev)
COMPREPLY=( )
;;
*)
if [ ${COMP_WORDS[1]} == fame ]; then
COMPREPLY=($(compgen -dW '-h --help -v --version --cost --branch --since --sort --loc --incl --excl -n --no-regex -s --silent-progress --warn-binary -t --bytype -w --ignore-whitespace -e --show-email --enum -M -C --format --manpath --log' -- ${cur}))
COMPREPLY=($(compgen -dW '-h --help -v --version --cost --branch --since --sort --loc --incl --excl -R --recurse -n --no-regex -s --silent-progress --warn-binary -t --bytype -w --ignore-whitespace -e --show-email --enum -M -C --ignore-rev --ignore-revs-file --format --manpath --log' -- ${cur}))
fi
;;
esac
Expand Down
47 changes: 39 additions & 8 deletions gitfame/_gitfame.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,31 @@
May be multiple comma-separated values.
Alters `--loc` default to imply 'ins' (COCOMO) or
'ins,del' (hours).
-R, --recurse Recursively find repositories & submodules within <gitdir>.
-n, --no-regex Assume <f> are comma-separated exact matches
rather than regular expressions [default: False].
NB: if regex is enabled ',' is equivalent to '|'.
-s, --silent-progress Suppress `tqdm` [default: False].
--warn-binary Don't silently skip files which appear to be binary data
[default: False].
--warn-binary Don't silently skip files which appear to be binary data
[default: False].
-e, --show-email Show author email instead of name [default: False].
--enum Show row numbers [default: False].
--enum Show row numbers [default: False].
-t, --bytype Show stats per file extension [default: False].
-w, --ignore-whitespace Ignore whitespace when comparing the parent's
version and the child's to find where the lines
came from [default: False].
-M Detect intra-file line moves and copies [default: False].
-C Detect inter-file line moves and copies [default: False].
-M Detect intra-file line moves and copies [default: False].
-C Detect inter-file line moves and copies [default: False].
--ignore-rev=<rev> Ignore changes made by the given revision
(requires `--loc=surviving`).
--ignore-revs-file=<f> Ignore revisions listed in the given file
(requires `--loc=surviving`).
--format=<format> Table format
[default: pipe]|md|markdown|yaml|yml|json|csv|tsv|tabulate.
May require `git-fame[<format>]`, e.g. `pip install git-fame[yaml]`.
Any `tabulate.tabulate_formats` is also accepted.
--manpath=<path> Directory in which to install git-fame man pages.
--log=<lvl> FATAL|CRITICAL|ERROR|WARN(ING)|[default: INFO]|DEBUG|NOTSET.
--log=<lvl> FATAL|CRITICAL|ERROR|WARN(ING)|[default: INFO]|DEBUG|NOTSET.
"""
from __future__ import division, print_function

Expand Down Expand Up @@ -223,7 +228,7 @@ def _get_auth_stats(
gitdir, branch="HEAD", since=None, include_files=None,
exclude_files=None, silent_progress=False, ignore_whitespace=False,
M=False, C=False, warn_binary=False, bytype=False, show_email=False,
prefix_gitdir=False, churn=None):
prefix_gitdir=False, churn=None, ignore_rev="", ignore_revs_file=None):
"""Returns dict: {"<author>": {"loc": int, "files": {}, "commits": int,
"ctimes": [int]}}"""
since = ["--since", since] if since else []
Expand All @@ -244,6 +249,10 @@ def _get_auth_stats(

if churn & CHURN_SLOC:
base_cmd = git_cmd + ["blame", "--line-porcelain"] + since
if ignore_rev:
base_cmd.extend(["--ignore-rev", ignore_rev])
if ignore_revs_file:
base_cmd.extend(["--ignore-revs-file", ignore_revs_file])
else:
base_cmd = git_cmd + ["log", "--format=aN%aN ct%ct", "--numstat"] + since

Expand Down Expand Up @@ -377,7 +386,28 @@ def run(args):

if isinstance(args.gitdir, string_types):
args.gitdir = [args.gitdir]
# strip `/`, `.git`
gitdirs = [i.rstrip(os.sep) for i in args.gitdir]
gitdirs = [path.join(*path.split(i)[:-1]) if path.split(i)[-1] == '.git' else i
for i in args.gitdir]
# remove duplicates
for i, d in reversed(list(enumerate(gitdirs))):
if d in gitdirs[:i]:
gitdirs.pop(i)
# recurse
if args.recurse:
nDirs = len(gitdirs)
i = 0
while i < nDirs:
if path.isdir(gitdirs[i]):
for root, dirs, fns in tqdm(os.walk(gitdirs[i]), desc="Recursing", unit="dir",
disable=args.silent_progress, leave=False):
if '.git' in fns + dirs:
if root not in gitdirs:
gitdirs.append(root)
if '.git' in dirs:
dirs.remove('.git')
i += 1

exclude_files = None
include_files = None
Expand Down Expand Up @@ -423,7 +453,8 @@ def run(args):
ignore_whitespace=args.ignore_whitespace, M=args.M, C=args.C,
warn_binary=args.warn_binary, bytype=args.bytype,
show_email=args.show_email, prefix_gitdir=len(gitdirs) > 1,
churn=churn)
churn=churn, ignore_rev=args.ignore_rev,
ignore_revs_file=args.ignore_revs_file)

# concurrent multi-repo processing
if len(gitdirs) > 1:
Expand Down

0 comments on commit 4e6a091

Please sign in to comment.