Skip to content

Commit 7bfd4e6

Browse files
committed
use Commit.replace instead of clone_commit
use Commit.replace from gitpython-developers/GitPython#1124.
1 parent 87d1133 commit 7bfd4e6

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

editmsg-recurse.py

+2-18
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,6 @@
22
import git
33

44

5-
def clone_commit(old, **kwargs):
6-
md = dict(
7-
message=old.message,
8-
parent_commits=old.parents,
9-
author=old.author,
10-
committer=old.committer,
11-
author_date=old.authored_datetime,
12-
commit_date=old.committed_datetime
13-
)
14-
15-
md.update(kwargs)
16-
17-
return git.Commit.create_from_tree(
18-
old.repo, old.tree, **md)
19-
20-
215
def replace(commit, target=None, seen=None, **kwargs):
226
'''update commit <target>
237
@@ -35,14 +19,14 @@ def replace(commit, target=None, seen=None, **kwargs):
3519
seen.add(commit.hexsha)
3620

3721
if commit == target:
38-
new = clone_commit(commit, **kwargs)
22+
new = commit.replace(**kwargs)
3923
return new
4024

4125
parents = list(commit.parents)
4226
for i, parent in enumerate(parents):
4327
parents[i] = replace(parent, target=target, seen=seen, **kwargs)
4428

45-
return clone_commit(commit, parent_commits=parents)
29+
return commit.replace(parents=parents)
4630

4731

4832
@click.command()

0 commit comments

Comments
 (0)