Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit141b78f

Browse files
committed
Added two extra paramaters for commit to take author date and commit date
1 parentc3d33c1 commit141b78f

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

‎git/index/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ def move(self, items, skip_errors=False, **kwargs):
922922

923923
returnout
924924

925-
defcommit(self,message,parent_commits=None,head=True,author=None,committer=None):
925+
defcommit(self,message,parent_commits=None,head=True,author=None,committer=None,author_date=None,commit_date=None):
926926
"""Commit the current default index file, creating a commit object.
927927
For more information on the arguments, see tree.commit.
928928
@@ -932,7 +932,8 @@ def commit(self, message, parent_commits=None, head=True, author=None, committer
932932
run_commit_hook('pre-commit',self)
933933
tree=self.write_tree()
934934
rval=Commit.create_from_tree(self.repo,tree,message,parent_commits,
935-
head,author=author,committer=committer)
935+
head,author=author,committer=committer,
936+
author_date=author_date,commit_date=commit_date)
936937
run_commit_hook('post-commit',self)
937938
returnrval
938939

‎git/objects/commit.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@ def _iter_from_process_or_stream(cls, repo, proc_or_stream):
266266
finalize_process(proc_or_stream)
267267

268268
@classmethod
269-
defcreate_from_tree(cls,repo,tree,message,parent_commits=None,head=False,author=None,committer=None):
269+
defcreate_from_tree(cls,repo,tree,message,parent_commits=None,head=False,author=None,committer=None,
270+
author_date=None,commit_date=None):
270271
"""Commit the given tree, creating a commit object.
271272
272273
:param repo: Repo object the commit should be part of
@@ -288,6 +289,8 @@ def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False,
288289
configuration is used to obtain this value.
289290
:param committer: The name of the committer, optional. If unset, the
290291
repository configuration is used to obtain this value.
292+
:param author_date: The timestamp for the author field
293+
:param commit_date: The timestamp for the committer field
291294
292295
:return: Commit object representing the new commit
293296
@@ -327,14 +330,18 @@ def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False,
327330
offset=altzone
328331

329332
author_date_str=env.get(cls.env_author_date,'')
330-
ifauthor_date_str:
333+
ifauthor_date:
334+
author_time,author_offset=parse_date(author_date)
335+
elifauthor_date_str:
331336
author_time,author_offset=parse_date(author_date_str)
332337
else:
333338
author_time,author_offset=unix_time,offset
334339
# END set author time
335340

336341
committer_date_str=env.get(cls.env_committer_date,'')
337-
ifcommitter_date_str:
342+
ifcommit_date:
343+
committer_time,committer_offset=parse_date(commit_date)
344+
elifcommitter_date_str:
338345
committer_time,committer_offset=parse_date(committer_date_str)
339346
else:
340347
committer_time,committer_offset=unix_time,offset

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp