Skip to content

Commit 5156274

Browse files
committed
Add .git-blame-ignore-revs for Black commit & add to Nox setup
1 parent c173ccc commit 5156274

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Blacken scripts
2+
3+
9e75d1834b30a486e6b8d0a011be43b587e8cd2d

noxfile.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
REPO_URL_HTTPS = "https://github.com/{user}/{repo}.git"
2727
REPO_URL_SSH = "git@github.com:{user}/{repo}.git"
2828

29+
IGNORE_REVS_FILE = ".git-blame-ignore-revs"
30+
2931
CANARY_COMMAND = ("sphinx-build", "--version")
3032
BUILD_INVOCATION = ("python", "-m", "sphinx")
3133
SOURCE_DIR = Path("doc").resolve()
@@ -307,12 +309,39 @@ def setup_remotes(session):
307309
session.notify("_execute", posargs=([_setup_remotes], *session.posargs))
308310

309311

312+
def _ignore_revs(session):
313+
"""Configure the Git ignore revs file to the repo default."""
314+
if not IGNORE_REVS_FILE:
315+
return
316+
session.run(
317+
"git",
318+
"config",
319+
"blame.ignoreRevsFile",
320+
IGNORE_REVS_FILE,
321+
external=True,
322+
)
323+
324+
325+
@nox.session(name="ignore-revs")
326+
def ignore_revs(session):
327+
"""Configure Git to ignore noisy revisions."""
328+
_ignore_revs(session)
329+
330+
310331
@nox.session()
311332
def setup(session):
312333
"""Set up the project; pass --https or --ssh to specify Git URL type."""
313334
session.notify(
314335
"_execute",
315-
posargs=([_setup_remotes, _install_hooks, _clean], *session.posargs),
336+
posargs=(
337+
[
338+
_ignore_revs,
339+
_setup_remotes,
340+
_install_hooks,
341+
_clean,
342+
],
343+
*session.posargs,
344+
),
316345
)
317346

318347

0 commit comments

Comments
 (0)