Procházet zdrojové kódy

New upstream release.

Jelmer Vernooij před 13 roky
rodič
revize
97116fc5ae
6 změnil soubory, kde provedl 38 přidání a 45 odebrání
  1. 9 0
      NEWS
  2. 3 2
      debian/changelog
  3. 1 1
      dulwich/__init__.py
  4. 6 2
      dulwich/index.py
  5. 18 39
      dulwich/tests/test_index.py
  6. 1 1
      setup.py

+ 9 - 0
NEWS

@@ -1,3 +1,12 @@
+0.8.5	2012-03-29
+
+ BUG FIXES
+
+  * Avoid use of 'with' in dulwich.index. (Jelmer Vernooij)
+
+  * Be a little bit strict about OS behaviour in index tests.
+    Should fix the tests on Debian GNU/kFreeBSD. (Jelmer Vernooij)
+
 0.8.4	2012-03-28
 
  BUG FIXES

+ 3 - 2
debian/changelog

@@ -1,8 +1,9 @@
-dulwich (0.8.4-2) UNRELEASED; urgency=low
+dulwich (0.8.5-1) UNRELEASED; urgency=low
 
   * Install upstream changelog.
+  * New upstream release.
 
- -- Jelmer Vernooij <jelmer@debian.org>  Wed, 28 Mar 2012 14:58:59 +0200
+ -- Jelmer Vernooij <jelmer@debian.org>  Thu, 29 Mar 2012 15:38:35 +0200
 
 dulwich (0.8.4-1) unstable; urgency=low
 

+ 1 - 1
dulwich/__init__.py

@@ -23,4 +23,4 @@
 
 from dulwich import (client, protocol, repo, server)
 
-__version__ = (0, 8, 4)
+__version__ = (0, 8, 5)

+ 6 - 2
dulwich/index.py

@@ -413,11 +413,15 @@ def build_index_from_tree(prefix, index_path, object_store, tree_id):
 
         # FIXME: Merge new index into working tree
         if stat.S_ISLNK(entry.mode):
+            # FIXME: This will fail on Windows. What should we do instead?
             os.symlink(object_store[entry.sha].as_raw_string(), full_path)
         else:
-            with open(full_path, 'wb') as file:
+            f = open(full_path, 'wb')
+            try:
                 # Write out file
-                file.write(object_store[entry.sha].as_raw_string())
+                f.write(object_store[entry.sha].as_raw_string())
+            finally:
+                f.close()
 
             os.chmod(full_path, entry.mode)
 

+ 18 - 39
dulwich/tests/test_index.py

@@ -26,6 +26,7 @@ import os
 import shutil
 import stat
 import struct
+import sys
 import tempfile
 
 from dulwich.index import (
@@ -215,15 +216,17 @@ class IndexEntryFromStatTests(TestCase):
 
 class BuildIndexTests(TestCase):
 
-    def assertReasonableIndexEntry(self, index_entry, values):
+    def assertReasonableIndexEntry(self, index_entry, 
+            time, mode, filesize, sha):
         delta = 1000000
         self.assertEquals(index_entry[0], index_entry[1])  # ctime and atime
-        self.assertTrue(index_entry[0] > values[0] - delta)
-        self.assertEquals(index_entry[4], values[4])  # mode
-        self.assertEquals(index_entry[5], values[5])  # uid
-        self.assertTrue(index_entry[6] in values[6])  # gid
-        self.assertEquals(index_entry[7], values[7])  # filesize
-        self.assertEquals(index_entry[8], values[8])  # sha
+        self.assertTrue(index_entry[0] > time - delta)
+        self.assertEquals(index_entry[4], mode)  # mode
+        if sys.platform != 'nt':
+            self.assertEquals(index_entry[5], os.getuid())
+            self.assertEquals(index_entry[6], os.getgid())
+        self.assertEquals(index_entry[7], filesize)  # filesize
+        self.assertEquals(index_entry[8], sha)  # sha
 
     def assertFileContents(self, path, contents, symlink=False):
         if symlink:
@@ -288,53 +291,29 @@ class BuildIndexTests(TestCase):
         # filea
         apath = os.path.join(repo.path, 'a')
         self.assertTrue(os.path.exists(apath))
-        self.assertReasonableIndexEntry(index['a'], (
-            ctime, ctime,
-            None, None,
-            stat.S_IFREG | 0644,
-            os.getuid(), os.getgroups(),
-            6,
-            filea.id,
-            None))
+        self.assertReasonableIndexEntry(index['a'],
+            ctime, stat.S_IFREG | 0644, 6, filea.id)
         self.assertFileContents(apath, 'file a')
 
         # fileb
         bpath = os.path.join(repo.path, 'b')
         self.assertTrue(os.path.exists(bpath))
-        self.assertReasonableIndexEntry(index['b'], (
-            ctime, ctime,
-            None, None,
-            stat.S_IFREG | 0644,
-            os.getuid(), os.getgroups(),
-            6,
-            fileb.id,
-            None))
+        self.assertReasonableIndexEntry(index['b'],
+            ctime, stat.S_IFREG | 0644, 6, fileb.id)
         self.assertFileContents(bpath, 'file b')
 
         # filed
         dpath = os.path.join(repo.path, 'c', 'd')
         self.assertTrue(os.path.exists(dpath))
-        self.assertReasonableIndexEntry(index['c/d'], (
-            ctime, ctime,
-            None, None,
-            stat.S_IFREG | 0644,
-            os.getuid(), os.getgroups(),
-            6,
-            filed.id,
-            None))
+        self.assertReasonableIndexEntry(index['c/d'], 
+            ctime, stat.S_IFREG | 0644, 6, filed.id)
         self.assertFileContents(dpath, 'file d')
 
         # symlink to d
         epath = os.path.join(repo.path, 'c', 'e')
         self.assertTrue(os.path.exists(epath))
-        self.assertReasonableIndexEntry(index['c/e'], (
-            ctime, ctime,
-            None, None,
-            stat.S_IFLNK,
-            os.getuid(), os.getgroups(),
-            1,
-            filee.id,
-            None))
+        self.assertReasonableIndexEntry(index['c/e'], 
+            ctime, stat.S_IFLNK, 1, filee.id)
         self.assertFileContents(epath, 'd', symlink=True)
 
         # Verify no extra files

+ 1 - 1
setup.py

@@ -10,7 +10,7 @@ except ImportError:
     has_setuptools = False
 from distutils.core import Distribution
 
-dulwich_version_string = '0.8.4'
+dulwich_version_string = '0.8.5'
 
 include_dirs = []
 # Windows MSVC support