Browse Source

Change project name to dulwich everywhere, add assertion.

Jelmer Vernooij 16 năm trước cách đây
mục cha
commit
df105b0b1b
6 tập tin đã thay đổi với 11 bổ sung9 xóa
  1. 1 1
      README
  2. 1 1
      dulwich/__init__.py
  3. 1 1
      dulwich/commit.py
  4. 1 1
      dulwich/errors.py
  5. 6 4
      dulwich/pack.py
  6. 1 1
      dulwich/tests/__init__.py

+ 1 - 1
README

@@ -1,4 +1,4 @@
-This is the python-git project.
+This is the dulwich project.
 
 It aims to give an interface to git repos that doesn't call out to git
 directly. It is probably going to be implemented in pure python.

+ 1 - 1
dulwich/__init__.py

@@ -1,4 +1,4 @@
-# __init__.py -- The git module of python-git
+# __init__.py -- The git module of dulwich
 # Copyright (C) 2007 James Westby <jw+debian@jameswestby.net>
 # 
 # This program is free software; you can redistribute it and/or

+ 1 - 1
dulwich/commit.py

@@ -1,4 +1,4 @@
-# commit.py -- commit for python-git
+# commit.py -- commit for dulwich
 # Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
 # 
 # This program is free software; you can redistribute it and/or

+ 1 - 1
dulwich/errors.py

@@ -1,4 +1,4 @@
-# errors.py -- errors for python-git
+# errors.py -- errors for dulwich
 # Copyright (C) 2007 James Westby <jw+debian@jameswestby.net>
 # 
 # This program is free software; you can redistribute it and/or

+ 6 - 4
dulwich/pack.py

@@ -1,5 +1,6 @@
 # pack.py -- For dealing wih packed git objects.
 # Copyright (C) 2007 James Westby <jw+debian@jameswestby.net>
+# Copryight (C) 2008 Jelmer Vernooij <jelmer@samba.org>
 # The code is loosely based on that in the sha1_file.c file from git itself,
 # which is Copyright (C) Linus Torvalds, 2005 and distributed under the
 # GPL version 2.
@@ -45,6 +46,8 @@ from objects import (ShaFile,
 
 hex_to_sha = lambda hex: int(hex, 16)
 
+MAX_MMAP_SIZE = 256 * 1024 * 1024
+
 def simple_mmap(f, offset, size, access=mmap.ACCESS_READ):
     if offset+size > MAX_MMAP_SIZE and not supports_mmap_offset:
         raise AssertionError("%s is larger than 256 meg, and this version "
@@ -73,18 +76,16 @@ def simple_mmap(f, offset, size, access=mmap.ACCESS_READ):
 def multi_ord(map, start, count):
   value = 0
   for i in range(count):
-    value = value * 256 + ord(map[start+i])
+    value = value * 0x100 + ord(map[start+i])
   return value
 
-MAX_MMAP_SIZE = 256 * 1024 * 1024
-
 class PackIndex(object):
   """An index in to a packfile.
 
   Given a sha id of an object a pack index can tell you the location in the
   packfile of that object if it has it.
 
-  To do the looup it opens the file, and indexes first 256 4 byte groups
+  To do the loop it opens the file, and indexes first 256 4 byte groups
   with the first byte of the sha id. The value in the four byte group indexed
   is the end of the group that shares the same starting byte. Subtract one
   from the starting byte and index again to find the start of the group.
@@ -198,6 +199,7 @@ class PackData(object):
 
     Currently only non-delta objects are supported.
     """
+    assert isinstance(offset, long) or isinstance(offset, int)
     size = os.path.getsize(self._filename)
     assert size == self._size, "Pack data %s has changed size, I don't " \
          "like that" % self._filename

+ 1 - 1
dulwich/tests/__init__.py

@@ -1,4 +1,4 @@
-# __init__.py -- The tests for python-git
+# __init__.py -- The tests for dulwich
 # Copyright (C) 2007 James Westby <jw+debian@jameswestby.net>
 # 
 # This program is free software; you can redistribute it and/or