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

Commit451504f

Browse files
committed
fix(remote): lazy PushInfo.old_commit initialization
We will now populate the old_commit on demand, which willallow us to keep going even if the given commit does notexist locally.Fixesgitpython-developers#461
1 parentf128ae9 commit451504f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎git/remote.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ def to_progress_instance(progress):
7777

7878

7979
classPushInfo(object):
80-
8180
"""
8281
Carries information about the result of a push operation of a single head::
8382
@@ -92,7 +91,7 @@ class PushInfo(object):
9291
# it to local_ref.commit. Will be None if an error was indicated
9392
info.summary # summary line providing human readable english text about the push
9493
"""
95-
__slots__= ('local_ref','remote_ref_string','flags','old_commit','_remote','summary')
94+
__slots__= ('local_ref','remote_ref_string','flags','_old_commit_sha','_remote','summary')
9695

9796
NEW_TAG,NEW_HEAD,NO_MATCH,REJECTED,REMOTE_REJECTED,REMOTE_FAILURE,DELETED, \
9897
FORCED_UPDATE,FAST_FORWARD,UP_TO_DATE,ERROR= [1<<xforxinrange(11)]
@@ -112,8 +111,12 @@ def __init__(self, flags, local_ref, remote_ref_string, remote, old_commit=None,
112111
self.local_ref=local_ref
113112
self.remote_ref_string=remote_ref_string
114113
self._remote=remote
115-
self.old_commit=old_commit
114+
self._old_commit_sha=old_commit
116115
self.summary=summary
116+
117+
@property
118+
defold_commit(self):
119+
returnself._old_commit_shaandself._remote.repo.commit(self._old_commit_sha)orNone
117120

118121
@property
119122
defremote_ref(self):
@@ -176,7 +179,7 @@ def _from_line(cls, remote, line):
176179
split_token=".."
177180
old_sha,new_sha=summary.split(' ')[0].split(split_token)
178181
# have to use constructor here as the sha usually is abbreviated
179-
old_commit=remote.repo.commit(old_sha)
182+
old_commit=old_sha
180183
# END message handling
181184

182185
returnPushInfo(flags,from_ref,to_ref_string,remote,old_commit,summary)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp