Skip to content

Commit 6167280

Browse files
committed
wip
1 parent ce1c49a commit 6167280

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tools/synchro.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,37 @@ def unasync_directory(files: list[str], src: str, dest: str, replacements: dict[
356356

357357

358358
def main() -> None:
359+
# output = subprocess.check_output(['git', 'status', '-s']).decode('utf8')
360+
# modified_files = set()
361+
# for line in output.splitlines():
362+
# modified_files.add('./' + line.strip().split(' ')[1])
363+
# target_before_content = dict()
364+
# for dest in [_pymongo_dest_base, _gridfs_dest_base, _test_dest_base]:
365+
# for target in Path(dest).glob('*.py'):
366+
# target_before_content[str(target)] = target.read_text()
359367
unasync_directory(async_files, _pymongo_base, _pymongo_dest_base, replacements)
360368
unasync_directory(gridfs_files, _gridfs_base, _gridfs_dest_base, replacements)
361369
unasync_directory(test_files, _test_base, _test_dest_base, replacements)
362370
process_files(sync_files + sync_gridfs_files + sync_test_files)
363371

372+
# if os.environ.get('OVERRIDE_SYNC_FILES'):
373+
# return
374+
375+
# errored = False
376+
# for fname in sync_files + sync_gridfs_files:
377+
# async_name = fname.replace('synchronous', 'asynchronous')
378+
# if async_name in modified_files:
379+
# continue
380+
# target = Path(fname)
381+
# new_text = target.read_text()
382+
# old_text = target_before_content[str(target)]
383+
# if new_text != old_text:
384+
# target.write_text(old_text)
385+
# errored = True
386+
# print(f"Refusing to overwrite {target}")
387+
# if errored:
388+
# raise ValueError('Encountered errors')
389+
364390

365391
if __name__ == "__main__":
366392
main()

0 commit comments

Comments
 (0)