9 years agoUse rather than explicitly creating a DiskObjectStore.
Jelmer Vernooij [Mon, 28 Jun 2010 22:48:54 +0000 (00:48 +0200)]
Use rather than explicitly creating a DiskObjectStore.

9 years agodulwich.pack.write_pack_index_v{1,2} now take a file-like object
Jelmer Vernooij [Mon, 28 Jun 2010 21:17:03 +0000 (23:17 +0200)]
dulwich.pack.write_pack_index_v{1,2} now take a file-like object
rather than a filename.

9 years agoAdd PackBasedObjectStore.pack_loose_objects().
Jelmer Vernooij [Mon, 28 Jun 2010 20:19:22 +0000 (22:19 +0200)]
Add PackBasedObjectStore.pack_loose_objects().

9 years agoAllow overriding paths to executables in GitSSHClient.
Jelmer Vernooij [Mon, 28 Jun 2010 19:40:01 +0000 (21:40 +0200)]
Allow overriding paths to executables in GitSSHClient.

9 years agoMerge Augie's GitClient refactoring.
Jelmer Vernooij [Mon, 28 Jun 2010 16:44:11 +0000 (18:44 +0200)]
Merge Augie's GitClient refactoring.

9 years agocompat.test_client: test SubprocessGitClient and SSHGitClient
Augie Fackler [Fri, 14 May 2010 17:47:09 +0000 (12:47 -0500)]
compat.test_client: test SubprocessGitClient and SSHGitClient

Change-Id: I905e4af9df72b45cc01366fc858f00cedaec61a0

9 years agoclient: refactor GitClient subclasses to enhance code commonality
Augie Fackler [Fri, 14 May 2010 17:47:07 +0000 (12:47 -0500)]
client: refactor GitClient subclasses to enhance code commonality

This makes GitClient abstract, and the concrete subclasses now share
all substantive implementation code with their superclass. This makes
the subclasses behave more uniformly, and makes testing the client
implementations easier.

Change-Id: I0a459e0e33afb54f3ba352dc66e7429b0f26c9d4

9 years agoparse_tree: Fix tests for pure-python implementation.
Jelmer Vernooij [Sat, 26 Jun 2010 22:01:55 +0000 (00:01 +0200)]
parse_tree: Fix tests for pure-python implementation.

9 years agoSupport Tree.iteritems() returning an iterator rather than a list.
Jelmer Vernooij [Sat, 26 Jun 2010 21:59:24 +0000 (23:59 +0200)]
Support Tree.iteritems() returning an iterator rather than a list.

9 years agoRemove some unused imports.
Jelmer Vernooij [Thu, 17 Jun 2010 21:38:46 +0000 (23:38 +0200)]
Remove some unused imports.

9 years agoMerge logging support in the web server.
Jelmer Vernooij [Thu, 17 Jun 2010 13:54:14 +0000 (15:54 +0200)]
Merge logging support in the web server.

9 years agoAdd simple logging to HTTP server.
Dave Borowitz [Tue, 11 May 2010 21:03:29 +0000 (14:03 -0700)]
Add simple logging to HTTP server.

Change-Id: I696bf5dcc05c86e115a85828be5b88d4ed3f2b21

9 years agoAdd logging utilities and server logging.
Dave Borowitz [Tue, 11 May 2010 19:04:54 +0000 (12:04 -0700)]
Add logging utilities and server logging.

The logging utilities, including default setup, live in
Callers do not need to import the logging module if all they need is

Change-Id: I5364ae2a2524397b0d13cc727e3f031e3f5adecf

9 years agoFix tests.
Jelmer Vernooij [Tue, 15 Jun 2010 16:18:57 +0000 (18:18 +0200)]
Fix tests.

9 years agoWhen restting ShaFile._file, also reset ShaFile._magic.
Jelmer Vernooij [Sun, 13 Jun 2010 15:48:49 +0000 (17:48 +0200)]
When restting ShaFile._file, also reset ShaFile._magic.

9 years agoFix parsing from file-like objects.
Jelmer Vernooij [Sat, 12 Jun 2010 02:05:31 +0000 (04:05 +0200)]
Fix parsing from file-like objects.

9 years agoFix compatibility tests when python-testtools is installed.
Jelmer Vernooij [Fri, 11 Jun 2010 23:11:37 +0000 (01:11 +0200)]
Fix compatibility tests when python-testtools is installed.

9 years agoMerge support for lazy loading packs.
Jelmer Vernooij [Fri, 11 Jun 2010 22:16:56 +0000 (00:16 +0200)]
Merge support for lazy loading packs.

9 years agoAdd Pack.from_lazy_objects().
Jelmer Vernooij [Fri, 11 Jun 2010 22:00:35 +0000 (00:00 +0200)]
Add Pack.from_lazy_objects().

9 years agoUse TestTools' TestCase so TestSkipped gets picked up correctly.
Jelmer Vernooij [Thu, 10 Jun 2010 10:54:45 +0000 (12:54 +0200)]
Use TestTools' TestCase so TestSkipped gets picked up correctly.

9 years agoAlways import TestCase from dulwich.tests so it can be extended or overridden.
Jelmer Vernooij [Thu, 10 Jun 2010 10:46:37 +0000 (12:46 +0200)]
Always import TestCase from dulwich.tests so it can be extended or overridden.

9 years agoUse Python2.7 SkipTest class if available, patch up testtools if it is
Jelmer Vernooij [Thu, 10 Jun 2010 10:36:52 +0000 (12:36 +0200)]
Use Python2.7 SkipTest class if available, patch up testtools if it is
installed so testtools and subunit can report skips properly.

9 years agoMerged changes from trunk
Ross Light [Fri, 4 Jun 2010 05:20:44 +0000 (22:20 -0700)]
Merged changes from trunk

9 years agomerge support for MemoryRepo, path fixing in the web server on non-unix platforms
Jelmer Vernooij [Wed, 2 Jun 2010 00:54:25 +0000 (02:54 +0200)]
merge support for MemoryRepo, path fixing in the web server on non-unix platforms

9 years agoAdd a MemoryRepo that stores everything in memory.
Dave Borowitz [Thu, 13 May 2010 00:47:46 +0000 (17:47 -0700)]
Add a MemoryRepo that stores everything in memory.

This just delegates to a MemoryObjectStore and DictRefsContainer, with a
dict of contents for named files.

As with MemoryObjectStore and DictRefsContainer, this will be useful
primarily for tests.

Change-Id: Ide345a397a0dcde990531bbc4854569ea3274b17

9 years agoUse correct path separators for named repo files.
Dave Borowitz [Thu, 13 May 2010 00:47:46 +0000 (17:47 -0700)]
Use correct path separators for named repo files.

Change-Id: I79175078920ef177006bbd323c3d63232f3060b8

9 years agoMove named file initilization to BaseRepo.
Dave Borowitz [Thu, 13 May 2010 00:44:05 +0000 (17:44 -0700)]
Move named file initilization to BaseRepo.

BaseRepo now supports both getting (abstractly) putting the contents of named

Change-Id: I657ddc122eca5f363b101182c34e4a222b6e072c

9 years agoRemove unused, add bug reference.
Jelmer Vernooij [Sun, 30 May 2010 15:00:00 +0000 (17:00 +0200)]
Remove unused, add bug reference.

9 years agoMerge refactoring of report-status parsing.
Jelmer Vernooij [Sun, 30 May 2010 14:49:14 +0000 (16:49 +0200)]
Merge refactoring of report-status parsing.

9 years agoMerge code cleanups from Dave.
Jelmer Vernooij [Sat, 29 May 2010 22:51:56 +0000 (00:51 +0200)]
Merge code cleanups from Dave.

9 years agoMerge sorted_tree improvements.
Jelmer Vernooij [Sat, 29 May 2010 22:47:07 +0000 (00:47 +0200)]
Merge sorted_tree improvements.

9 years agoAdded SSHGitClient.receive_pack_path and SSHGitClient.upload_pack_path attributes
Ross Light [Tue, 25 May 2010 00:55:09 +0000 (17:55 -0700)]
Added SSHGitClient.receive_pack_path and SSHGitClient.upload_pack_path attributes

9 years agoFix copyright in dul-web.
Dave Borowitz [Tue, 11 May 2010 17:11:29 +0000 (10:11 -0700)]
Fix copyright in dul-web.

As with the rest of the files I authored, this one was authored at work
and so the copyright belongs to my employer.

Change-Id: Ib5405e7f3a4c2d166cdee28e372d76a1caaf7c00

9 years agoClean up file headers.
Dave Borowitz [Tue, 11 May 2010 17:10:14 +0000 (10:10 -0700)]
Clean up file headers.

Fixed several typos that had been copied to multiple files. Reworded a
few file summaries. Removed trailing whitespace. Standardized one blank
line after GPL notice.

Change-Id: Id8ba51425dec66ebd71432b49341b464f6b589ac

9 years agoFix memory leak in C implementation of sorted_tree_items.
Dave Borowitz [Tue, 4 May 2010 21:54:05 +0000 (14:54 -0700)]
Fix memory leak in C implementation of sorted_tree_items.

The tuples created by PyTuple_Pack did not have their refcounts
decreased before raising an exception.

Change-Id: Ic7b62c0fb008129d648d2c3bacfbc2d47260229b

9 years agoAdd tests for sorted_tree_items and C implementation.
Dave Borowitz [Tue, 4 May 2010 21:53:30 +0000 (14:53 -0700)]
Add tests for sorted_tree_items and C implementation.

Change-Id: I653763f8fce86e96d3dd10951a97e558e55003e8

9 years agorelease 0.6.0. dulwich-0.6.0
Jelmer Vernooij [Sat, 22 May 2010 20:59:34 +0000 (22:59 +0200)]
release 0.6.0.

9 years agoAdd reminder to update NEWS to HACKING.
Jelmer Vernooij [Sat, 22 May 2010 20:57:59 +0000 (22:57 +0200)]
Add reminder to update NEWS to HACKING.

9 years agoUpdate NEWS.
Jelmer Vernooij [Sat, 22 May 2010 20:57:12 +0000 (22:57 +0200)]
Update NEWS.

9 years agoMerge some extra tests for packed ref deletion with no peeled refs
Jelmer Vernooij [Sat, 22 May 2010 20:11:18 +0000 (22:11 +0200)]
Merge some extra tests for packed ref deletion with no peeled refs

9 years agoMerge fix for crash deleting a ref.
Jelmer Vernooij [Sat, 22 May 2010 20:07:07 +0000 (22:07 +0200)]
Merge fix for crash deleting a ref.

9 years agoMerge fix for send pack when there is nothing to fetch from Augie.
Jelmer Vernooij [Sat, 22 May 2010 19:55:20 +0000 (21:55 +0200)]
Merge fix for send pack when there is nothing to fetch from Augie.

9 years agotest_repository: test packed ref deletion with no peeled refs
Augie Fackler [Fri, 21 May 2010 20:59:25 +0000 (15:59 -0500)]
test_repository: test packed ref deletion with no peeled refs

Change-Id: I996f70f8f2433673a5ee74b8b0145035bf4809a2

9 years agotest_repository: clean up whitespace
Augie Fackler [Fri, 21 May 2010 16:34:05 +0000 (11:34 -0500)]
test_repository: clean up whitespace

Change-Id: I5b6406dd16b9e6d2cac2061dc3f0eeb8cebce3ce

9 years agoDiskRefsContainer: don't crash deleting a ref without peeled refs
Augie Fackler [Thu, 20 May 2010 23:59:27 +0000 (18:59 -0500)]
DiskRefsContainer: don't crash deleting a ref without peeled refs

It's a valid state to have loaded packed refs but not have any peeled
refs. Prior to this change, attempting to delete a tag in that
configuration would cause a traceback when checking 'if name in
self._peeled_refs' since self._peeled_refs was None.

Change-Id: I442d8dd4c97316c6295c9dbdace088feeedddd35

9 years agorepo: clean up whitespace
Augie Fackler [Thu, 20 May 2010 23:57:11 +0000 (18:57 -0500)]
repo: clean up whitespace

9 years agoclient: fix send_pack when there is nothing to send
Augie Fackler [Fri, 14 May 2010 17:47:13 +0000 (12:47 -0500)]
client: fix send_pack when there is nothing to send

Includes a functional test that failed prior to this fix.

Change-Id: I7d95cff21c56a198a836479d8e88a3589e0f196c

9 years agocompat.test_client: test fetching packs
Augie Fackler [Fri, 14 May 2010 17:47:12 +0000 (12:47 -0500)]
compat.test_client: test fetching packs

Change-Id: Ib7b271dd30265ea6633fece8c04566165fd8ce84

9 years agoRemove PackData.__del__ as it causes reference loops; use PackData.close
Jelmer Vernooij [Thu, 20 May 2010 10:28:18 +0000 (12:28 +0200)]
Remove PackData.__del__ as it causes reference loops; use PackData.close

9 years agodulwich.client: fix fetch if no progress function is specified
Augie Fackler [Fri, 14 May 2010 17:47:10 +0000 (12:47 -0500)]
dulwich.client: fix fetch if no progress function is specified

Change-Id: I0627b9bea8d7259984fb6587a877bb027dde7367

9 years agoMerge improvements and extra tests, mainly to deal better with creating non-bare...
Jelmer Vernooij [Mon, 17 May 2010 21:50:35 +0000 (23:50 +0200)]
Merge improvements and extra tests, mainly to deal better with creating non-bare repositories.

9 years agoclient: move parsing report-status data into a method
Augie Fackler [Fri, 14 May 2010 17:47:03 +0000 (12:47 -0500)]
client: move parsing report-status data into a method

This makes send_pack shorter and less indent-heavy, making a following change
which will require wrapping that code in a try/finally more readable.

Change-Id: I1e3d4d0d79ee61ec0b06dd2c4362c7b113072124

9 years agoMake sure ids get updated when the object changes.
Jelmer Vernooij [Thu, 13 May 2010 09:26:38 +0000 (11:26 +0200)]
Make sure ids get updated when the object changes.

9 years agoAdd docstring.
Jelmer Vernooij [Thu, 13 May 2010 09:23:54 +0000 (11:23 +0200)]
Add docstring.

9 years agoAllow double-staging of files that are deleted in the index.
Dave Borowitz [Mon, 3 May 2010 23:44:05 +0000 (16:44 -0700)]
Allow double-staging of files that are deleted in the index.

Change-Id: I92b75d09281d37c2486f77aa52680b8173379016

9 years agoMove tests that build repos from scratch to their own class.
Dave Borowitz [Mon, 3 May 2010 23:39:10 +0000 (16:39 -0700)]
Move tests that build repos from scratch to their own class.

Change-Id: I7950ed60fedb7098c3db2a63cc1f9ba14d1c1fa2

9 years agoImplement set_symbolic_ref separately in Disk/DictRefsContainer.
Dave Borowitz [Mon, 3 May 2010 18:36:56 +0000 (11:36 -0700)]
Implement set_symbolic_ref separately in Disk/DictRefsContainer.

When writing tests, it became clear that the old implementation was broken.

Change-Id: Id98d7af0c92568d1faf555784214d0c1eb298feb

9 years agoClean up asserts in Tree.
Dave Borowitz [Wed, 28 Apr 2010 17:43:08 +0000 (10:43 -0700)]
Clean up asserts in Tree.

Document the types of arguments to various tree methods instead of
asserting. In particular, these asserts were causing failures in
python2.4, when reading modes from the index resulted in a long rather
than an int. This is harmless, so the asserts were just dropped.

Change-Id: I4a8f8b1527e0fd9571ebdb760e09230f25ac3918

9 years agoConvert tree mode to int when sorting.
Dave Borowitz [Tue, 4 May 2010 18:20:23 +0000 (11:20 -0700)]
Convert tree mode to int when sorting.

This replaces the exact type check with the more pythonic (and
Python-2.4-compatible) PyNumber_Int, which is equivalent to int().

Change-Id: I142d9cfdf8250d9905a65756a95cf575ea81d377

9 years agoAdd non-bare repository tests.
Dave Borowitz [Wed, 28 Apr 2010 17:41:39 +0000 (10:41 -0700)]
Add non-bare repository tests.

These tests test building non-bare repos from scratch by manually
adding, staging, and committing files. Also fixed various bugs that the
tests exercise.

Change-Id: Ic5458b28f2e5e4534a7855f5be9562f4b59f5839

9 years agoFix RefsContainer.add_if_new to support dangling symrefs.
Dave Borowitz [Wed, 28 Apr 2010 19:36:22 +0000 (12:36 -0700)]
Fix RefsContainer.add_if_new to support dangling symrefs.

Change-Id: I411b60135c3374fefd03701db4bb0dc5d0644164

9 years agoTreat non-existent index files as empty.
Dave Borowitz [Wed, 28 Apr 2010 17:34:31 +0000 (10:34 -0700)]
Treat non-existent index files as empty.

Change-Id: Id9738a8fc6d3e53c6ef5b5b8d4144aaa5cd0e075

9 years agoFix up and test DictRefsContainer.
Dave Borowitz [Sat, 24 Apr 2010 01:53:36 +0000 (18:53 -0700)]
Fix up and test DictRefsContainer.

Refactored RefsContainerTests to put common tests in a common base

Change-Id: Id5bd5a0b88a98bd43404e742972ba111fe5d51f3

9 years agoCope with missing newlines in patches.
Jelmer Vernooij [Tue, 11 May 2010 08:17:54 +0000 (10:17 +0200)]
Cope with missing newlines in patches.

9 years agoMerge cleanups and use of proper per-service capabilities from Augie.
Jelmer Vernooij [Wed, 5 May 2010 10:40:01 +0000 (12:40 +0200)]
Merge cleanups and use of proper per-service capabilities from Augie.

9 years agotest_pack: simpler assertion that passes in more places
Augie Fackler [Mon, 3 May 2010 03:25:42 +0000 (22:25 -0500)]
test_pack: simpler assertion that passes in more places

Change-Id: I224f251f791f1baf94910cc389797bf08139509a

9 years agoWhen diffstat is available, dulwich.patch.write_commit_patch() adds the
Tay Ray Chuan [Sun, 2 May 2010 14:10:17 +0000 (16:10 +0200)]
When diffstat is available, dulwich.patch.write_commit_patch() adds the
diffstat followed by a "\n", just before the contents and version info.
The assertion in test_simple() assumes that this is always the case, and
breaks when the diffstat is absent.

9 years agoImplement BaseRepo.__contains__.
Jelmer Vernooij [Sat, 1 May 2010 11:21:15 +0000 (13:21 +0200)]
Implement BaseRepo.__contains__.

9 years agoMerge cleanups from Dave.
Jelmer Vernooij [Fri, 30 Apr 2010 21:18:34 +0000 (23:18 +0200)]
Merge cleanups from Dave.

9 years agoAdd repository compat tests.
Dave Borowitz [Tue, 13 Apr 2010 23:29:46 +0000 (16:29 -0700)]
Add repository compat tests.

These tests ensure that dulwich and cgit think that the same repo has
the same set of refs and packed/loose objects.

Change-Id: Ie2f496e846228f3e9e30ff3eba031a3751bd3f62

9 years agoAdd SEEK_END to, since it was added in 2.5.
Dave Borowitz [Fri, 16 Apr 2010 23:05:53 +0000 (16:05 -0700)]
Add SEEK_END to, since it was added in 2.5.

Change-Id: I9caa891e53423b444063b2801da4043489647703

9 years agoAdd a typedef for Py_ssize_t, which is not available in python <2.5.
Dave Borowitz [Tue, 6 Apr 2010 23:29:49 +0000 (16:29 -0700)]
Add a typedef for Py_ssize_t, which is not available in python <2.5.

Based on a suggestion at:

Change-Id: I170c17eab8eaf586da1db329c96c015edd59314b

9 years agoRefactor server code to allow custom handler classes.
Dave Borowitz [Mon, 5 Apr 2010 23:55:28 +0000 (16:55 -0700)]
Refactor server code to allow custom handler classes.

Also changed to use the same default handler mapping in both TCP
and HTTP servers.

Change-Id: I2fb22768a58ca6f21888593467959bb4176e64e6

9 years agoClarify make_commit docstring and variable names.
Dave Borowitz [Thu, 25 Mar 2010 22:13:36 +0000 (15:13 -0700)]
Clarify make_commit docstring and variable names.

Change-Id: Ifccc31a7bb78adcbb539f360cc62a1e76e7f7943

9 years agoFix yield in try/finally for python2.4 compatibility.
Dave Borowitz [Mon, 22 Mar 2010 21:59:48 +0000 (14:59 -0700)]
Fix yield in try/finally for python2.4 compatibility.

A yield statement in a try block with a finally clause was not supported
prior to python2.5; the same effect can be achieved with either a bare
except clause or an additional level of nesting.

Change-Id: Ib13a9f492feb69184a48e1013b6461ea643f0ebd

9 years agoFix "x if y else z" syntax for python2.4.
Dave Borowitz [Mon, 22 Mar 2010 21:59:06 +0000 (14:59 -0700)]
Fix "x if y else z" syntax for python2.4.

This syntax is not supported in python2.4, and is trivial to rewrite.

Change-Id: Ibbf46cd0276445c0cfb016c7b9b8e845125b4cad

9 years agoFix numerous style issues.
Dave Borowitz [Mon, 22 Mar 2010 21:40:31 +0000 (14:40 -0700)]
Fix numerous style issues.

This largely fixes whitespace and imports, with a few typo fixes as
well. I only touched code that was previously touched by me, except in
the case of imports, where blame data is less useful.

Change-Id: Ie34063eb5abb3283a5b9b80fc902efca39159a97

9 years agoAdd __setitem__ to DictRefsContainer.
Dave Borowitz [Mon, 22 Mar 2010 20:08:58 +0000 (13:08 -0700)]
Add __setitem__ to DictRefsContainer.

BaseRefsContainer assumes __setitem__, but it is not defined in the base
class. This was not a problem previously because DictRefsContainer was
not widely used, but that will change.

Change-Id: Ica0786e63ed2ef301c63671a5f3637048c0338f9

9 years agoAdd make_object and make_commit convenience functions to test utils.
Dave Borowitz [Mon, 22 Mar 2010 16:44:10 +0000 (09:44 -0700)]
Add make_object and make_commit convenience functions to test utils.

These functions reduce typing needed to create objects for testing.
Instead of
    test_object = Object()
    test_object.attr1 = foo
    test_object.attr2 = bar
we can now write
    test_object = make_object(Object, attr1=foo, attr2=bar)

This is even more simplified for Commit objects, which have many
attributes, most of which we usually don't care about. Using make_commit
pre-populates attributes with some arbitrary default values, ensuring
commit objects can be serialized.

Updated relevant test code to use the new methods.

Change-Id: Id8266774efb56ef92a3db6cca42d3ec9d81fd2a0

9 years agoAllow non-os file-like objects passed to ShaFile.from_file.
Jelmer Vernooij [Fri, 30 Apr 2010 13:17:04 +0000 (15:17 +0200)]
Allow non-os file-like objects passed to ShaFile.from_file.

9 years agoDistinguish between ShaFile.from_file and ShaFile.from_path.
Jelmer Vernooij [Fri, 30 Apr 2010 12:52:51 +0000 (14:52 +0200)]
Distinguish between ShaFile.from_file and ShaFile.from_path.

9 years agoPass external object resolve function rather than full object store to ThinPackData...
Jelmer Vernooij [Fri, 30 Apr 2010 00:38:39 +0000 (02:38 +0200)]
Pass external object resolve function rather than full object store to ThinPackData constructor.

9 years agoMerge Dave, highlights:
Jelmer Vernooij [Fri, 30 Apr 2010 00:35:44 +0000 (02:35 +0200)]
Merge Dave, highlights:

* fix thin pack handling
* more object checking
* test cleanups
* code cleanups

9 years agoMerge use of constants for OFS/REF delta's.
Jelmer Vernooij [Tue, 27 Apr 2010 21:21:40 +0000 (23:21 +0200)]
Merge use of constants for OFS/REF delta's.

9 years agoMerge fix to write info/exclude rather than info/excludes file.
Jelmer Vernooij [Mon, 26 Apr 2010 23:41:15 +0000 (01:41 +0200)]
Merge fix to write info/exclude rather than info/excludes file.

9 years agoFixed filename of initial .git/info/exclude
Travis Cline [Mon, 26 Apr 2010 22:36:41 +0000 (17:36 -0500)]
Fixed filename of initial .git/info/exclude

9 years agoclient: raise an exception when send_pack fails
Augie Fackler [Sun, 25 Apr 2010 18:27:43 +0000 (13:27 -0500)]
client: raise an exception when send_pack fails

Change-Id: I55f6caa6f5c050f5feb556c3c21be18d3e57fcba

9 years agoclient: Make SSHSubprocess slightly more forgiving for proto
Augie Fackler [Mon, 3 May 2010 03:25:42 +0000 (22:25 -0500)]
client: Make SSHSubprocess slightly more forgiving for proto

Change-Id: I0c4ed84e0a261f90738220cf8fcb5c11102cf0a4

9 years agodulwich.errors: cleanup whitespace
Augie Fackler [Sun, 25 Apr 2010 18:27:41 +0000 (13:27 -0500)]
dulwich.errors: cleanup whitespace

Change-Id: I9340c0187bc4bcf78da5aa009957007e99c14557

9 years agoclient: advertise capabilities correctly per-service
Augie Fackler [Sun, 25 Apr 2010 18:27:39 +0000 (13:27 -0500)]
client: advertise capabilities correctly per-service

git capabilities are per-service, and we should correctly advertise
capabilities to either upload-pack, receive-pack, or both.

Change-Id: Id6cf579fa698a10a56b43adc055fa6c0d25c6942

9 years agoDo simple pack checking during receive-pack.
Dave Borowitz [Tue, 9 Mar 2010 19:44:14 +0000 (11:44 -0800)]
Do simple pack checking during receive-pack.

Call obj.check() for each object in a pack. This requires passing the
Pack object back from the various commit callbacks.

In the future, we might consider not even moving the pack in until after
has been checked. At the moment, however, the only way to complete a
thin pack is to move it in, so we must do that first. This results in a
garbage pack if the check fails, which would have to be cleaned up by
an eventual GC. However, since only corrupt objects (not packs) can be
written to disk, with the SHA of their corrupt contents, the chances of
actually hitting a corrupt object in practice are very small.

Change-Id: Ib6c6ae2846f77f6a6cd4849b9608c29886258673

9 years agoClean up index tests.
Dave Borowitz [Tue, 9 Mar 2010 19:07:18 +0000 (11:07 -0800)]
Clean up index tests.

-Fix trailing whitespace.
-Fix SimpleIndexTestCase capitalization.
-Fix long line.
-Write files into temp dir instead of working directory.

This is the last of the tests that wrote into the working directory.

Change-Id: If8c194f645c93a68ff8493371ea712d7ca2da6dd

9 years agoClean up pack tests.
Dave Borowitz [Tue, 9 Mar 2010 18:53:09 +0000 (10:53 -0800)]
Clean up pack tests.

-Remove trailing whitespace.
-Fix long lines.
-Hard-code SHAs in their hexlified forms.
-Use '' consistently.
-Always write to temp directories instead of working directory.
-Various indentation and local var refactoring fixes.
-Moved TestHexToSha to, since those functions are from
-While we're in there, also removed trailing whitespace in

Change-Id: I19f133e3d867f31fa75e28142593f84807fbc746

9 years agoClean up object store tests.
Dave Borowitz [Tue, 9 Mar 2010 17:33:04 +0000 (09:33 -0800)]
Clean up object store tests.

-Moved SpecificDiskObjectStoreTests into DiskObjectStoreTests.
-Use pythonic syntax instead of calling __methods__ directory.
-Whitespace cleanup.

Change-Id: I484954ec00e7319c42fdd2d5762af0b38a45b6c3

9 years agoChange check() methods in to raise rather than return bools.
Dave Borowitz [Tue, 9 Mar 2010 01:22:01 +0000 (17:22 -0800)]
Change check() methods in to raise rather than return bools.

This makes Pack, PackIndex, and PackData consistent with the rest of
the check() methods recently added. Raising rather than returning makes
factoring out methods easier and exposes more information about the kind
of error that occurred. Moreover, in many cases, the correct default
behavior is probably to die anyway.

Change-Id: I87ab2b1e165c3c9e55727b25a49b1754c0ac4534

9 years agoHash packed objects without creating ShaFiles.
Dave Borowitz [Fri, 19 Mar 2010 02:46:25 +0000 (19:46 -0700)]
Hash packed objects without creating ShaFiles.

Recent changes to ShaFile result in parsing files when created from
strings. Since the packed object code was just using ShaFile for
computing a SHA, this change elminates that and hashes file contents

Change-Id: I70a14104fa896c248189f0839c24d02c48a43c4d

9 years agoSimplify and fix thin pack resolving.
Dave Borowitz [Fri, 19 Mar 2010 01:15:04 +0000 (18:15 -0700)]
Simplify and fix thin pack resolving.

This change cuts down on passing around callbacks to resolve external
references by creating a ThinPackData class that has different semantics
for resolving ref deltas. In all cases except thin packs, PackData
objects have associated pack objects (added as a member variable in
this change), so we can use the index to resolve ref deltas if they
exist. ThinPackDatas, on the other hand, are constructed with an
ObjectStore that is used for external ref resolving. Since we now
make use of the pack index, we only have to deal with postponing shas
in ThinPackData.iterentries. Since this is the only method used for
constructing an index, we still have to be able to handle ref deltas to
objects later in the file.

Modified the compat tests (and one small error in to
successfully exercise this code, but still missing unit tests.

Change-Id: I244b92c00cbae8e30883c5de4dbf47a9195bd174

9 years agoReplace ref delta/ofs delta magic numbers with constants.
Dave Borowitz [Mon, 15 Mar 2010 19:19:32 +0000 (12:19 -0700)]
Replace ref delta/ofs delta magic numbers with constants.

Change-Id: I49dc3fd7897b2748e4b355ee4ae1345a87431733

9 years agoAdd PackStreamReader.{offset,__len__}, extract PackObjectIterator.
Jelmer Vernooij [Sat, 17 Apr 2010 22:54:25 +0000 (00:54 +0200)]
Add PackStreamReader.{offset,__len__}, extract PackObjectIterator.

9 years agoMove PackStreamReader to dulwich.pack.
Jelmer Vernooij [Sat, 17 Apr 2010 22:40:37 +0000 (00:40 +0200)]
Move PackStreamReader to dulwich.pack.