SymbolicReference: log method added, including test · gitpython-developers/GitPython@8ad01ee · GitHub
Skip to content

Commit 8ad01ee

Browse files
committed
SymbolicReference: log method added, including test
1 parent a93eb7e commit 8ad01ee

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

refs/log.py

Lines changed: 1 addition & 2 deletions

refs/symbolic.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
hex_to_bin
1717
)
1818

19+
from log import RefLog
20+
1921
__all__ = ["SymbolicReference"]
2022

2123
class SymbolicReference(object):
@@ -270,6 +272,14 @@ def is_detached(self):
270272
except TypeError:
271273
return True
272274

275+
def log(self):
276+
"""
277+
:return: RefLog for this reference. Its last entry reflects the latest change
278+
applied to this reference
279+
280+
.. note:: As the log is parsed every time, its recommended to cache it for use
281+
instead of calling this method repeatedly"""
282+
return RefLog.from_file(RefLog.path(self))
273283

274284
@classmethod
275285
def to_full_path(cls, path):

test/test_refs.py

Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)