mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Local repositories clone a blank repo
This commit is contained in:
parent
e704edb5e2
commit
f000241dcb
15 changed files with 156 additions and 121 deletions
|
|
@ -15,8 +15,8 @@ from pre_commit.clientlib.validate_config import validate_config_extra
|
|||
from pre_commit.clientlib.validate_manifest import load_manifest
|
||||
from pre_commit.jsonschema_extensions import apply_defaults
|
||||
from pre_commit.util import cmd_output
|
||||
from pre_commit.util import copy_tree_to_path
|
||||
from pre_commit.util import cwd
|
||||
from testing.util import copy_tree_to_path
|
||||
from testing.util import get_head_sha
|
||||
from testing.util import get_resource_path
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import os.path
|
||||
import shutil
|
||||
|
||||
import jsonschema
|
||||
import pytest
|
||||
|
|
@ -20,24 +19,6 @@ def get_resource_path(path):
|
|||
return os.path.join(TESTING_DIR, 'resources', path)
|
||||
|
||||
|
||||
def copy_tree_to_path(src_dir, dest_dir):
|
||||
"""Copies all of the things inside src_dir to an already existing dest_dir.
|
||||
|
||||
This looks eerily similar to shutil.copytree, but copytree has no option
|
||||
for not creating dest_dir.
|
||||
"""
|
||||
names = os.listdir(src_dir)
|
||||
|
||||
for name in names:
|
||||
srcname = os.path.join(src_dir, name)
|
||||
destname = os.path.join(dest_dir, name)
|
||||
|
||||
if os.path.isdir(srcname):
|
||||
shutil.copytree(srcname, destname)
|
||||
else:
|
||||
shutil.copy(srcname, destname)
|
||||
|
||||
|
||||
def get_head_sha(dir):
|
||||
with cwd(dir):
|
||||
return cmd_output('git', 'rev-parse', 'HEAD')[1].strip()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue