mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 16:24:40 +04:00
Use plumbum a bit better.
This commit is contained in:
parent
92aa55f44e
commit
7b1230df27
9 changed files with 44 additions and 44 deletions
|
|
@ -30,8 +30,8 @@ def _update_repository(repo_config, runner):
|
|||
repo = Repository.create(repo_config, runner.store)
|
||||
|
||||
with local.cwd(repo.repo_path_getter.repo_path):
|
||||
local['git']['fetch']()
|
||||
head_sha = local['git']['rev-parse', 'origin/master']().strip()
|
||||
local['git']('fetch')
|
||||
head_sha = local['git']('rev-parse', 'origin/master').strip()
|
||||
|
||||
# Don't bother trying to update if our sha is the same
|
||||
if head_sha == repo_config['sha']:
|
||||
|
|
|
|||
|
|
@ -49,21 +49,21 @@ def get_conflicted_files():
|
|||
# This will get the rest of the changes made after the merge.
|
||||
# If they resolved the merge conflict by choosing a mesh of both sides
|
||||
# this will also include the conflicted files
|
||||
tree_hash = local['git']['write-tree']().strip()
|
||||
merge_diff_filenames = local['git'][
|
||||
tree_hash = local['git']('write-tree').strip()
|
||||
merge_diff_filenames = local['git'](
|
||||
'diff', '-m', tree_hash, 'HEAD', 'MERGE_HEAD', '--name-only',
|
||||
]().splitlines()
|
||||
).splitlines()
|
||||
return set(merge_conflict_filenames) | set(merge_diff_filenames)
|
||||
|
||||
|
||||
@memoize_by_cwd
|
||||
def get_staged_files():
|
||||
return local['git']['diff', '--staged', '--name-only']().splitlines()
|
||||
return local['git']('diff', '--staged', '--name-only').splitlines()
|
||||
|
||||
|
||||
@memoize_by_cwd
|
||||
def get_all_files():
|
||||
return local['git']['ls-files']().splitlines()
|
||||
return local['git']('ls-files').splitlines()
|
||||
|
||||
|
||||
def get_files_matching(all_file_list_strategy):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue