forked from infra/otc-metadata
Compare commits
5 Commits
main
...
dirsync_re
Author | SHA1 | Date | |
---|---|---|---|
031e08d1c7 | |||
d5d68b0d01 | |||
906a426a48 | |||
c370ffe06a | |||
5ab104636b |
@ -2,3 +2,4 @@ GitPython
|
||||
ruamel.yaml
|
||||
requests
|
||||
jinja2
|
||||
dirsync
|
||||
|
@ -18,9 +18,9 @@ import argparse
|
||||
import logging
|
||||
import os
|
||||
import pathlib
|
||||
import shutil
|
||||
import subprocess
|
||||
import warnings
|
||||
from dirsync import sync
|
||||
|
||||
from git import Repo
|
||||
from git import SymbolicReference
|
||||
@ -111,13 +111,21 @@ def process_repositories(args, service):
|
||||
new_branch.set_tracking_branch(remote_ref)
|
||||
new_branch.checkout()
|
||||
|
||||
shutil.copytree(
|
||||
pathlib.Path(copy_from, doc["rst_location"]),
|
||||
pathlib.Path(copy_to, doc["rst_location"]),
|
||||
ignore=lambda a, b: ["conf.py"],
|
||||
dirs_exist_ok=True,
|
||||
source_path = pathlib.Path(copy_from, doc["rst_location"])
|
||||
target_path = pathlib.Path(copy_to, doc["rst_location"])
|
||||
sync(
|
||||
source_path,
|
||||
target_path,
|
||||
'sync',
|
||||
purge=True,
|
||||
create=True,
|
||||
content=True,
|
||||
ignore=['conf.py']
|
||||
)
|
||||
repo_to.index.add([doc["rst_location"]])
|
||||
|
||||
for obj in repo_to.index.diff(None).iter_change_type('D'):
|
||||
repo_to.index.remove([obj.b_path])
|
||||
if len(repo_to.index.diff("HEAD")) == 0:
|
||||
# Nothing to commit
|
||||
logging.debug("No changes.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user