fixed entries (mostly naming of licenses) and added entry
This commit is contained in:
@ -7,10 +7,30 @@ TODO check for sufficient disc space before checkout
|
||||
"""
|
||||
|
||||
import json
|
||||
|
||||
import psutil
|
||||
|
||||
from utils.utils import *
|
||||
|
||||
|
||||
def remove_folders(base_folder, names):
|
||||
if isinstance(names, str):
|
||||
names = (names,)
|
||||
for name in names:
|
||||
folder = os.path.join(base_folder, name)
|
||||
if os.path.isdir(folder):
|
||||
shutil.rmtree(folder)
|
||||
|
||||
|
||||
def remove_files(base_folder, names):
|
||||
if isinstance(names, str):
|
||||
names = (names,)
|
||||
for name in names:
|
||||
file = os.path.join(base_folder, name)
|
||||
if os.path.isfile(file):
|
||||
os.remove(file)
|
||||
|
||||
|
||||
def special_treatment(destination, revision):
|
||||
"""
|
||||
|
||||
@ -29,35 +49,31 @@ def special_treatment(destination, revision):
|
||||
shutil.rmtree(os.path.join(destination, 'Holyspirit'))
|
||||
|
||||
# copy all important files from Holyspirit and delete it
|
||||
if 337 <= revision <= 1200:
|
||||
if 337 <= revision <= 1700:
|
||||
source = os.path.join(destination, 'Holyspirit')
|
||||
if os.path.isdir(source):
|
||||
data = os.path.join(source, 'Data')
|
||||
if os.path.isdir(data):
|
||||
shutil.copytree(data, os.path.join(destination, 'Data'))
|
||||
files = [x for x in os.listdir(source) if x.endswith('.txt') or x.endswith('.conf')]
|
||||
for file in files:
|
||||
shutil.copy(os.path.join(source, file), destination)
|
||||
# shutil.copytree(data, os.path.join(destination, 'Data'))
|
||||
shutil.move(data, destination)
|
||||
files = [x for x in os.listdir(source) if x.endswith('.txt') or x.endswith('.conf')]
|
||||
for file in files:
|
||||
shutil.move(os.path.join(source, file), destination)
|
||||
# remove it
|
||||
shutil.rmtree(source)
|
||||
|
||||
# remove Holyspirit3 folder
|
||||
if 464 <= revision <= 1200:
|
||||
source = os.path.join(destination, 'Holyspirit3')
|
||||
if os.path.isdir(source):
|
||||
shutil.rmtree(source)
|
||||
if 464 <= revision <= 1700:
|
||||
remove_folders(destination, 'Holyspirit3')
|
||||
|
||||
# remove Holyspirit2 folder
|
||||
if 659 <= revision <= 1200:
|
||||
source = os.path.join(destination, 'Holyspirit2')
|
||||
if os.path.isdir(source):
|
||||
shutil.rmtree(source)
|
||||
if 659 <= revision <= 1700:
|
||||
remove_folders(destination, 'Holyspirit2')
|
||||
|
||||
# remove Launcher/release
|
||||
if 413 <= revision <= 1200:
|
||||
source = os.path.join(destination, 'Launcher', 'release')
|
||||
if os.path.isdir(source):
|
||||
shutil.rmtree(source)
|
||||
if 413 <= revision <= 1700:
|
||||
source = os.path.join(destination, 'Launcher')
|
||||
remove_folders(source, ('debug', 'release'))
|
||||
|
||||
# delete all *.dll, *.exe in base folder
|
||||
if 3 <= revision <= 9:
|
||||
@ -68,18 +84,14 @@ def special_treatment(destination, revision):
|
||||
|
||||
# delete "cross" folder
|
||||
if 42 <= revision <= 43:
|
||||
folder = os.path.join(destination, 'Cross')
|
||||
if os.path.isdir(folder):
|
||||
shutil.rmtree(folder)
|
||||
remove_folders(destination, 'Cross')
|
||||
|
||||
# delete personal photos
|
||||
if 374 <= revision <= 1200:
|
||||
folder = os.path.join(destination, 'Photos')
|
||||
if os.path.isdir(folder):
|
||||
shutil.rmtree(folder)
|
||||
if 374 <= revision <= 1700:
|
||||
remove_folders(destination, 'Photos')
|
||||
|
||||
# move empire of steam out
|
||||
if 1173 <= revision <= 1200:
|
||||
if 1173 <= revision <= 1700:
|
||||
folder = os.path.join(destination, 'EmpireOfSteam')
|
||||
if os.path.isdir(folder):
|
||||
# move to empire path
|
||||
@ -87,29 +99,26 @@ def special_treatment(destination, revision):
|
||||
shutil.move(folder, empire)
|
||||
|
||||
# holy editor cleanup
|
||||
if 1078 <= revision <= 1200:
|
||||
if 1078 <= revision <= 1700:
|
||||
source = os.path.join(destination, 'HolyEditor')
|
||||
for name in ('bin', 'release'):
|
||||
folder = os.path.join(source, name)
|
||||
if os.path.isdir(folder):
|
||||
shutil.rmtree(folder)
|
||||
for name in ('moc.exe',):
|
||||
file = os.path.join(source, name)
|
||||
if os.path.isfile(file):
|
||||
os.remove(file)
|
||||
remove_folders(source, ('bin', 'release', 'debug', 'obj'))
|
||||
remove_files(source, 'moc.exe')
|
||||
|
||||
# source folder cleanup
|
||||
if 939 <= revision <= 1200:
|
||||
if 939 <= revision <= 1700:
|
||||
source = os.path.join(destination, 'Source')
|
||||
for name in ('HS',):
|
||||
folder = os.path.join(source, name)
|
||||
if os.path.isdir(folder):
|
||||
shutil.rmtree(folder)
|
||||
for name in ('HS.zip',):
|
||||
file = os.path.join(source, name)
|
||||
if os.path.isfile(file):
|
||||
os.remove(file)
|
||||
remove_folders(source, 'HS')
|
||||
remove_files(source, 'HS.zip')
|
||||
|
||||
# Autres folder cleanup
|
||||
if 1272 <= revision <= 1700:
|
||||
source = os.path.join(destination, 'Autres')
|
||||
remove_folders(source, ('conf', 'db', 'hooks', 'locks'))
|
||||
remove_files(source, ('format', 'maj.php'))
|
||||
|
||||
# remove Holyspirit-Demo
|
||||
if 1668 <= revision <= 1700:
|
||||
remove_folders(destination, 'Holyspirit_Demo')
|
||||
|
||||
def delete_global_excludes(folder):
|
||||
"""
|
||||
@ -160,7 +169,7 @@ def checkout(revision_start, revision_end):
|
||||
|
||||
for revision in range(revision_start, revision_end + 1):
|
||||
# check free disc space
|
||||
if psutil.disk_usage(svn_checkout_path).free < 3e10: # 1e10 = 10 GiB
|
||||
if psutil.disk_usage(svn_checkout_path).free < 3e10: # 1e10 = 10 GiB
|
||||
print('not enough free disc space, will exit')
|
||||
sys.exit(-1)
|
||||
|
||||
@ -177,10 +186,12 @@ def checkout(revision_start, revision_end):
|
||||
print('checkout took {:.1f}s'.format(time.time() - start_time))
|
||||
|
||||
|
||||
def fix_revision(revision_start, revision_end):
|
||||
def fix_revision(revision_start, revision_end=None):
|
||||
"""
|
||||
|
||||
"""
|
||||
if not revision_end:
|
||||
revision_end = revision_start
|
||||
assert revision_end >= revision_start
|
||||
|
||||
unwanted_files = {}
|
||||
@ -391,4 +402,12 @@ if __name__ == "__main__":
|
||||
# fix_revision(801, 1200)
|
||||
# gitify(801, 1200)
|
||||
|
||||
checkout(1201, 1500)
|
||||
# checkout(1201, 1470)
|
||||
# fix_revision(1201, 1470)
|
||||
# gitify(1201, 1470)
|
||||
|
||||
# checkout(1471, 1700)
|
||||
# fix_revision(1471, 1700)
|
||||
# gitify(1471, 1700)
|
||||
|
||||
checkout(1701, 2100)
|
||||
|
Reference in New Issue
Block a user