Compare commits

...

2 commits

2 changed files with 21 additions and 13 deletions

View file

@ -136,7 +136,7 @@ the following environment variables can be set:
how many workers to use for repository duplication,
default is how many cpu threads are available
the following command line arguments can be used:
the following command line flags can be used:
- `--skipsotaignoregen`
skips generating a `.sotaignore` file,
@ -145,6 +145,9 @@ the following command line arguments can be used:
- `--test`
does everything except actually pushing to GitHub
- `--dupethelongway`
duplicates the repository wholly, disrespecting any .gitignore files
there's more, but god forbid you need to use them unless you're changing the script,
search for `argv` in the script if you're comfortable with dragons
@ -191,7 +194,7 @@ the following environment variables can be set:
the large file finding algorithm
(now called SideStepper because names are fun, sue me)
the following command line arguments can be used:
the following command line flags can be used:
- `--parallel`
same behaviour as setting the `SOTA_SIDESTEP_PARALLEL` environment variable
@ -287,4 +290,3 @@ comma-separate multiple licences, and use code blocks if you need to list multip
- Interior Pots And Pans: https://hexclad.com/products/pots-and-pans-set
- Interior Kitchen
Cabinets: https://www.thesimsresource.com/downloads/details/category/sims4-sets-objects-kitchen/title/dream-kitchen-set-pt-1/id/1680892/

26
sync.py
View file

@ -56,6 +56,10 @@ class CopyHighway:
multithreaded file copying class that gives a copy2-like function
for use with shutil.copytree(); also displays a progress bar
"""
pool: ThreadPool
pbar: tqdm
lff_result: LargeFileFilterResult
respect_ignore: bool = True
def __init__(self, message: str, total: int, lff_result: LargeFileFilterResult):
"""
@ -80,6 +84,7 @@ class CopyHighway:
leave=False,
)
self.lff_result = lff_result
self.respect_ignore = False if "--dupethelongway" in argv else True
def callback(self, a: R):
self.pbar.update()
@ -88,17 +93,18 @@ class CopyHighway:
def copy2(self, source: Path | str, dest: Path | str) -> None:
"""shutil.copy2()-like function for use with shutil.copytree()"""
# ignore check 1: dir
for ign_dir in self.lff_result.ignore_directories:
if str(ign_dir) in str(source):
return None
if self.respect_ignore:
# ignore check 1: dir
for ign_dir in self.lff_result.ignore_directories:
if str(ign_dir) in str(source):
return None
# ignore check 2: file
# ... we don't need to use the trytrytry method
# ... because we already did that as part of the large file filter,
# ... and as such we checked for it with the first check above
if self.lff_result.matcher.match(source):
return None
# ignore check 2: file
# ... we don't need to use the trytrytry method
# ... because we already did that as part of the large file filter,
# ... and as such we checked for it with the first check above
if self.lff_result.matcher.match(source):
return None
self.pool.apply_async(copy2, args=(source, dest), callback=self.callback)