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

Commit9eb902e

Browse files
committed
Merge branch 'firm1-0.3' into 0.3
This includes a few fixes to not break backwards compatiblity
2 parents322db07 +ba67e4f commit9eb902e

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

‎git/index/base.py

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

868868
returnout
869869

870-
defcommit(self,message,parent_commits=None,head=True):
870+
defcommit(self,message,parent_commits=None,head=True,author=None,committer=None):
871871
"""Commit the current default index file, creating a commit object.
872872
873873
For more information on the arguments, see tree.commit.
@@ -878,7 +878,7 @@ def commit(self, message, parent_commits=None, head=True):
878878
:return:
879879
Commit object representing the new commit"""
880880
tree=self.write_tree()
881-
returnCommit.create_from_tree(self.repo,tree,message,parent_commits,head)
881+
returnCommit.create_from_tree(self.repo,tree,message,parent_commits,head,author=author,committer=committer)
882882

883883
@classmethod
884884
def_flush_stdin_and_wait(cls,proc,ignore_stdout=False):

‎git/objects/commit.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def _iter_from_process_or_stream(cls, repo, proc_or_stream):
258258
finalize_process(proc_or_stream)
259259

260260
@classmethod
261-
defcreate_from_tree(cls,repo,tree,message,parent_commits=None,head=False):
261+
defcreate_from_tree(cls,repo,tree,message,parent_commits=None,head=False,author=None,committer=None):
262262
"""Commit the given tree, creating a commit object.
263263
264264
:param repo: Repo object the commit should be part of
@@ -276,14 +276,17 @@ def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False):
276276
If True, the HEAD will be advanced to the new commit automatically.
277277
Else the HEAD will remain pointing on the previous commit. This could
278278
lead to undesired results when diffing files.
279+
:param author: The name of the author, optional. If unset, the repository
280+
configuration is used to obtain this value.
281+
:param committer: The name of the committer, optional. If unset, the
282+
repository configuration is used to obtain this value.
279283
280284
:return: Commit object representing the new commit
281285
282286
:note:
283287
Additional information about the committer and Author are taken from the
284288
environment or from the git configuration, see git-commit-tree for
285289
more information"""
286-
parents=parent_commits
287290
ifparent_commitsisNone:
288291
try:
289292
parent_commits= [repo.head.commit]
@@ -303,8 +306,8 @@ def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False):
303306
cr=repo.config_reader()
304307
env=os.environ
305308

306-
committer=Actor.committer(cr)
307-
author=Actor.author(cr)
309+
committer=committerorActor.committer(cr)
310+
author=authororActor.author(cr)
308311

309312
# PARSE THE DATES
310313
unix_time=int(time())
@@ -357,7 +360,6 @@ def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False):
357360
exceptValueError:
358361
# head is not yet set to the ref our HEAD points to
359362
# Happens on first commit
360-
importgit.refs
361363
master=git.refs.Head.create(repo,repo.head.ref,new_commit,logmsg="commit (initial): %s"%message)
362364
repo.head.set_reference(master,logmsg='commit: Switching to %s'%master)
363365
# END handle empty repositories

‎git/refs/log.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ def append_entry(cls, config_reader, filepath, oldbinsha, newbinsha, message):
235235
"""Append a new log entry to the revlog at filepath.
236236
237237
:param config_reader: configuration reader of the repository - used to obtain
238-
user information. May be None
238+
user information. May also be an Actor instance identifying the committer directly.
239+
May also be None
239240
:param filepath: full path to the log file
240241
:param oldbinsha: binary sha of the previous commit
241242
:param newbinsha: binary sha of the current commit
@@ -249,8 +250,9 @@ def append_entry(cls, config_reader, filepath, oldbinsha, newbinsha, message):
249250
raiseValueError("Shas need to be given in binary format")
250251
#END handle sha type
251252
assure_directory_exists(filepath,is_file=True)
252-
entry=RefLogEntry((bin_to_hex(oldbinsha),bin_to_hex(newbinsha),Actor.committer(config_reader), (int(time.time()),time.altzone),message))
253-
253+
committer=isinstance(config_reader,Actor)andconfig_readerorActor.committer(config_reader)
254+
entry=RefLogEntry((bin_to_hex(oldbinsha),bin_to_hex(newbinsha),committer, (int(time.time()),time.altzone),message))
255+
254256
lf=LockFile(filepath)
255257
lf._obtain_lock_or_raise()
256258

‎git/refs/symbolic.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,16 @@ def log_append(self, oldbinsha, message, newbinsha=None):
355355
:param newbinsha: The sha the ref points to now. If None, our current commit sha
356356
will be used
357357
:return: added RefLogEntry instance"""
358-
returnRefLog.append_entry(self.repo.config_reader(),RefLog.path(self),oldbinsha,
359-
(newbinshaisNoneandself.commit.binsha)ornewbinsha,
358+
# NOTE: we use the committer of the currently active commit - this should be
359+
# correct to allow overriding the committer on a per-commit level.
360+
# See https://github.com/gitpython-developers/GitPython/pull/146
361+
try:
362+
committer_or_reader=self.commit.committer
363+
exceptValueError:
364+
committer_or_reader=self.repo.config_reader()
365+
# end handle newly cloned repositories
366+
returnRefLog.append_entry(committer_or_reader,RefLog.path(self),oldbinsha,
367+
(newbinshaisNoneandself.commit.binsha)ornewbinsha,
360368
message)
361369

362370
deflog_entry(self,index):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp