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
|
|
@ -204,3 +204,21 @@ def rmtree(path):
|
|||
else:
|
||||
raise
|
||||
shutil.rmtree(path, ignore_errors=False, onerror=handle_remove_readonly)
|
||||
|
||||
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue