summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGeorge Hartzell <hartzell@alerce.com>2017-10-25 05:30:22 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2017-10-25 14:30:22 +0200
commitb43064190c92bc3506b9c0fb7b4bff39d8535ff3 (patch)
tree5216055c5b6225f1e55a7802c82a62bec941aa70 /lib
parentd839012e00a1ae3f81f6e11a1e6d8e9cce9cc62e (diff)
downloadspack-b43064190c92bc3506b9c0fb7b4bff39d8535ff3.tar.gz
spack-b43064190c92bc3506b9c0fb7b4bff39d8535ff3.tar.bz2
spack-b43064190c92bc3506b9c0fb7b4bff39d8535ff3.tar.xz
spack-b43064190c92bc3506b9c0fb7b4bff39d8535ff3.zip
Specify base branch for flake8 comparison (#5796)
Internally we work against a branch named 'llnl/develop', which mirrors the public repository's `develop` branch. It's useful to be able to run flake8 on our changes, using `llnl/develop` as the base branch instead of `develop`. Internally the flake8 subcommand generates the list of changes files using a hardcoded range of `develop...`. This makes the base of that range a command line option, with a default of `develop`. That lets us do this: ``` spack flake8 --base llnl/develop ``` which uses a range of `llnl/develop...`.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/flake8.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/spack/spack/cmd/flake8.py b/lib/spack/spack/cmd/flake8.py
index 33f7a5e833..3cca2ec522 100644
--- a/lib/spack/spack/cmd/flake8.py
+++ b/lib/spack/spack/cmd/flake8.py
@@ -115,9 +115,11 @@ def changed_files(args):
git = which('git', required=True)
+ range = "{0}...".format(args.base)
+
git_args = [
# Add changed files committed since branching off of develop
- ['diff', '--name-only', '--diff-filter=ACMR', 'develop...'],
+ ['diff', '--name-only', '--diff-filter=ACMR', range],
# Add changed files that have been staged but not yet committed
['diff', '--name-only', '--diff-filter=ACMR', '--cached'],
# Add changed files that are unstaged
@@ -210,6 +212,9 @@ def filter_file(source, dest, output=False):
def setup_parser(subparser):
subparser.add_argument(
+ '-b', '--base', action='store', default='develop',
+ help="select base branch for collecting list of modified files")
+ subparser.add_argument(
'-k', '--keep-temp', action='store_true',
help="do not delete temporary directory where flake8 runs. "
"use for debugging, to see filtered files")