Replacing shutil copytree by dirsync #25

Merged
zuul merged 5 commits from dirsync_replaces__shutil into main 2023-01-30 07:52:19 +00:00
2 changed files with 5 additions and 6 deletions
Showing only changes of commit 5ab104636b - Show all commits

View File

@ -2,3 +2,4 @@ GitPython
ruamel.yaml ruamel.yaml
requests requests
jinja2 jinja2
dirsync

View File

@ -21,6 +21,7 @@ import pathlib
import shutil import shutil
import subprocess import subprocess
import warnings import warnings
from dirsync import sync
from git import Repo from git import Repo
from git import SymbolicReference from git import SymbolicReference
@ -111,12 +112,9 @@ def process_repositories(args, service):
new_branch.set_tracking_branch(remote_ref) new_branch.set_tracking_branch(remote_ref)
new_branch.checkout() new_branch.checkout()
shutil.copytree( source_path = pathlib.Path(copy_from, doc["rst_location"])
pathlib.Path(copy_from, doc["rst_location"]), target_path = pathlib.Path(copy_to, doc["rst_location"])
pathlib.Path(copy_to, doc["rst_location"]), sync(source_path, target_path, purge=True, create=True, exclude=['conf.py'])
ignore=lambda a, b: ["conf.py"],
dirs_exist_ok=True,
)
repo_to.index.add([doc["rst_location"]]) repo_to.index.add([doc["rst_location"]])
if len(repo_to.index.diff("HEAD")) == 0: if len(repo_to.index.diff("HEAD")) == 0:
# Nothing to commit # Nothing to commit