Skip to content

Commit 5616ae6

Browse files
committed
minor
1 parent 93fe40f commit 5616ae6

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/htmlcmp/compare_output_server.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,27 @@ def file(variant: str, path: str):
616616
return send_from_directory(variant_root, path)
617617

618618

619+
@app.route("/update_ref/<path:path>")
620+
def update_ref(path: str):
621+
logger.debug(f"Updating reference for path: {path}")
622+
623+
if not isinstance(path, str):
624+
raise TypeError("Path must be a string")
625+
626+
src = Config.path_b / path
627+
dst = Config.path_a / path
628+
629+
if not src.exists():
630+
return f"Source file does not exist: {src}", 404
631+
632+
if src.is_file():
633+
shutil.copy2(src, dst)
634+
else:
635+
shutil.copytree(src, dst, dirs_exist_ok=True)
636+
637+
return "Reference updated", 200
638+
639+
619640
def verbosity_to_level(verbosity: int) -> int:
620641
if verbosity >= 3:
621642
return logging.DEBUG
@@ -659,27 +680,6 @@ def setup_logging(
659680
root_logger.addHandler(file_handler)
660681

661682

662-
@app.route("/update_ref/<path:path>")
663-
def update_ref(path: str):
664-
logger.debug(f"Updating reference for path: {path}")
665-
666-
if not isinstance(path, str):
667-
raise TypeError("Path must be a string")
668-
669-
src = Config.path_b / path
670-
dst = Config.path_a / path
671-
672-
if not src.exists():
673-
return f"Source file does not exist: {src}", 404
674-
675-
if src.is_file():
676-
shutil.copy2(src, dst)
677-
else:
678-
shutil.copytree(src, dst, dirs_exist_ok=True)
679-
680-
return "Reference updated", 200
681-
682-
683683
def main():
684684
parser = argparse.ArgumentParser()
685685
parser.add_argument("ref", type=Path, help="Path to the reference directory")

0 commit comments

Comments
 (0)