Merge pull request #493 from pre-commit/encode_version_language_local_hooks

Encode the 'local hooks repo' version into the store
This commit is contained in:
Anthony Sottile
2017-02-16 16:50:10 -05:00
committed by GitHub
2 changed files with 4 additions and 1 deletions

View File

@@ -17,6 +17,8 @@ YAML_DUMP_KWARGS = {
# Bump when installation changes in a backwards / forwards incompatible way
INSTALLED_STATE_VERSION = '1'
# Bump when modifying `empty_template`
LOCAL_REPO_VERSION = '1'
VERSION = pkg_resources.get_distribution('pre-commit').version
VERSION_PARSED = pkg_resources.parse_version(VERSION)

View File

@@ -9,6 +9,7 @@ import tempfile
from cached_property import cached_property
import pre_commit.constants as C
from pre_commit.prefixed_command_runner import PrefixedCommandRunner
from pre_commit.util import clean_path_on_failure
from pre_commit.util import cmd_output
@@ -129,7 +130,7 @@ class Store(object):
def make_local_strategy(directory):
copy_tree_to_path(resource_filename('empty_template'), directory)
return self._new_repo(
'local:{}'.format(','.join(sorted(deps))), 'N/A',
'local:{}'.format(','.join(sorted(deps))), C.LOCAL_REPO_VERSION,
make_local_strategy,
)