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

Commit8ad01ee

Browse files
committed
SymbolicReference: log method added, including test
1 parenta93eb7e commit8ad01ee

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

‎refs/log.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
fromheadimportHead
21
fromgit.utilimportjoin_path
32
fromgitdb.utilimport (
43
join,
@@ -170,7 +169,7 @@ def _serialize(self, stream):
170169
write=stream.write
171170

172171
# write all entries
173-
fori,einenumerate(self):
172+
foreinself:
174173
write(repr(e))
175174
#END for each entry
176175

‎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+
fromlogimportRefLog
20+
1921
__all__= ["SymbolicReference"]
2022

2123
classSymbolicReference(object):
@@ -270,6 +272,14 @@ def is_detached(self):
270272
exceptTypeError:
271273
returnTrue
272274

275+
deflog(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+
returnRefLog.from_file(RefLog.path(self))
273283

274284
@classmethod
275285
defto_full_path(cls,path):

‎test/test_refs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,3 +488,6 @@ def test_head_reset(self, rw_repo):
488488
deftest_dereference_recursive(self):
489489
# for now, just test the HEAD
490490
assertSymbolicReference.dereference_recursive(self.rorepo,'HEAD')
491+
492+
deftest_reflog(self):
493+
assertisinstance(self.rorepo.heads.master.log(),RefLog)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp