This is an experimental copy for testing Poikilos' issue mirroring system. Note that Gitea's migration tool can import issues, but the "Issues" checkbox is disabled when "This repository will be a mirror" is enabled (it is for this repo).
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

36 lines
1.1 KiB

#!/usr/bin/env python
import os
import shutil
copy_dot_hidden_enable = False
# TODO: NOT YET IMPEMENTED: delete_if_not_on_src_enable = True
def path_join_all(names):
result = names[0]
for i in range(1, len(names)):
result = os.path.join(result, names[i])
return result
def update_tree(src, dst, level=0):
"""
Creates dst if not present, then copies everything from src to dst
recursively.
"""
folder_path = src
if level <= 1:
print("#" + " "*level + "synchronizing with \"" + dst + "\"")
if not os.path.isdir(dst):
os.makedirs(dst)
if os.path.isdir(folder_path):
for sub_name in os.listdir(folder_path):
sub_path = os.path.join(folder_path, sub_name)
dst_sub_path = os.path.join(dst, sub_name)
allow_copy = True
if not copy_dot_hidden_enable:
allow_copy = not sub_name.startswith(".")
if allow_copy and os.path.isdir(sub_path):
update_tree(sub_path, dst_sub_path, level+1)
if allow_copy and os.path.isfile(sub_path):
shutil.copyfile(sub_path, dst_sub_path)