@@ -77,7 +77,6 @@ def to_progress_instance(progress):
77
77
78
78
79
79
class PushInfo (object ):
80
-
81
80
"""
82
81
Carries information about the result of a push operation of a single head::
83
82
@@ -92,7 +91,7 @@ class PushInfo(object):
92
91
# it to local_ref.commit. Will be None if an error was indicated
93
92
info.summary # summary line providing human readable english text about the push
94
93
"""
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' )
96
95
97
96
NEW_TAG , NEW_HEAD , NO_MATCH , REJECTED , REMOTE_REJECTED , REMOTE_FAILURE , DELETED , \
98
97
FORCED_UPDATE , FAST_FORWARD , UP_TO_DATE , ERROR = [1 << x for x in range (11 )]
@@ -112,8 +111,12 @@ def __init__(self, flags, local_ref, remote_ref_string, remote, old_commit=None,
112
111
self .local_ref = local_ref
113
112
self .remote_ref_string = remote_ref_string
114
113
self ._remote = remote
115
- self .old_commit = old_commit
114
+ self ._old_commit_sha = old_commit
116
115
self .summary = summary
116
+
117
+ @property
118
+ def old_commit (self ):
119
+ return self ._old_commit_sha and self ._remote .repo .commit (self ._old_commit_sha ) or None
117
120
118
121
@property
119
122
def remote_ref (self ):
@@ -176,7 +179,7 @@ def _from_line(cls, remote, line):
176
179
split_token = ".."
177
180
old_sha , new_sha = summary .split (' ' )[0 ].split (split_token )
178
181
# have to use constructor here as the sha usually is abbreviated
179
- old_commit = remote . repo . commit ( old_sha )
182
+ old_commit = old_sha
180
183
# END message handling
181
184
182
185
return PushInfo (flags , from_ref , to_ref_string , remote , old_commit , summary )
0 commit comments