Changeset f1262e1fcc35…
Parent 4e5d3c28d26e…
by
Changes to 3 files · Browse files at f1262e1fcc35 Showing diff from parent 4e5d3c28d26e Diff from another changeset...
@@ -24,10 +24,12 @@
def read_cache_time(f):
+ """Read a cache time."""
return struct.unpack(">LL", f.read(8))
def write_cache_time(f, t):
+ """Write a cache time."""
if isinstance(t, int):
t = (t, 0)
f.write(struct.pack(">LL", *t))
@@ -119,13 +121,19 @@
class Index(object):
+ """A Git Index file."""
def __init__(self, filename):
+ """Open an index file.
+
+ :param filename: Path to the index file
+ """
self._filename = filename
self.clear()
self.read()
def write(self):
+ """Write current contents of index to disk."""
f = open(self._filename, 'w')
try:
write_index_dict(f, self._byname)
@@ -133,6 +141,7 @@ f.close()
def read(self):
+ """Read current contents of index from disk."""
f = open(self._filename, 'r')
try:
for x in read_index(f):
@@ -141,18 +150,23 @@ f.close()
def __len__(self):
+ """Number of entries in this index file."""
return len(self._byname)
def __getitem__(self, name):
+ """Retrieve entry by relative path."""
return self._byname[name]
def __iter__(self):
+ """Iterate over the paths in this index."""
return iter(self._byname)
def get_sha1(self, path):
+ """Return the (git object) SHA1 for the object at a path."""
return self[path][-2]
def clear(self):
+ """Remove all contents from this index."""
self._byname = {}
def __setitem__(self, name, x):
|
@@ -15,6 +15,10 @@ # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
+
+
+"""Git object store interfaces and implementation."""
+
import itertools
import os
|
@@ -16,6 +16,10 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
+
+"""Git smart network protocol server implementation."""
+
+
import SocketServer
import tempfile
@@ -88,6 +92,7 @@
class Handler(object):
+ """Smart protocol command handler base class."""
def __init__(self, backend, read, write):
self.backend = backend
@@ -98,6 +103,7 @@
class UploadPackHandler(Handler):
+ """Protocol handler for uploading a pack to the server."""
def default_capabilities(self):
return ("multi_ack", "side-band-64k", "thin-pack", "ofs-delta")
@@ -170,6 +176,7 @@
class ReceivePackHandler(Handler):
+ """Protocol handler for downloading a pack to the client."""
def default_capabilities(self):
return ("report-status", "delete-refs")
|
Loading...