@@ -356,11 +356,37 @@ def unasync_directory(files: list[str], src: str, dest: str, replacements: dict[
356
356
357
357
358
358
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()
359
367
unasync_directory (async_files , _pymongo_base , _pymongo_dest_base , replacements )
360
368
unasync_directory (gridfs_files , _gridfs_base , _gridfs_dest_base , replacements )
361
369
unasync_directory (test_files , _test_base , _test_dest_base , replacements )
362
370
process_files (sync_files + sync_gridfs_files + sync_test_files )
363
371
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
+
364
390
365
391
if __name__ == "__main__" :
366
392
main ()
0 commit comments