diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..6b49f1d --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,116 @@ + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..a564352 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shopify_python/git_utils.py b/shopify_python/git_utils.py index ce4b122..586df04 100644 --- a/shopify_python/git_utils.py +++ b/shopify_python/git_utils.py @@ -51,7 +51,6 @@ def _file_is_python(path): def changed_python_files_in_tree(root_path): # type: (str) -> typing.List[str] - git_repo = repo.Repo(root_path) remote_master = _remote_origin_master(git_repo) modified = _modified_in_branch(git_repo, remote_master) @@ -60,6 +59,20 @@ def changed_python_files_in_tree(root_path): if os.path.exists(abs_mod) and os.path.isfile(abs_mod) and _file_is_python(abs_mod)] +def uncommitted_python_files(root_path): + # type: (str) -> typing.FrozenSet[str] + git_repo = repo.Repo(root_path) + unstaged_files = [file.a_path for file in git_repo.index.diff(None) if _file_is_python(file.a_path)] + staged_files = [file.a_path for file in git_repo.index.diff('HEAD') if _file_is_python(file.a_path)] + return frozenset(unstaged_files + staged_files) + + +def untracked_python_files(root_path): + # type: (str) -> typing.List[str] + git_repo = repo.Repo(root_path) + return [item for item in git_repo.untracked_files if _file_is_python(item)] + + # Options are defined here: https://pypi.python.org/pypi/autopep8#usage _AutopepOptions = typing.NamedTuple('_AutopepOptions', [ # pylint: disable=global-variable,invalid-name ('aggressive', int),