From 192472f9673b18c91ce618e64e935f91769c50e7 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 20 Jul 2010 16:18:01 +0200 Subject: BaseIndexEntry: Added to_blob method, refactored functionality sligthly repo.clone: assured backslashes won't reach the remote configuration, as it can cause trouble when re-reading the file later on. Some git commands don't appear to be able to properly deal with backslashes, other's do --- lib/git/index/typ.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/git/index/typ.py') diff --git a/lib/git/index/typ.py b/lib/git/index/typ.py index 3a01cd65..ad988285 100644 --- a/lib/git/index/typ.py +++ b/lib/git/index/typ.py @@ -9,6 +9,7 @@ from binascii import ( b2a_hex, ) +from git.objects import Blob __all__ = ('BlobFilter', 'BaseIndexEntry', 'IndexEntry') #{ Invariants @@ -101,6 +102,10 @@ class BaseIndexEntry(tuple): def from_blob(cls, blob, stage = 0): """:return: Fully equipped BaseIndexEntry at the given stage""" return cls((blob.mode, blob.binsha, stage << CE_STAGESHIFT, blob.path)) + + def to_blob(self, repo): + """:return: Blob using the information of this index entry""" + return Blob(repo, self.binsha, self.mode, self.path) class IndexEntry(BaseIndexEntry): -- cgit v1.2.1