attempt to merge
This commit is contained in:
parent
231394b1cd
commit
619b74c815
|
@ -81,6 +81,16 @@ def git_integration(func):
|
||||||
author = repo.default_signature
|
author = repo.default_signature
|
||||||
committer = author
|
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')
|
repo.checkout('refs/heads/master')
|
||||||
index = repo.index
|
index = repo.index
|
||||||
for fp in master_add_paths:
|
for fp in master_add_paths:
|
||||||
|
@ -89,14 +99,18 @@ def git_integration(func):
|
||||||
tree = index.write_tree()
|
tree = index.write_tree()
|
||||||
master_ref = repo.references['refs/heads/master']
|
master_ref = repo.references['refs/heads/master']
|
||||||
parents = [master_ref.peel().hex]
|
parents = [master_ref.peel().hex]
|
||||||
repo.create_commit('refs/heads/master',
|
master_head = repo.create_commit('refs/heads/master',
|
||||||
author,
|
author,
|
||||||
committer,
|
committer,
|
||||||
'comment',
|
comment,
|
||||||
tree,
|
tree,
|
||||||
parents)
|
parents)
|
||||||
|
else:
|
||||||
|
master_head = repo.revparse_single('refs/heads/master')
|
||||||
|
|
||||||
|
if branch_add_paths:
|
||||||
repo.checkout(f'refs/heads/{branch_name}')
|
repo.checkout(f'refs/heads/{branch_name}')
|
||||||
|
index = repo.index
|
||||||
for fp in branch_add_paths:
|
for fp in branch_add_paths:
|
||||||
index.add(fp)
|
index.add(fp)
|
||||||
index.write()
|
index.write()
|
||||||
|
@ -106,18 +120,14 @@ def git_integration(func):
|
||||||
repo.create_commit(f'refs/heads/{branch_name}',
|
repo.create_commit(f'refs/heads/{branch_name}',
|
||||||
author,
|
author,
|
||||||
committer,
|
committer,
|
||||||
'comment',
|
comment,
|
||||||
tree,
|
tree,
|
||||||
parents)
|
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
|
return inner
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue