summaryrefslogtreecommitdiff
path: root/lib/git/index.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-10-20 21:32:00 +0200
committerSebastian Thiel <byronimo@gmail.com>2009-10-20 21:32:00 +0200
commit56823868efddd3bdbc0b624cdc79adc3a2e94a75 (patch)
tree1e6557b39a4d5c00fbb388e348e03a3a57b8c2bf /lib/git/index.py
parent50a9920b1bd9e6e8cf452c774c499b0b9014ccef (diff)
downloadgitpython-56823868efddd3bdbc0b624cdc79adc3a2e94a75.tar.gz
Improved tuple access of EntryIndex class including test, stage and type access still needs to be decoded though
Diffstat (limited to 'lib/git/index.py')
-rw-r--r--lib/git/index.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/git/index.py b/lib/git/index.py
index 1e67d6d1..1ce4183b 100644
--- a/lib/git/index.py
+++ b/lib/git/index.py
@@ -10,6 +10,7 @@ manipulations such as querying and merging.
import struct
import binascii
import mmap
+import objects
class IndexEntry(tuple):
"""
@@ -17,7 +18,61 @@ class IndexEntry(tuple):
Attributes usully accessed often are cached in the tuple whereas others are
unpacked on demand.
+
+ See the properties for a mapping between names and tuple indices.
"""
+ @property
+ def path(self):
+ return self[0]
+
+ @property
+ def ctime(self):
+ """
+ Returns
+ Tuple(int_time_seconds_since_epoch, int_nano_seconds) of the
+ file's creation time
+ """
+ return struct.unpack(">LL", self[1])
+
+ @property
+ def mtime(self):
+ """
+ See ctime property, but returns modification time
+ """
+ return struct.unpack(">LL", self[2])
+
+ @property
+ def dev(self):
+ return self[3]
+
+ @property
+ def inode(self):
+ return self[4]
+
+ @property
+ def mode(self):
+ return self[5]
+
+ @property
+ def uid(self):
+ return self[6]
+
+ @property
+ def gid(self):
+ return self[7]
+
+ @property
+ def data_size(self):
+ return self[8]
+
+ @property
+ def sha(self):
+ return self[9]
+
+ @property
+ def path_size(self):
+ return self[10]
+
class Index(object):
"""