attempt to merge

This commit is contained in:
Benjamin Bohard 2020-09-10 12:15:23 +02:00
parent 231394b1cd
commit 619b74c815
1 changed files with 44 additions and 34 deletions

View File

@ -81,6 +81,16 @@ def git_integration(func):
author = repo.default_signature
committer = author
if func.__name__ == 'init':
comment = 'Initialisation de la formation'
elif func.__name__ == 'update':
comment = 'Construction de la formation'
elif func.__name__ == 'outline':
comment = 'Mise à jour du programme'
else:
comment = 'Travail sur la formation'
if master_add_paths:
repo.checkout('refs/heads/master')
index = repo.index
for fp in master_add_paths:
@ -89,14 +99,18 @@ def git_integration(func):
tree = index.write_tree()
master_ref = repo.references['refs/heads/master']
parents = [master_ref.peel().hex]
repo.create_commit('refs/heads/master',
master_head = repo.create_commit('refs/heads/master',
author,
committer,
'comment',
comment,
tree,
parents)
else:
master_head = repo.revparse_single('refs/heads/master')
if branch_add_paths:
repo.checkout(f'refs/heads/{branch_name}')
index = repo.index
for fp in branch_add_paths:
index.add(fp)
index.write()
@ -106,18 +120,14 @@ def git_integration(func):
repo.create_commit(f'refs/heads/{branch_name}',
author,
committer,
'comment',
comment,
tree,
parents)
if master_head not in repo.walk(branch_ref.target):
repo.merge(master_head)
tree = repo.index.write_tree()
merge_commit = repo.create_commit('HEAD', author, committer, 'Merge master into xelatex/*', tree, [repo.head.target, master_head])
basket = repo.branches.get(branch_name)
cherry = repo.lookup_branch('refs/heads/master').target
base = repo.merge_base(cherry, basket.target)
base_tree = cherry.parents[0].tree
index = repo.merge_trees(base_tree, basket, cherry)
tree_id = index.write_tree(repo)
repo.create_commit(basket.name, author, committer, 'bof', tree_id, [basket.target])
return inner