Browse Source

New upstream version 0.15.0

Jelmer Vernooij 8 years ago
parent
commit
e886e13cd6
86 changed files with 1745 additions and 1204 deletions
  1. 2 3
      CONTRIBUTING
  2. 209 0
      COPYING
  3. 173 151
      NEWS
  4. 5 5
      PKG-INFO
  5. 4 3
      README.md
  6. 10 4
      appveyor.yml
  7. 14 12
      bin/dul-receive-pack
  8. 14 12
      bin/dul-upload-pack
  9. 31 12
      bin/dulwich
  10. 3 3
      docs/tutorial/porcelain.txt
  11. 5 5
      dulwich.egg-info/PKG-INFO
  12. 0 1
      dulwich.egg-info/SOURCES.txt
  13. 15 14
      dulwich/__init__.py
  14. 13 12
      dulwich/_diff_tree.c
  15. 13 12
      dulwich/_objects.c
  16. 15 14
      dulwich/_pack.c
  17. 14 12
      dulwich/archive.py
  18. 62 21
      dulwich/client.py
  19. 14 12
      dulwich/config.py
  20. 14 13
      dulwich/contrib/__init__.py
  21. 14 12
      dulwich/contrib/paramiko_vendor.py
  22. 14 13
      dulwich/contrib/swift.py
  23. 16 13
      dulwich/contrib/test_swift.py
  24. 14 13
      dulwich/contrib/test_swift_smoke.py
  25. 14 12
      dulwich/diff_tree.py
  26. 14 12
      dulwich/errors.py
  27. 14 13
      dulwich/fastexport.py
  28. 14 12
      dulwich/file.py
  29. 14 13
      dulwich/greenthreads.py
  30. 14 12
      dulwich/hooks.py
  31. 14 12
      dulwich/index.py
  32. 14 12
      dulwich/log_utils.py
  33. 14 11
      dulwich/lru_cache.py
  34. 22 13
      dulwich/object_store.py
  35. 32 17
      dulwich/objects.py
  36. 14 12
      dulwich/objectspec.py
  37. 14 12
      dulwich/pack.py
  38. 14 12
      dulwich/patch.py
  39. 66 19
      dulwich/porcelain.py
  40. 14 12
      dulwich/protocol.py
  41. 14 12
      dulwich/reflog.py
  42. 14 13
      dulwich/refs.py
  43. 14 13
      dulwich/repo.py
  44. 14 12
      dulwich/server.py
  45. 23 44
      dulwich/tests/__init__.py
  46. 14 13
      dulwich/tests/compat/__init__.py
  47. 14 13
      dulwich/tests/compat/server_utils.py
  48. 16 17
      dulwich/tests/compat/test_client.py
  49. 14 13
      dulwich/tests/compat/test_pack.py
  50. 14 13
      dulwich/tests/compat/test_repository.py
  51. 14 13
      dulwich/tests/compat/test_server.py
  52. 14 13
      dulwich/tests/compat/test_utils.py
  53. 14 13
      dulwich/tests/compat/test_web.py
  54. 15 15
      dulwich/tests/compat/utils.py
  55. 14 12
      dulwich/tests/test_archive.py
  56. 14 12
      dulwich/tests/test_blackbox.py
  57. 66 12
      dulwich/tests/test_client.py
  58. 15 12
      dulwich/tests/test_config.py
  59. 14 12
      dulwich/tests/test_diff_tree.py
  60. 14 13
      dulwich/tests/test_fastexport.py
  61. 14 12
      dulwich/tests/test_file.py
  62. 14 12
      dulwich/tests/test_grafts.py
  63. 14 13
      dulwich/tests/test_greenthreads.py
  64. 14 12
      dulwich/tests/test_hooks.py
  65. 14 12
      dulwich/tests/test_index.py
  66. 14 11
      dulwich/tests/test_lru_cache.py
  67. 14 12
      dulwich/tests/test_missing_obj_finder.py
  68. 14 12
      dulwich/tests/test_object_store.py
  69. 26 14
      dulwich/tests/test_objects.py
  70. 14 13
      dulwich/tests/test_objectspec.py
  71. 14 12
      dulwich/tests/test_pack.py
  72. 14 12
      dulwich/tests/test_patch.py
  73. 69 23
      dulwich/tests/test_porcelain.py
  74. 14 12
      dulwich/tests/test_protocol.py
  75. 14 13
      dulwich/tests/test_reflog.py
  76. 14 13
      dulwich/tests/test_refs.py
  77. 14 13
      dulwich/tests/test_repository.py
  78. 14 12
      dulwich/tests/test_server.py
  79. 14 13
      dulwich/tests/test_utils.py
  80. 14 12
      dulwich/tests/test_walk.py
  81. 14 12
      dulwich/tests/test_web.py
  82. 14 13
      dulwich/tests/utils.py
  83. 14 12
      dulwich/walk.py
  84. 14 12
      dulwich/web.py
  85. 0 23
      relicensing-apachev2.txt
  86. 7 6
      setup.py

+ 2 - 3
CONTRIBUTING

@@ -48,6 +48,5 @@ requests on GitHub.
 
 Licensing
 ---------
-Dulwich is currently licensed under the GNU General Public License, version 2
-or later. We would like to change the license to Apachev2 or later eventually;
-new contributions should be made under dual GPLv2+/Apachev2+.
+All contributions should be made under the same license that Dulwich itself comes under:
+both Apache License, version 2.0 or later and GNU General Public License, version 2.0 or later.

+ 209 - 0
COPYING

@@ -1,3 +1,209 @@
+Dulwich may be used under the conditions of either of two licenses,
+the Apache License (version 2.0 or later) or the GNU General Public License,
+version 2.0 or later.
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 		    GNU GENERAL PUBLIC LICENSE
 		       Version 2, June 1991
 
@@ -337,3 +543,6 @@ proprietary programs.  If your program is a subroutine library, you may
 consider it more useful to permit linking proprietary applications with the
 library.  If this is what you want to do, use the GNU Lesser General
 Public License instead of this License.
+
+
+

+ 173 - 151
NEWS

@@ -1,9 +1,31 @@
+0.15.0	2016-10-09
+
+ BUG FIXES
+
+  * Allow missing trailing LF when reading service name from
+    HTTP servers. (Jelmer Vernooij, Andrew Shadura, #442)
+
+  * Fix dulwich.porcelain.pull() on Python3. (Jelmer Vernooij, #451)
+
+  * Properly pull in tags during dulwich.porcelain.clone.
+    (Jelmer Vernooij, #408)
+
+ CHANGES
+
+  * Changed license from "GNU General Public License, version 2.0 or later"
+    to "Apache License, version 2.0 or later or GNU General Public License,
+    version 2.0 or later". (#153)
+
+ IMPROVEMENTS
+
+  * Add ``dulwich.porcelain.ls_tree`` implementation. (Jelmer Vernooij)
+
 0.14.1	2016-07-05
 
  BUG FIXES
 
   * Fix regression removing untouched refs when pushing over SSH.
-    (Jelmer Vernooij #441)
+    (Jelmer Vernooij #441)
 
   * Skip Python3 tests for SWIFT contrib module, as it has not yet
     been ported.
@@ -13,13 +35,13 @@
  BUG FIXES
 
   * Fix ShaFile.id after modification of a copied ShaFile.
-    (Félix Mattrat, Jelmer Vernooij)
+    (Félix Mattrat, Jelmer Vernooij)
 
   * Support removing refs from porcelain.push.
-    (Jelmer Vernooij, #437)
+    (Jelmer Vernooij, #437)
 
   * Stop magic protocol ref `capabilities^{}` from leaking out
-    to clients. (Jelmer Vernooij, #254)
+    to clients. (Jelmer Vernooij, #254)
 
  IMPROVEMENTS
 
@@ -32,17 +54,17 @@
  IMPROVEMENTS
 
   * Support `ssh://` URLs in get_transport_and_path_from_url().
-    (Jelmer Vernooij, #402)
+    (Jelmer Vernooij, #402)
 
   * Support missing empty line after headers in Git commits and tags.
     (Nicolas Dandrimont, #413)
 
   * Fix `dulwich.porcelain.status` when used in empty trees.
-    (Jelmer Vernooij, #415)
+    (Jelmer Vernooij, #415)
 
   * Return copies of objects in MemoryObjectStore rather than
     references, making the behaviour more consistent with that of
-    DiskObjectStore. (Félix Mattrat, Jelmer Vernooij)
+    DiskObjectStore. (Félix Mattrat, Jelmer Vernooij)
 
   * Fix ``dulwich.web`` on Python3. (#295, Jonas Haag)
 
@@ -50,7 +72,7 @@
 
   * Drop support for Python 2.6.
 
-  * Fix python3 client web support. (Jelmer Vernooij)
+  * Fix python3 client web support. (Jelmer Vernooij)
 
  BUG FIXES
 
@@ -60,7 +82,7 @@
     on wsgi.input. (Jonas Haag)
 
   * Support fastexport/fastimport functionality on python3 with newer
-    versions of fastimport (>= 0.9.5). (Jelmer Vernooij, Félix Mattrat)
+    versions of fastimport (>= 0.9.5). (Jelmer Vernooij, Félix Mattrat)
 
 0.12.0	2015-12-13
 
@@ -70,7 +92,7 @@
     Based on code from Jonas Haag in klaus.
 
   * Add a `dulwich.reflog` module for reading and writing reflogs.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
   * Fix handling of ambiguous refs in `parse_ref` to make
     it match the behaviour described in https://git-scm.com/docs/gitrevisions.
@@ -96,15 +118,15 @@
 
  IMPROVEMENTS
 
-  * Add support for agent= capability. (Jelmer Vernooij, #298)
+  * Add support for agent= capability. (Jelmer Vernooij, #298)
 
-  * Add support for quiet capability. (Jelmer Vernooij)
+  * Add support for quiet capability. (Jelmer Vernooij)
 
  CHANGES
 
   * The ParamikoSSHVendor class has been moved to
   * dulwich.contrib.paramiko_vendor, as it's currently untested.
-    (Jelmer Vernooij, #364)
+    (Jelmer Vernooij, #364)
 
 0.11.1	2015-09-13
 
@@ -115,21 +137,21 @@
  IMPROVEMENTS
 
   * Extended Python3 support to most of the codebase.
-    (Gary van der Merwe, Jelmer Vernooij)
+    (Gary van der Merwe, Jelmer Vernooij)
   * The `Repo` object has a new `close` method that can be called to close any
     open resources. (Gary van der Merwe)
   * Support 'git.bat' in SubprocessGitClient on Windows.
     (Stefan Zimmermann)
   * Advertise 'ofs-delta' capability in receive-pack server side
-    capabilities. (Jelmer Vernooij)
+    capabilities. (Jelmer Vernooij)
   * Switched `default_local_git_client_cls` to `LocalGitClient`.
     (Gary van der Merwe)
   * Add `porcelain.ls_remote` and `GitClient.get_refs`.
     (Michael Edgar)
   * Add `Repo.discover` method. (B. M. Corser)
-  * Add `dulwich.objectspec.parse_refspec`. (Jelmer Vernooij)
+  * Add `dulwich.objectspec.parse_refspec`. (Jelmer Vernooij)
   * Add `porcelain.pack_objects` and `porcelain.repack`.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
  BUG FIXES
 
@@ -139,12 +161,12 @@
   * Avoid recursion limit issues resolving deltas. (William Grant, #81)
 
   * Allow arguments in local client binary path overrides.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
   * Fix handling of commands with arguments in paramiko SSH
-    client. (Andreas Klöckner, Jelmer Vernooij, #363)
+    client. (Andreas Klöckner, Jelmer Vernooij, #363)
 
-  * Fix parsing of quoted strings in configs. (Jelmer Vernooij, #305)
+  * Fix parsing of quoted strings in configs. (Jelmer Vernooij, #305)
 
 0.10.1  2015-03-25
 
@@ -152,7 +174,7 @@
 
   * Return `ApplyDeltaError` when encountering delta errors
     in both C extensions and native delta application code.
-    (Jelmer Vernooij, #259)
+    (Jelmer Vernooij, #259)
 
 0.10.0	2015-03-22
 
@@ -162,13 +184,13 @@
     refuse to create entries that start with .git/.
 
   * Fix running of testsuite when installed.
-    (Jelmer Vernooij, #223)
+    (Jelmer Vernooij, #223)
 
   * Use a block cache in _find_content_rename_candidates(),
     improving performance. (Mike Williams)
 
   * Add support for ``core.protectNTFS`` setting.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
   * Fix TypeError when fetching empty updates.
     (Hwee Miin Koh)
@@ -184,11 +206,11 @@
 
  IMPROVEMENTS
 
-  * New public method `Repo.reset_index`. (Jelmer Vernooij)
+  * New public method `Repo.reset_index`. (Jelmer Vernooij)
 
   * Prevent duplicate parsing of loose files in objects
     directory when reading. Thanks to David Keijser for the
-    report. (Jelmer Vernooij, #231)
+    report. (Jelmer Vernooij, #231)
 
 0.9.9	2015-03-20
 
@@ -199,7 +221,7 @@
 
     Thanks to Ivan Fratric of the Google Security Team for
     reporting this issue.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
 0.9.8	2014-11-30
 
@@ -214,38 +236,38 @@
     (Michael Edgar)
 
   * Remove assignment to PyList_SIZE() that was causing segfaults on
-    pypy. (Jelmer Vernooij, #196)
+    pypy. (Jelmer Vernooij, #196)
 
  IMPROVEMENTS
 
-  * Add porcelain 'receive-pack' and 'upload-pack'. (Jelmer Vernooij)
+  * Add porcelain 'receive-pack' and 'upload-pack'. (Jelmer Vernooij)
 
-  * Handle SIGINT signals in bin/dulwich. (Jelmer Vernooij)
+  * Handle SIGINT signals in bin/dulwich. (Jelmer Vernooij)
 
-  * Add 'status' support to bin/dulwich. (Jelmer Vernooij)
+  * Add 'status' support to bin/dulwich. (Jelmer Vernooij)
 
   * Add 'branch_create', 'branch_list', 'branch_delete' porcelain.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
-  * Add 'fetch' porcelain. (Jelmer Vernooij)
+  * Add 'fetch' porcelain. (Jelmer Vernooij)
 
-  * Add 'tag_delete' porcelain. (Jelmer Vernooij)
+  * Add 'tag_delete' porcelain. (Jelmer Vernooij)
 
   * Add support for serializing/deserializing 'gpgsig' attributes in Commit.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
  CHANGES
 
   * dul-web is now available as 'dulwich web-daemon'.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
   * dulwich.porcelain.tag has been renamed to tag_create.
     dulwich.porcelain.list_tags has been renamed to tag_list.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
  API CHANGES
 
-  * Restore support for Python 2.6. (Jelmer Vernooij, Gary van der Merwe)
+  * Restore support for Python 2.6. (Jelmer Vernooij, Gary van der Merwe)
 
 
 0.9.7	2014-06-08
@@ -275,7 +297,7 @@
 
   * Add porcelain 'status'. (Ryan Faulkner)
 
-  * Add porcelain 'daemon'. (Jelmer Vernooij)
+  * Add porcelain 'daemon'. (Jelmer Vernooij)
 
   * Add `dulwich.greenthreads` module which provides support
     for concurrency of some object store operations.
@@ -296,19 +318,19 @@ API CHANGES
     be easily closed using a `with` statement. (Gary van der Merwe)
 
   * Remove deprecated `num_objects` argument to `write_pack` methods.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
  OTHER CHANGES
 
   * The 'dul-daemon' script has been removed. The same functionality
-    is now available as 'dulwich daemon'. (Jelmer Vernooij)
+    is now available as 'dulwich daemon'. (Jelmer Vernooij)
 
 0.9.6	2014-04-23
 
  IMPROVEMENTS
 
  * Add support for recursive add in 'git add'.
-   (Ryan Faulkner, Jelmer Vernooij)
+   (Ryan Faulkner, Jelmer Vernooij)
 
  * Add porcelain 'list_tags'. (Ryan Faulkner)
 
@@ -317,10 +339,10 @@ API CHANGES
  * Add porcelain 'pull'. (Ryan Faulkner)
 
  * Support 'http.proxy' in HttpGitClient.
-   (Jelmer Vernooij, #1096030)
+   (Jelmer Vernooij, #1096030)
 
  * Support 'http.useragent' in HttpGitClient.
-   (Jelmer Vernooij)
+   (Jelmer Vernooij)
 
  * In server, wait for clients to send empty list of
    wants when talking to empty repository.
@@ -339,7 +361,7 @@ API CHANGES
    (Jonas Haag)
 
  * Fix handling of `reset` command in dulwich.fastexport.
-   (Jelmer Vernooij, #1249029)
+   (Jelmer Vernooij, #1249029)
 
  * In client, don't wait for server to close connection
    first. Fixes hang when used against GitHub
@@ -351,11 +373,11 @@ API CHANGES
 
  * Stop leaking file handles during pack reload. (Damien Tournoud)
 
- * Avoid reopening packs during pack cache reload. (Jelmer Vernooij)
+ * Avoid reopening packs during pack cache reload. (Jelmer Vernooij)
 
  API CHANGES
 
-  * Drop support for Python 2.6. (Jelmer Vernooij)
+  * Drop support for Python 2.6. (Jelmer Vernooij)
 
 0.9.5	2014-02-23
 
@@ -364,7 +386,7 @@ API CHANGES
  * Add porcelain 'tag'. (Ryan Faulkner)
 
  * New module `dulwich.objectspec` for parsing strings referencing
-   objects and commit ranges. (Jelmer Vernooij)
+   objects and commit ranges. (Jelmer Vernooij)
 
  * Add shallow branch support. (milki)
 
@@ -373,23 +395,23 @@ API CHANGES
 
  CHANGES
 
- * Drop support for Python 2.4 and 2.5. (Jelmer Vernooij)
+ * Drop support for Python 2.4 and 2.5. (Jelmer Vernooij)
 
  API CHANGES
 
  * Remove long deprecated ``Repo.commit``, ``Repo.get_blob``,
-   ``Repo.tree`` and ``Repo.tag``. (Jelmer Vernooij)
+   ``Repo.tree`` and ``Repo.tag``. (Jelmer Vernooij)
 
  * Remove long deprecated ``Repo.revision_history`` and ``Repo.ref``.
-   (Jelmer Vernooij)
+   (Jelmer Vernooij)
 
- * Remove long deprecated ``Tree.entries``. (Jelmer Vernooij)
+ * Remove long deprecated ``Tree.entries``. (Jelmer Vernooij)
 
  BUG FIXES
 
  * Raise KeyError rather than TypeError when passing in
    unicode object of length 20 or 40 to Repo.__getitem__.
-   (Jelmer Vernooij)
+   (Jelmer Vernooij)
 
  * Use 'rm' rather than 'unlink' in tests, since the latter
    does not exist on OpenBSD and other platforms.
@@ -403,21 +425,21 @@ API CHANGES
 
  * Add Repo.set_description(). (Víðir Valberg Guðmundsson)
 
- * Add a basic `dulwich.porcelain` module. (Jelmer Vernooij, Marcin Kuzminski)
+ * Add a basic `dulwich.porcelain` module. (Jelmer Vernooij, Marcin Kuzminski)
 
  * Various performance improvements for object access.
-   (Jelmer Vernooij)
+   (Jelmer Vernooij)
 
  * New function `get_transport_and_path_from_url`,
    similar to `get_transport_and_path` but only
    supports URLs.
-   (Jelmer Vernooij)
+   (Jelmer Vernooij)
 
  * Add support for file:// URLs in `get_transport_and_path_from_url`.
-   (Jelmer Vernooij)
+   (Jelmer Vernooij)
 
  * Add LocalGitClient implementation.
-   (Jelmer Vernooij)
+   (Jelmer Vernooij)
 
  BUG FIXES
 
@@ -427,15 +449,15 @@ API CHANGES
  CHANGES
 
   * Ref handling has been moved to dulwich.refs.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
  API CHANGES
 
   * Remove long deprecated RefsContainer.set_ref().
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
   * Repo.ref() is now deprecated in favour of Repo.refs[].
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
 FEATURES
 
@@ -445,7 +467,7 @@ FEATURES
 
  BUG FIXES
 
-  * Fix path for stdint.h in MANIFEST.in. (Jelmer Vernooij)
+  * Fix path for stdint.h in MANIFEST.in. (Jelmer Vernooij)
 
 0.9.2	2013-09-26
 
@@ -457,9 +479,9 @@ FEATURES
 
  BUG FIXES
 
-  * Support lookups of 40-character refs in BaseRepo.__getitem__. (Chow Loong Jin, Jelmer Vernooij)
+  * Support lookups of 40-character refs in BaseRepo.__getitem__. (Chow Loong Jin, Jelmer Vernooij)
 
-  * Fix fetching packs with side-band-64k capability disabled. (David Keijser, Jelmer Vernooij)
+  * Fix fetching packs with side-band-64k capability disabled. (David Keijser, Jelmer Vernooij)
 
   * Several fixes in send-pack protocol behaviour - handling of empty pack files and deletes.
     (milki, #1063087)
@@ -467,16 +489,16 @@ FEATURES
   * Fix capability negotiation when fetching packs over HTTP.
     (#1072461, William Grant)
 
-  * Enforce determine_wants returning an empty list rather than None. (Fabien Boucher, Jelmer Vernooij)
+  * Enforce determine_wants returning an empty list rather than None. (Fabien Boucher, Jelmer Vernooij)
 
-  * In the server, support pushes just removing refs. (Fabien Boucher, Jelmer Vernooij)
+  * In the server, support pushes just removing refs. (Fabien Boucher, Jelmer Vernooij)
 
  IMPROVEMENTS
 
   * Support passing a single revision to BaseRepo.get_walker() rather than a list of revisions. 
     (Alberto Ruiz)
 
-  * Add `Repo.get_description` method. (Jelmer Vernooij)
+  * Add `Repo.get_description` method. (Jelmer Vernooij)
 
   * Support thin packs in Pack.iterobjects() and Pack.get_raw().
     (William Grant)
@@ -487,21 +509,21 @@ FEATURES
   * Add paramiko-based SSH vendor. (Aaron O'Mullan)
 
   * Support running 'dulwich.server' and 'dulwich.web' using 'python -m'.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
-  * Add ObjectStore.close(). (Jelmer Vernooij)
+  * Add ObjectStore.close(). (Jelmer Vernooij)
 
   * Raise appropriate NotImplementedError when encountering dumb HTTP servers.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
  API CHANGES
 
   * SSHVendor.connect_ssh has been renamed to SSHVendor.run_command.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
   * ObjectStore.add_pack() now returns a 3-tuple. The last element will be an
     abort() method that can be used to cancel the pack operation.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
 0.9.0	2013-05-31
 
@@ -510,7 +532,7 @@ FEATURES
   * Push efficiency - report missing objects only. (#562676, Artem Tikhomirov)
 
   * Use indentation consistent with C Git in config files.
-    (#1031356, Curt Moore, Jelmer Vernooij)
+    (#1031356, Curt Moore, Jelmer Vernooij)
 
   * Recognize and skip binary files in diff function.
     (Takeshi Kanemoto)
@@ -539,7 +561,7 @@ FEATURES
   * Add optional honor_filemode flag to build_index_from_tree.
     (Mark Mikofski)
 
-  * Support core/filemode setting when building trees. (Jelmer Vernooij)
+  * Support core/filemode setting when building trees. (Jelmer Vernooij)
 
   * Add chapter on tags in tutorial. (Ryan Faulkner)
 
@@ -563,7 +585,7 @@ FEATURES
  API CHANGES
 
   * dulwich.__init__ no longer imports client, protocol, repo and
-    server modules. (Jelmer Vernooij)
+    server modules. (Jelmer Vernooij)
 
  FEATURES
 
@@ -579,11 +601,11 @@ FEATURES
 
   * Make index entry tests a little bit less strict, to cope with
     slightly different behaviour on various platforms.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
   * ``setup.py test`` (available when setuptools is installed) now
     runs all tests, not just the basic unit tests.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
  BUG FIXES
 
@@ -593,28 +615,28 @@ FEATURES
   * Handle None elements in lists of TreeChange objects. (Alex Holmes)
 
   * Support cloning repositories without HEAD set.
-    (D-Key, Jelmer Vernooij, issue #69)
+    (D-Key, Jelmer Vernooij, issue #69)
 
-  * Support ``MemoryRepo.get_config``. (Jelmer Vernooij)
+  * Support ``MemoryRepo.get_config``. (Jelmer Vernooij)
 
   * In ``get_transport_and_path``, pass extra keyword arguments on to
-    HttpGitClient. (Jelmer Vernooij)
+    HttpGitClient. (Jelmer Vernooij)
 
 0.8.5	2012-03-29
 
  BUG FIXES
 
-  * Avoid use of 'with' in dulwich.index. (Jelmer Vernooij)
+  * 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)
+    Should fix the tests on Debian GNU/kFreeBSD. (Jelmer Vernooij)
 
 0.8.4	2012-03-28
 
  BUG FIXES
 
   * Options on the same line as sections in config files are now supported.
-    (Jelmer Vernooij, #920553)
+    (Jelmer Vernooij, #920553)
 
   * Only negotiate capabilities that are also supported by the server.
     (Rod Cloutier, Risto Kankkunen)
@@ -629,7 +651,7 @@ FEATURES
 
   * $HOME is now explicitly specified for tests that use it to read
     ``~/.gitconfig``, to prevent test isolation issues.
-    (Jelmer Vernooij, #920330)
+    (Jelmer Vernooij, #920330)
 
  FEATURES
 
@@ -638,7 +660,7 @@ FEATURES
 
   * The WSGI server now transparently handles when a git client submits data
     using Content-Encoding: gzip.
-    (David Blewett, Jelmer Vernooij)
+    (David Blewett, Jelmer Vernooij)
 
   * Add dulwich.index.build_index_from_tree(). (milki)
 
@@ -648,23 +670,23 @@ FEATURES
 
   * The config parser now supports the git-config file format as
     described in git-config(1) and can write git config files.
-    (Jelmer Vernooij, #531092, #768687)
+    (Jelmer Vernooij, #531092, #768687)
 
   * ``Repo.do_commit`` will now use the user identity from
     .git/config or ~/.gitconfig if none was explicitly specified.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
  BUG FIXES
 
   * Allow ``determine_wants`` methods to include the zero sha in their
-    return value. (Jelmer Vernooij)
+    return value. (Jelmer Vernooij)
 
 0.8.2	2011-12-18
 
  BUG FIXES
 
   * Cope with different zlib buffer sizes in sha1 file parser.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
   * Fix get_transport_and_path for HTTP/HTTPS URLs.
     (Bruno Renié)
@@ -674,18 +696,18 @@ FEATURES
   * Fix use --bare argument to 'dulwich init'. (Chris Eberle)
 
   * Properly abort connections when the determine_wants function
-    raises an exception. (Jelmer Vernooij, #856769)
+    raises an exception. (Jelmer Vernooij, #856769)
 
   * Tweak xcodebuild hack to deal with more error output.
-    (Jelmer Vernooij, #903840)
+    (Jelmer Vernooij, #903840)
 
  FEATURES
 
   * Add support for retrieving tarballs from remote servers.
-    (Jelmer Vernooij, #379087)
+    (Jelmer Vernooij, #379087)
 
   * New method ``update_server_info`` which generates data
-    for dumb server access. (Jelmer Vernooij, #731235)
+    for dumb server access. (Jelmer Vernooij, #731235)
 
 0.8.1	2011-10-31
 
@@ -693,44 +715,44 @@ FEATURES
 
   * Repo.do_commit has a new argument 'ref'.
 
-  * Repo.do_commit has a new argument 'merge_heads'. (Jelmer Vernooij)
+  * Repo.do_commit has a new argument 'merge_heads'. (Jelmer Vernooij)
 
-  * New ``Repo.get_walker`` method. (Jelmer Vernooij)
+  * New ``Repo.get_walker`` method. (Jelmer Vernooij)
 
-  * New ``Repo.clone`` method. (Jelmer Vernooij, #725369)
+  * New ``Repo.clone`` method. (Jelmer Vernooij, #725369)
 
   * ``GitClient.send_pack`` now supports the 'side-band-64k' capability.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
   * ``HttpGitClient`` which supports the smart server protocol over
-    HTTP. "dumb" access is not yet supported. (Jelmer Vernooij, #373688)
+    HTTP. "dumb" access is not yet supported. (Jelmer Vernooij, #373688)
 
-  * Add basic support for alternates. (Jelmer Vernooij, #810429)
+  * Add basic support for alternates. (Jelmer Vernooij, #810429)
 
  CHANGES
 
   * unittest2 or python >= 2.7 is now required for the testsuite.
-    testtools is no longer supported. (Jelmer Vernooij, #830713)
+    testtools is no longer supported. (Jelmer Vernooij, #830713)
 
  BUG FIXES
 
   * Fix compilation with older versions of MSVC.  (Martin gz)
 
-  * Special case 'refs/stash' as a valid ref. (Jelmer Vernooij, #695577)
+  * Special case 'refs/stash' as a valid ref. (Jelmer Vernooij, #695577)
 
   * Smart protocol clients can now change refs even if they are
-    not uploading new data. (Jelmer Vernooij, #855993)
+    not uploading new data. (Jelmer Vernooij, #855993)
 
  * Don't compile C extensions when running in pypy.
    (Ronny Pfannschmidt, #881546)
 
  * Use different name for strnlen replacement function to avoid clashing
-   with system strnlen. (Jelmer Vernooij, #880362)
+   with system strnlen. (Jelmer Vernooij, #880362)
 
  API CHANGES
 
   * ``Repo.revision_history`` is now deprecated in favor of ``Repo.get_walker``.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
 0.8.0	2011-08-07
 
@@ -751,9 +773,9 @@ FEATURES
  BUG FIXES
 
   * Avoid storing all objects in memory when writing pack.
-    (Jelmer Vernooij, #813268)
+    (Jelmer Vernooij, #813268)
 
-  * Support IPv6 for git:// connections. (Jelmer Vernooij, #801543)
+  * Support IPv6 for git:// connections. (Jelmer Vernooij, #801543)
 
   * Improve performance of Repo.revision_history(). (Timo Schmid, #535118)
 
@@ -768,14 +790,14 @@ FEATURES
   * Fix a bug in reading the pack checksum when there are fewer than 20 bytes
     left in the buffer. (Dave Borowitz)
 
-  * Support ~ in git:// URL paths. (Jelmer Vernooij, #813555)
+  * Support ~ in git:// URL paths. (Jelmer Vernooij, #813555)
 
   * Make ShaFile.__eq__ work when other is not a ShaFile. (Dave Borowitz)
 
   * ObjectStore.get_graph_walker() now no longer yields the same
     revision more than once. This has a significant improvement for
     performance when wide revision graphs are involved.
-    (Jelmer Vernooij, #818168)
+    (Jelmer Vernooij, #818168)
 
   * Teach ReceivePackHandler how to read empty packs. (Dave Borowitz)
 
@@ -794,10 +816,10 @@ FEATURES
 
   * write_pack no longer takes the num_objects argument and requires an object
     to be passed in that is iterable (rather than an iterator) and that
-    provides __len__.  (Jelmer Vernooij)
+    provides __len__.  (Jelmer Vernooij)
 
   * write_pack_data has been renamed to write_pack_objects and no longer takes a
-    num_objects argument. (Jelmer Vernooij)
+    num_objects argument. (Jelmer Vernooij)
 
   * take_msb_bytes, read_zlib_chunks, unpack_objects, and
     PackStreamReader.read_objects now take an additional argument indicating a
@@ -842,7 +864,7 @@ FEATURES
  TEST CHANGES
 
   * If setuptools is installed, "python setup.py test" will now run the testsuite.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
   * Add a new build_pack test utility for building packs from a simple spec.
     (Dave Borowitz)
@@ -862,10 +884,10 @@ FEATURES
     (Max Bowsher, #707438)
 
   * BaseObjectStore.determine_wants_all no longer breaks on zero SHAs.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
   * write_tree_diff() now supports submodules.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
   * Fix compilation for XCode 4 and older versions of distutils.sysconfig.
     (Daniele Sluijters)
@@ -880,10 +902,10 @@ FEATURES
 
   * The order of the parameters to Tree.add(name, mode, sha) has changed, and
     is now consistent with the rest of Dulwich. Existing code will still
-    work but print a DeprecationWarning. (Jelmer Vernooij, #663550)
+    work but print a DeprecationWarning. (Jelmer Vernooij, #663550)
 
   * Tree.entries() is now deprecated in favour of Tree.items() and
-    Tree.iteritems(). (Jelmer Vernooij)
+    Tree.iteritems(). (Jelmer Vernooij)
 
 0.7.0	2011-01-21
 
@@ -892,14 +914,14 @@ FEATURES
   * New `dulwich.diff_tree` module for simple content-based rename detection.
     (Dave Borowitz)
 
-  * Add Tree.items(). (Jelmer Vernooij)
+  * Add Tree.items(). (Jelmer Vernooij)
 
   * Add eof() and unread_pkt_line() methods to Protocol. (Dave Borowitz)
 
-  * Add write_tree_diff(). (Jelmer Vernooij)
+  * Add write_tree_diff(). (Jelmer Vernooij)
 
   * Add `serve_command` function for git server commands as executables.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
   * dulwich.client.get_transport_and_path now supports rsync-style repository URLs.
     (Dave Borowitz, #568493)
@@ -910,9 +932,9 @@ FEATURES
     (Dave Borowitz)
 
   * Support parsing git mbox patches without a version tail, as generated by
-    Mercurial.  (Jelmer Vernooij)
+    Mercurial.  (Jelmer Vernooij)
 
-  * Fix dul-receive-pack and dul-upload-pack. (Jelmer Vernooij)
+  * Fix dul-receive-pack and dul-upload-pack. (Jelmer Vernooij)
 
   * Zero-padded file modes in Tree objects no longer trigger an exception but
     the check code warns about them. (Augie Fackler, #581064)
@@ -926,9 +948,9 @@ FEATURES
 
  DOCUMENTATION
 
-  * Run the tutorial inside the test suite. (Jelmer Vernooij)
+  * Run the tutorial inside the test suite. (Jelmer Vernooij)
 
-  * Reorganized and updated the tutorial. (Jelmer Vernooij, Dave Borowitz, #610550,
+  * Reorganized and updated the tutorial. (Jelmer Vernooij, Dave Borowitz, #610550,
      #610540)
 
 
@@ -949,7 +971,7 @@ FEATURES
 
  FEATURES
 
-  * Use slots for core objects to save up on memory. (Jelmer Vernooij)
+  * Use slots for core objects to save up on memory. (Jelmer Vernooij)
 
   * Web server supports streaming progress/pack output. (Dave Borowitz)
 
@@ -959,9 +981,9 @@ FEATURES
     (Dave Borowitz)
 
   * Initial work on support for fastimport using python-fastimport.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
-  * New dulwich.pack.MemoryPackIndex class. (Jelmer Vernooij)
+  * New dulwich.pack.MemoryPackIndex class. (Jelmer Vernooij)
 
   * Delegate SHA peeling to the object store.  (Dave Borowitz)
 
@@ -974,9 +996,9 @@ FEATURES
 
   * Standardize quote delimiters in test_protocol. (Dave Borowitz)
 
-  * Fix use when testtools is installed. (Jelmer Vernooij)
+  * Fix use when testtools is installed. (Jelmer Vernooij)
 
-  * Add trivial test for write_pack_header. (Jelmer Vernooij)
+  * Add trivial test for write_pack_header. (Jelmer Vernooij)
 
   * Refactor some of dulwich.tests.compat.server_utils. (Dave Borowitz)
 
@@ -1002,11 +1024,11 @@ FEATURES
   * Tweak server handler injection. (Dave Borowitz)
 
   * PackIndex1 and PackIndex2 now subclass FilePackIndex, which is 
-    itself a subclass of PackIndex. (Jelmer Vernooij)
+    itself a subclass of PackIndex. (Jelmer Vernooij)
 
  DOCUMENTATION
 
-  * Add docstrings for various functions in dulwich.objects. (Jelmer Vernooij)
+  * Add docstrings for various functions in dulwich.objects. (Jelmer Vernooij)
 
   * Clean up docstrings in dulwich.protocol. (Dave Borowitz)
 
@@ -1025,7 +1047,7 @@ FEATURES
   * Use correct path separators for named repo files. (Dave Borowitz)
 
   * python > 2.7 and testtools-based test runners will now also pick up skipped
-    tests correctly. (Jelmer Vernooij)
+    tests correctly. (Jelmer Vernooij)
 
  FEATURES
 
@@ -1037,9 +1059,9 @@ FEATURES
     (Augie Fackler)
 
   * Allow overriding paths to executables in GitSSHClient. 
-    (Ross Light, Jelmer Vernooij, #585204)
+    (Ross Light, Jelmer Vernooij, #585204)
 
-  * Add PackBasedObjectStore.pack_loose_objects(). (Jelmer Vernooij)
+  * Add PackBasedObjectStore.pack_loose_objects(). (Jelmer Vernooij)
 
  TESTS
 
@@ -1064,7 +1086,7 @@ FEATURES
  API CHANGES
 
   * dulwich.pack.write_pack_index_v{1,2} now take a file-like object
-    rather than a filename. (Jelmer Vernooij)
+    rather than a filename. (Jelmer Vernooij)
 
   * Make dul-daemon/dul-web trivial wrappers around server functionality.
     (Dave Borowitz)
@@ -1089,12 +1111,12 @@ note: This list is most likely incomplete for 0.6.0.
     can not be disabled in the server. (Dave Borowitz)
 
   * Fix trailing newlines in generated patch files.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
-  * Implement RefsContainer.__contains__. (Jelmer Vernooij)
+  * Implement RefsContainer.__contains__. (Jelmer Vernooij)
 
   * Cope with \r in ref files on Windows. (
-    http://github.com/jelmer/dulwich/issues/#issue/13, Jelmer Vernooij)
+    http://github.com/jelmer/dulwich/issues/#issue/13, Jelmer Vernooij)
 
   * Fix GitFile breakage on Windows. (Anatoly Techtonik, #557585)
 
@@ -1114,7 +1136,7 @@ note: This list is most likely incomplete for 0.6.0.
     empty. (Dave Borowitz)
 
   * Always update ShaFile.id when the contents of the object get changed. 
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
   * Various Python2.4-compatibility fixes. (Dave Borowitz)
 
@@ -1125,9 +1147,9 @@ note: This list is most likely incomplete for 0.6.0.
   * Add include-tag capability to server. (Dave Borowitz)
 
   * New dulwich.fastexport module that can generate fastexport 
-    streams. (Jelmer Vernooij)
+    streams. (Jelmer Vernooij)
 
-  * Implemented BaseRepo.__contains__. (Jelmer Vernooij)
+  * Implemented BaseRepo.__contains__. (Jelmer Vernooij)
 
   * Add __setitem__ to DictRefsContainer. (Dave Borowitz)
 
@@ -1142,7 +1164,7 @@ note: This list is most likely incomplete for 0.6.0.
   * Add various tests for the use of non-bare repositories. (Dave Borowitz)
 
   * Cope with diffstat not being available on all platforms. 
-    (Tay Ray Chuan, Jelmer Vernooij)
+    (Tay Ray Chuan, Jelmer Vernooij)
 
   * Add make_object and make_commit convenience functions to test utils.
     (Dave Borowitz)
@@ -1150,25 +1172,25 @@ note: This list is most likely incomplete for 0.6.0.
  API BREAKAGES
 
   * The 'committer' and 'message' arguments to Repo.do_commit() have 
-    been swapped. 'committer' is now optional. (Jelmer Vernooij)
+    been swapped. 'committer' is now optional. (Jelmer Vernooij)
 
   * Repo.get_blob, Repo.commit, Repo.tag and Repo.tree are now deprecated.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
   * RefsContainer.set_ref() was renamed to RefsContainer.set_symbolic_ref(),
-    for clarity. (Jelmer Vernooij)
+    for clarity. (Jelmer Vernooij)
 
  API CHANGES
 
   * The primary serialization APIs in dulwich.objects now work 
     with chunks of strings rather than with full-text strings. 
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
 0.5.02010-03-03
 
  BUG FIXES
 
-  * Support custom fields in commits (readonly). (Jelmer Vernooij)
+  * Support custom fields in commits (readonly). (Jelmer Vernooij)
 
   * Improved ref handling. (Dave Borowitz)
 
@@ -1179,14 +1201,14 @@ note: This list is most likely incomplete for 0.6.0.
     cgit. (Dave Borowitz)
 
   * Cope with forward slashes correctly in the index on Windows.
-    (Jelmer Vernooij, #526793)
+    (Jelmer Vernooij, #526793)
 
  FEATURES
 
   * --pure option to setup.py to allow building/installing without the C 
-    extensions. (Hal Wine, Anatoly Techtonik, Jelmer Vernooij, #434326)
+    extensions. (Hal Wine, Anatoly Techtonik, Jelmer Vernooij, #434326)
 
-  * Implement Repo.get_config(). (Jelmer Vernooij, Augie Fackler)
+  * Implement Repo.get_config(). (Jelmer Vernooij, Augie Fackler)
 
   * HTTP dumb and smart server. (Dave Borowitz)
 
@@ -1197,14 +1219,14 @@ note: This list is most likely incomplete for 0.6.0.
 
  FEATURES
 
-  * Add ObjectStore.iter_tree_contents(). (Jelmer Vernooij)
+  * Add ObjectStore.iter_tree_contents(). (Jelmer Vernooij)
 
-  * Add Index.changes_from_tree(). (Jelmer Vernooij)
+  * Add Index.changes_from_tree(). (Jelmer Vernooij)
 
-  * Add ObjectStore.tree_changes(). (Jelmer Vernooij)
+  * Add ObjectStore.tree_changes(). (Jelmer Vernooij)
 
   * Add functionality for writing patches in dulwich.patch.
-    (Jelmer Vernooij)
+    (Jelmer Vernooij)
 
 0.4.0	2009-10-07
 

+ 5 - 5
PKG-INFO

@@ -1,11 +1,11 @@
 Metadata-Version: 1.1
 Name: dulwich
-Version: 0.14.1
+Version: 0.15.0
 Summary: Python Git Library
 Home-page: https://www.dulwich.io/
-Author: Jelmer Vernooij
+Author: Jelmer Vernooij
 Author-email: jelmer@jelmer.uk
-License: GPLv2 or later
+License: Apachev2 or later or GPLv2
 Description: 
               Python implementation of the Git file formats and protocols,
               without the need to have git installed.
@@ -19,10 +19,10 @@ Description:
 Keywords: git
 Platform: UNKNOWN
 Classifier: Development Status :: 4 - Beta
-Classifier: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
-Classifier: Programming Language :: Python :: 2.6
+Classifier: License :: OSI Approved :: Apache Software License
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Operating System :: POSIX

+ 4 - 3
README.md

@@ -5,8 +5,9 @@ This is the Dulwich project.
 It aims to provide an interface to git repos (both local and remote) that
 doesn't call out to git directly but instead uses pure Python.
 
-Homepage: https://www.dulwich.io/
-Author: Jelmer Vernooij <jelmer@jelmer.uk>
+Main website: https://www.dulwich.io/
+
+License: Apache License, version 2 or GNU General Public License, version 2 or later.
 
 The project is named after the part of London that Mr. and Mrs. Git live in
 in the particular Monty Python sketch.
@@ -46,4 +47,4 @@ https://launchpad.net/~dulwich-users.
 Supported versions of Python
 ----------------------------
 
-At the moment, Dulwich supports (and is tested on) CPython 2.6, 2.7, 3.4, 3.5 and Pypy.
+At the moment, Dulwich supports (and is tested on) CPython 2.7, 3.4, 3.5 and Pypy.

+ 10 - 4
appveyor.yml

@@ -1,16 +1,22 @@
 environment:
   matrix:
     - PYTHON: "C:\\Python27"
-      PYWIN32_URL: "https://downloads.sourceforge.net/project/pywin32/pywin32/Build%20219/pywin32-219.win32-py2.7.exe"
+      PYWIN32_URL: "https://downloads.sourceforge.net/project/pywin32/pywin32/Build%20220/pywin32-220.win32-py2.7.exe"
 
     - PYTHON: "C:\\Python34"
-      PYWIN32_URL: "https://downloads.sourceforge.net/project/pywin32/pywin32/Build%20219/pywin32-219.win32-py3.4.exe"
+      PYWIN32_URL: "https://downloads.sourceforge.net/project/pywin32/pywin32/Build%20220/pywin32-220.win32-py3.4.exe"
+
+    - PYTHON: "C:\\Python35"
+      PYWIN32_URL: "https://downloads.sourceforge.net/project/pywin32/pywin32/Build%20220/pywin32-220.win32-py3.5.exe"
 
     - PYTHON: "C:\\Python27-x64"
-      PYWIN32_URL: "https://downloads.sourceforge.net/project/pywin32/pywin32/Build%20219/pywin32-219.win-amd64-py2.7.exe"
+      PYWIN32_URL: "https://downloads.sourceforge.net/project/pywin32/pywin32/Build%20220/pywin32-220.win-amd64-py2.7.exe"
 
     - PYTHON: "C:\\Python34-x64"
-      PYWIN32_URL: "https://downloads.sourceforge.net/project/pywin32/pywin32/Build%20219/pywin32-219.win-amd64-py3.4.exe"
+      PYWIN32_URL: "https://downloads.sourceforge.net/project/pywin32/pywin32/Build%20220/pywin32-220.win-amd64-py3.4.exe"
+
+    - PYTHON: "C:\\Python35-x64"
+      PYWIN32_URL: "https://downloads.sourceforge.net/project/pywin32/pywin32/Build%20220/pywin32-220.win-amd64-py3.5.exe"
 
 install:
   - ps: (new-object net.webclient).DownloadFile($env:PYWIN32_URL, 'c:\\pywin32.exe')

+ 14 - 12
bin/dul-receive-pack

@@ -2,20 +2,22 @@
 # dul-receive-pack - git-receive-pack in python
 # Copyright (C) 2008 John Carr <john.carr@unrouted.co.uk>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 from dulwich.porcelain import receive_pack
 import os

+ 14 - 12
bin/dul-upload-pack

@@ -2,20 +2,22 @@
 # dul-upload-pack - git-upload-pack in python
 # Copyright (C) 2008 John Carr <john.carr@unrouted.co.uk>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 from dulwich.porcelain import upload_pack
 import os

+ 31 - 12
bin/dulwich

@@ -4,20 +4,22 @@
 # Copyright (C) 2008-2011 Jelmer Vernooij <jelmer@samba.org>
 # vim: expandtab
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Simple command-line interface to Dulwich>
 
@@ -358,6 +360,22 @@ def cmd_ls_remote(args):
         sys.stdout.write("%s\t%s\n" % (ref, refs[ref]))
 
 
+def cmd_ls_tree(args):
+    parser = optparse.OptionParser()
+    parser.add_option("-r", "--recursive", action="store_true",
+                      help="Recusively list tree contents.")
+    parser.add_option("--name-only", action="store_true",
+                      help="Only display name.")
+    options, args = parser.parse_args(args)
+    try:
+        treeish = args.pop(0)
+    except IndexError:
+        treeish = None
+    porcelain.ls_tree(
+        '.', treeish, outstream=sys.stdout, recursive=options.recursive,
+        name_only=options.name_only)
+
+
 def cmd_pack_objects(args):
     opts, args = getopt(args, '', ['stdout'])
     opts = dict(opts)
@@ -395,6 +413,7 @@ commands = {
     "init": cmd_init,
     "log": cmd_log,
     "ls-remote": cmd_ls_remote,
+    "ls-tree": cmd_ls_tree,
     "pack-objects": cmd_pack_objects,
     "receive-pack": cmd_receive_pack,
     "repack": cmd_repack,

+ 3 - 3
docs/tutorial/porcelain.txt

@@ -1,15 +1,15 @@
 Porcelain
 =========
 
-The ``porcelain'' is the higher level interface, built on top of the lower
+The ``porcelain`` is the higher level interface, built on top of the lower
 level implementation covered in previous chapters of this tutorial. The
-``dulwich.porcelain'' module in Dulwich is aimed to closely resemble
+``dulwich.porcelain`` module in Dulwich is aimed to closely resemble
 the Git command-line API that you are familiar with.
 
 Basic concepts
 --------------
 The porcelain operations are implemented as top-level functions in the
-``dulwich.porcelain'' module. Most arguments can either be strings or
+``dulwich.porcelain`` module. Most arguments can either be strings or
 more complex Dulwich objects; e.g. a repository argument will either take
 a string with a path to the repository or an instance of a ``Repo`` object.
 

+ 5 - 5
dulwich.egg-info/PKG-INFO

@@ -1,11 +1,11 @@
 Metadata-Version: 1.1
 Name: dulwich
-Version: 0.14.1
+Version: 0.15.0
 Summary: Python Git Library
 Home-page: https://www.dulwich.io/
-Author: Jelmer Vernooij
+Author: Jelmer Vernooij
 Author-email: jelmer@jelmer.uk
-License: GPLv2 or later
+License: Apachev2 or later or GPLv2
 Description: 
               Python implementation of the Git file formats and protocols,
               without the need to have git installed.
@@ -19,10 +19,10 @@ Description:
 Keywords: git
 Platform: UNKNOWN
 Classifier: Development Status :: 4 - Beta
-Classifier: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
-Classifier: Programming Language :: Python :: 2.6
+Classifier: License :: OSI Approved :: Apache Software License
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Operating System :: POSIX

+ 0 - 1
dulwich.egg-info/SOURCES.txt

@@ -11,7 +11,6 @@ README.swift
 TODO
 appveyor.yml
 dulwich.cfg
-relicensing-apachev2.txt
 setup.cfg
 setup.py
 tox.ini

+ 15 - 14
dulwich/__init__.py

@@ -2,23 +2,24 @@
 # Copyright (C) 2007 James Westby <jw+debian@jameswestby.net>
 # Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 
 """Python implementation of the Git file formats and protocols."""
 
-__version__ = (0, 14, 1)
+__version__ = (0, 15, 0)

+ 13 - 12
dulwich/_diff_tree.c

@@ -1,20 +1,21 @@
 /*
  * Copyright (C) 2010 Google, Inc.
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; version 2
- * of the License or (at your option) a later version of the License.
+ * Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+ * General Public License as public by the Free Software Foundation; version 2.0
+ * or (at your option) any later version. You can redistribute it and/or
+ * modify it under the terms of either of these two licenses.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
+ * You should have received a copy of the licenses; if not, see
+ * <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+ * and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+ * License, Version 2.0.
  */
 
 #include <Python.h>

+ 13 - 12
dulwich/_objects.c

@@ -1,20 +1,21 @@
 /*
  * Copyright (C) 2009 Jelmer Vernooij <jelmer@samba.org>
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; version 2
- * of the License or (at your option) a later version of the License.
+ * Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+ * General Public License as public by the Free Software Foundation; version 2.0
+ * or (at your option) any later version. You can redistribute it and/or
+ * modify it under the terms of either of these two licenses.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
+ * You should have received a copy of the licenses; if not, see
+ * <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+ * and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+ * License, Version 2.0.
  */
 
 #include <Python.h>

+ 15 - 14
dulwich/_pack.c

@@ -1,20 +1,21 @@
 /* 
  * Copyright (C) 2009 Jelmer Vernooij <jelmer@samba.org>
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; version 2
- * of the License or (at your option) a later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
+ * Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+ * General Public License as public by the Free Software Foundation; version 2.0
+ * or (at your option) any later version. You can redistribute it and/or
+ * modify it under the terms of either of these two licenses.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * You should have received a copy of the licenses; if not, see
+ * <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+ * and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+ * License, Version 2.0.
  */
 
 #include <Python.h>

+ 14 - 12
dulwich/archive.py

@@ -2,20 +2,22 @@
 # Copyright (C) 2015 Jonas Haag <jonas@lophus.org>
 # Copyright (C) 2015 Jelmer Vernooij <jelmer@jelmer.uk>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Generates tarballs for Git trees.
 

+ 62 - 21
dulwich/client.py

@@ -1,20 +1,22 @@
 # client.py -- Implementation of the client side git protocols
 # Copyright (C) 2008-2013 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Client side support for the Git protocol.
 
@@ -46,6 +48,11 @@ import socket
 import subprocess
 import sys
 
+try:
+    from urllib import quote as urlquote
+except ImportError:
+    from urllib.parse import quote as urlquote
+
 try:
     import urllib2
     import urlparse
@@ -207,6 +214,14 @@ class GitClient(object):
         if not thin_packs:
             self._fetch_capabilities.remove(CAPABILITY_THIN_PACK)
 
+    def get_url(self, path):
+        """Retrieves full url to given path.
+
+        :param path: Repository path (as string)
+        :return: Url to path (as string)
+        """
+        raise NotImplementedError(self.get_url)
+
     def send_pack(self, path, determine_wants, generate_pack_contents,
                   progress=None, write_pack=write_pack_objects):
         """Upload a pack to a remote repository.
@@ -634,7 +649,13 @@ class TCPGitClient(TraditionalGitClient):
             port = TCP_GIT_PORT
         self._host = host
         self._port = port
-        TraditionalGitClient.__init__(self, **kwargs)
+        super(TCPGitClient, self).__init__(**kwargs)
+
+    def get_url(self, path):
+        netloc = self._host
+        if self._port is not None and self._port != TCP_GIT_PORT:
+            netloc += ":%d" % self._port
+        return urlparse.urlunsplit(("git", netloc, path, '', ''))
 
     def _connect(self, cmd, path):
         if type(cmd) is not bytes:
@@ -728,7 +749,7 @@ class SubprocessGitClient(TraditionalGitClient):
         self._stderr = kwargs.get('stderr')
         if 'stderr' in kwargs:
             del kwargs['stderr']
-        TraditionalGitClient.__init__(self, **kwargs)
+        super(SubprocessGitClient, self).__init__(**kwargs)
 
     git_command = None
 
@@ -761,6 +782,9 @@ class LocalGitClient(GitClient):
         self._report_activity = report_activity
         # Ignore the thin_packs argument
 
+    def get_url(self, path):
+        return urlparse.urlunsplit(('file', '', path, '', ''))
+
     def send_pack(self, path, determine_wants, generate_pack_contents,
                   progress=None, write_pack=write_pack_objects):
         """Upload a pack to a remote repository.
@@ -918,13 +942,23 @@ class SSHGitClient(TraditionalGitClient):
         self.host = host
         self.port = port
         self.username = username
-        TraditionalGitClient.__init__(self, **kwargs)
+        super(SSHGitClient, self).__init__(**kwargs)
         self.alternative_paths = {}
         if vendor is not None:
             self.ssh_vendor = vendor
         else:
             self.ssh_vendor = get_ssh_vendor()
 
+    def get_url(self, path):
+        netloc = self.host
+        if self.port is not None:
+            netloc += ":%d" % self.port
+
+        if self.username is not None:
+            netloc = urlquote(self.username, '@/:') + "@" + netloc
+
+        return urlparse.urlunsplit(('ssh', netloc, path, '', ''))
+
     def _get_cmd_path(self, cmd):
         cmd = self.alternative_paths.get(cmd, b'git-' + cmd)
         assert isinstance(cmd, bytes)
@@ -971,7 +1005,7 @@ def default_urllib2_opener(config):
 class HttpGitClient(GitClient):
 
     def __init__(self, base_url, dumb=None, opener=None, config=None, **kwargs):
-        self.base_url = base_url.rstrip("/") + "/"
+        self._base_url = base_url.rstrip("/") + "/"
         self.dumb = dumb
         if opener is None:
             self.opener = default_urllib2_opener(config)
@@ -979,11 +1013,14 @@ class HttpGitClient(GitClient):
             self.opener = opener
         GitClient.__init__(self, **kwargs)
 
+    def get_url(self, path):
+        return self._get_url(path).rstrip("/")
+
     def __repr__(self):
-        return "%s(%r, dumb=%r)" % (type(self).__name__, self.base_url, self.dumb)
+        return "%s(%r, dumb=%r)" % (type(self).__name__, self._base_url, self.dumb)
 
     def _get_url(self, path):
-        return urlparse.urljoin(self.base_url, path).rstrip("/") + "/"
+        return urlparse.urljoin(self._base_url, path).rstrip("/") + "/"
 
     def _http_request(self, url, headers={}, data=None):
         req = urllib2.Request(url, headers=headers, data=data)
@@ -1014,10 +1051,14 @@ class HttpGitClient(GitClient):
             if not self.dumb:
                 proto = Protocol(resp.read, None)
                 # The first line should mention the service
-                pkts = list(proto.read_pkt_seq())
-                if pkts != [b'# service=' + service + b'\n']:
+                try:
+                    [pkt] = list(proto.read_pkt_seq())
+                except ValueError:
+                    raise GitProtocolError(
+                        "unexpected number of packets received")
+                if pkt.rstrip(b'\n') != (b'# service=' + service):
                     raise GitProtocolError(
-                        "unexpected first line %r from smart server" % pkts)
+                        "unexpected first line %r from smart server" % pkt)
                 return read_pkt_refs(proto)
             else:
                 return read_info_refs(resp), set()

+ 14 - 12
dulwich/config.py

@@ -1,20 +1,22 @@
 # config.py - Reading and writing Git config files
 # Copyright (C) 2011-2013 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) a later version.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Reading and writing Git configuration files.
 

+ 14 - 13
dulwich/contrib/__init__.py

@@ -1,21 +1,22 @@
 # __init__.py -- Contrib module for Dulwich
 # Copyright (C) 2014 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 
 def test_suite():

+ 14 - 12
dulwich/contrib/paramiko_vendor.py

@@ -1,20 +1,22 @@
 # paramiko_vendor.py -- paramiko implementation of the SSHVendor interface
 # Copyright (C) 2013 Aaron O'Mullan <aaron.omullan@friendco.de>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Paramiko SSH support for Dulwich.
 

+ 14 - 13
dulwich/contrib/swift.py

@@ -3,21 +3,22 @@
 #
 # Author: Fabien Boucher <fabien.boucher@enovance.com>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Repo implementation atop OpenStack SWIFT."""
 

+ 16 - 13
dulwich/contrib/test_swift.py

@@ -3,21 +3,22 @@
 #
 # Author: Fabien Boucher <fabien.boucher@enovance.com>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for dulwich.contrib.swift."""
 
@@ -430,7 +431,9 @@ class TestSwiftRepo(TestCase):
 @skipIf(missing_libs, skipmsg)
 @skipIfPY3
 class TestPackInfoLoadDump(TestCase):
+
     def setUp(self):
+        super(TestPackInfoLoadDump, self).setUp()
         conf = swift.load_conf(file=StringIO(config_file %
                                              def_config_file))
         sos = swift.SwiftObjectStore(

+ 14 - 13
dulwich/contrib/test_swift_smoke.py

@@ -3,21 +3,22 @@
 #
 # Author: Fabien Boucher <fabien.boucher@enovance.com>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Start functional tests
 

+ 14 - 12
dulwich/diff_tree.py

@@ -1,20 +1,22 @@
 # diff_tree.py -- Utilities for diffing files and trees.
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Utilities for diffing files and trees."""
 import sys

+ 14 - 12
dulwich/errors.py

@@ -2,20 +2,22 @@
 # Copyright (C) 2007 James Westby <jw+debian@jameswestby.net>
 # Copyright (C) 2009-2012 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# or (at your option) any later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Dulwich-related exception classes and utility functions."""
 

+ 14 - 13
dulwich/fastexport.py

@@ -1,21 +1,22 @@
 # __init__.py -- Fast export/import functionality
 # Copyright (C) 2010-2013 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 
 """Fast export/import functionality."""

+ 14 - 12
dulwich/file.py

@@ -1,20 +1,22 @@
 # file.py -- Safe access to git files
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Safe access to git files."""
 

+ 14 - 13
dulwich/greenthreads.py

@@ -3,21 +3,22 @@
 #
 # Author: Fabien Boucher <fabien.boucher@enovance.com>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Utility module for querying an ObjectStore with gevent."""
 

+ 14 - 12
dulwich/hooks.py

@@ -1,20 +1,22 @@
 # hooks.py -- for dealing with git hooks
 # Copyright (C) 2012-2013 Jelmer Vernooij and others.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Access to hooks."""
 

+ 14 - 12
dulwich/index.py

@@ -1,20 +1,22 @@
 # index.py -- File parser/writer for the git index file
 # Copyright (C) 2008-2013 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your opinion) any later version of the license.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Parser for the git index file format."""
 

+ 14 - 12
dulwich/log_utils.py

@@ -1,20 +1,22 @@
 # log_utils.py -- Logging utilities for Dulwich
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA  02110-1301, USA.
 
 """Logging utilities for Dulwich.
 

+ 14 - 11
dulwich/lru_cache.py

@@ -1,19 +1,22 @@
 # lru_cache.py -- Simple LRU cache for dulwich
 # Copyright (C) 2006, 2008 Canonical Ltd
 #
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
 """A simple least-recently-used (LRU) cache."""
 

+ 22 - 13
dulwich/object_store.py

@@ -2,20 +2,22 @@
 # Copyright (C) 2008-2013 Jelmer Vernooij <jelmer@samba.org>
 #                         and others
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# 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."""
@@ -567,7 +569,14 @@ class DiskObjectStore(PackBasedObjectStore):
         # Move the pack in.
         entries.sort()
         pack_base_name = self._get_pack_basepath(entries)
-        os.rename(path, pack_base_name + '.pack')
+        if sys.platform == 'win32':
+            try:
+                os.rename(path, pack_base_name + '.pack')
+            except WindowsError:
+                os.remove(pack_base_name + '.pack')
+                os.rename(path, pack_base_name + '.pack')
+        else:
+            os.rename(path, pack_base_name + '.pack')
 
         # Write the index.
         index_file = GitFile(pack_base_name + '.idx', 'wb')

+ 32 - 17
dulwich/objects.py

@@ -2,20 +2,22 @@
 # Copyright (C) 2007 James Westby <jw+debian@jameswestby.net>
 # Copyright (C) 2008-2013 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Access to base git objects."""
 
@@ -825,6 +827,23 @@ def key_entry_name_order(entry):
     return entry[0]
 
 
+def pretty_format_tree_entry(name, mode, hexsha, encoding="utf-8"):
+    """Pretty format tree entry.
+
+    :param name: Name of the directory entry
+    :param mode: Mode of entry
+    :param hexsha: Hexsha of the referenced object
+    :return: string describing the tree entry
+    """
+    if mode & stat.S_IFDIR:
+        kind = "tree"
+    else:
+        kind = "blob"
+    return "%04o %s %s\t%s\n" % (
+            mode, kind, hexsha.decode('ascii'),
+            name.decode(encoding, 'replace'))
+
+
 class Tree(ShaFile):
     """A Git tree object"""
 
@@ -948,11 +967,7 @@ class Tree(ShaFile):
     def as_pretty_string(self):
         text = []
         for name, mode, hexsha in self.iteritems():
-            if mode & stat.S_IFDIR:
-                kind = "tree"
-            else:
-                kind = "blob"
-            text.append("%04o %s %s\t%s\n" % (mode, kind, hexsha, name))
+            text.append(pretty_format_tree_entry(name, mode, hexsha))
         return "".join(text)
 
     def lookup_path(self, lookup_obj, path):

+ 14 - 12
dulwich/objectspec.py

@@ -1,20 +1,22 @@
 # objectspec.py -- Object specification
 # Copyright (C) 2014 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Object specification."""
 

+ 14 - 12
dulwich/pack.py

@@ -2,20 +2,22 @@
 # Copyright (C) 2007 James Westby <jw+debian@jameswestby.net>
 # Copyright (C) 2008-2013 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) a later version.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Classes for dealing with packed git objects.
 

+ 14 - 12
dulwich/patch.py

@@ -1,20 +1,22 @@
 # patch.py -- For dealing with packed-style patches.
 # Copyright (C) 2009-2013 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) a later version.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Classes for dealing with git am-style patches.
 

+ 66 - 19
dulwich/porcelain.py

@@ -1,20 +1,22 @@
 # porcelain.py -- Porcelain-like layer on top of Dulwich
 # Copyright (C) 2013 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Simple wrapper that provides porcelain-like functions on top of Dulwich.
 
@@ -30,6 +32,7 @@ Currently implemented:
  * fetch
  * init
  * ls-remote
+ * ls-tree
  * pull
  * push
  * rm
@@ -54,6 +57,8 @@ from contextlib import (
     contextmanager,
 )
 import os
+import posixpath
+import stat
 import sys
 import time
 
@@ -72,6 +77,7 @@ from dulwich.objects import (
     Commit,
     Tag,
     parse_timezone,
+    pretty_format_tree_entry,
     )
 from dulwich.objectspec import (
     parse_object,
@@ -135,8 +141,8 @@ def open_repo_closing(path_or_repo):
     return closing(Repo(path_or_repo))
 
 
-def archive(repo, committish=None, outstream=sys.stdout,
-            errstream=sys.stderr):
+def archive(repo, committish=None, outstream=default_bytes_out_stream,
+            errstream=default_bytes_err_stream):
     """Create an archive.
 
     :param repo: Path of repository for which to generate an archive.
@@ -223,7 +229,9 @@ def init(path=".", bare=False):
         return Repo.init(path)
 
 
-def clone(source, target=None, bare=False, checkout=None, errstream=default_bytes_err_stream, outstream=None):
+def clone(source, target=None, bare=False, checkout=None,
+          errstream=default_bytes_err_stream, outstream=None,
+          origin=b"origin"):
     """Clone a local or remote git repository.
 
     :param source: Path or URL for source repository
@@ -259,6 +267,14 @@ def clone(source, target=None, bare=False, checkout=None, errstream=default_byte
         remote_refs = client.fetch(host_path, r,
             determine_wants=r.object_store.determine_wants_all,
             progress=errstream.write)
+        r.refs.import_refs(
+            b'refs/remotes/' + origin,
+            {n[len(b'refs/heads/'):]: v for (n, v) in remote_refs.items()
+                if n.startswith(b'refs/heads/')})
+        r.refs.import_refs(
+            b'refs/tags',
+            {n[len(b'refs/tags/'):]: v for (n, v) in remote_refs.items()
+                if n.startswith(b'refs/tags/')})
         r[b"HEAD"] = remote_refs[b"HEAD"]
         if checkout:
             errstream.write(b'Checking out HEAD\n')
@@ -560,7 +576,7 @@ def reset(repo, mode, committish="HEAD"):
 
 
 def push(repo, remote_location, refspecs=None,
-         outstream=sys.stdout, errstream=sys.stderr):
+         outstream=default_bytes_out_stream, errstream=default_bytes_err_stream):
     """Remote push with dulwich via dulwich.client
 
     :param repo: Path to repository
@@ -590,7 +606,7 @@ def push(repo, remote_location, refspecs=None,
             return new_refs
 
         err_encoding = getattr(errstream, 'encoding', None) or 'utf-8'
-        remote_location_bytes = remote_location.encode(err_encoding)
+        remote_location_bytes = client.get_url(path).encode(err_encoding)
         try:
             client.send_pack(path, update_refs,
                 r.object_store.generate_pack_contents, progress=errstream.write)
@@ -603,7 +619,7 @@ def push(repo, remote_location, refspecs=None,
 
 
 def pull(repo, remote_location, refspecs=None,
-         outstream=sys.stdout, errstream=sys.stderr):
+         outstream=default_bytes_out_stream, errstream=default_bytes_err_stream):
     """Pull from remote via dulwich.client
 
     :param repo: Path to repository
@@ -614,6 +630,8 @@ def pull(repo, remote_location, refspecs=None,
     """
     # Open the repo
     with open_repo_closing(repo) as r:
+        if refspecs is None:
+            refspecs = [b"HEAD"]
         selected_refs = []
         def determine_wants(remote_refs):
             selected_refs.extend(parse_reftuples(remote_refs, r.refs, refspecs))
@@ -812,7 +830,8 @@ def branch_list(repo):
         return r.refs.keys(base=b"refs/heads/")
 
 
-def fetch(repo, remote_location, outstream=sys.stdout, errstream=sys.stderr):
+def fetch(repo, remote_location, outstream=sys.stdout,
+        errstream=default_bytes_err_stream):
     """Fetch objects from a remote server.
 
     :param repo: Path to the repository
@@ -860,3 +879,31 @@ def pack_objects(repo, object_ids, packf, idxf, delta_window_size=None):
         entries = [(k, v[0], v[1]) for (k, v) in entries.items()]
         entries.sort()
         write_pack_index(idxf, entries, data_sum)
+
+
+def ls_tree(repo, tree_ish=None, outstream=sys.stdout, recursive=False,
+        name_only=False):
+    """List contents of a tree.
+
+    :param repo: Path to the repository
+    :param tree_ish: Tree id to list
+    :param outstream: Output stream (defaults to stdout)
+    :param recursive: Whether to recursively list files
+    :param name_only: Only print item name
+    """
+    def list_tree(store, treeid, base):
+        for (name, mode, sha) in store[treeid].iteritems():
+            if base:
+                name = posixpath.join(base, name)
+            if name_only:
+                outstream.write(name + b"\n")
+            else:
+                outstream.write(pretty_format_tree_entry(name, mode, sha))
+            if stat.S_ISDIR(mode):
+                list_tree(store, sha, name)
+    if tree_ish is None:
+        tree_ish = "HEAD"
+    with open_repo_closing(repo) as r:
+        c = r[tree_ish]
+        treeid = c.tree
+        list_tree(r.object_store, treeid, "")

+ 14 - 12
dulwich/protocol.py

@@ -2,20 +2,22 @@
 # Copyright (C) 2008 John Carr <john.carr@unrouted.co.uk>
 # Copyright (C) 2008-2012 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# or (at your option) any later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Generic functions for talking the git smart server protocol."""
 

+ 14 - 12
dulwich/reflog.py

@@ -1,20 +1,22 @@
 # reflog.py -- Parsing and writing reflog files
 # Copyright (C) 2015 Jelmer Vernooij and others.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Utilities for reading and generating reflogs.
 """

+ 14 - 13
dulwich/refs.py

@@ -1,21 +1,22 @@
 # refs.py -- For dealing with git refs
 # Copyright (C) 2008-2013 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 
 """Ref handling.

+ 14 - 13
dulwich/repo.py

@@ -2,21 +2,22 @@
 # Copyright (C) 2007 James Westby <jw+debian@jameswestby.net>
 # Copyright (C) 2008-2013 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 
 """Repository access.

+ 14 - 12
dulwich/server.py

@@ -2,20 +2,22 @@
 # Copyright (C) 2008 John Carr <john.carr@unrouted.co.uk>
 # Coprygith (C) 2011-2012 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# or (at your option) any later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Git smart network protocol server implementation.
 

+ 23 - 44
dulwich/tests/__init__.py

@@ -1,21 +1,22 @@
 # __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
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for Dulwich."""
 
@@ -32,41 +33,19 @@ import unittest
 from unittest import SkipTest, TestCase as _TestCase, skipIf, expectedFailure
 
 
-def get_safe_env(env=None):
-    """Returns the environment "env" (or a copy of "os.environ" by default)
-    modified to avoid side-effects caused by user's ~/.gitconfig"""
-
-    if env is None:
-        env = os.environ.copy()
-    # On Windows it's not enough to set "HOME" to a non-existing
-    # directory. Git.cmd takes the first existing directory out of
-    # "%HOME%", "%HOMEDRIVE%%HOMEPATH%" and "%USERPROFILE%".
-    for e in 'HOME', 'HOMEPATH', 'USERPROFILE':
-        env[e] = '/nosuchdir'
-    return env
-
-
 class TestCase(_TestCase):
 
-    def makeSafeEnv(self):
-        """Create environment with homedirectory-related variables stripped.
-
-        Modifies os.environ for the duration of a test case to avoid
-        side-effects caused by the user's ~/.gitconfig and other
-        files in their home directory.
-        """
-        old_env = os.environ
-        def restore():
-            os.environ = old_env
-        self.addCleanup(restore)
-        new_env = dict(os.environ)
-        for e in ['HOME', 'HOMEPATH', 'USERPROFILE']:
-            new_env[e] = '/nosuchdir'
-        os.environ = new_env
-
     def setUp(self):
         super(TestCase, self).setUp()
-        self.makeSafeEnv()
+        self._old_home = os.environ.get("HOME")
+        os.environ["HOME"] = "/nonexistant"
+
+    def tearDown(self):
+        super(TestCase, self).tearDown()
+        if self._old_home:
+            os.environ["HOME"] = self._old_home
+        else:
+            del os.environ["HOME"]
 
 
 class BlackboxTestCase(TestCase):

+ 14 - 13
dulwich/tests/compat/__init__.py

@@ -1,21 +1,22 @@
 # __init__.py -- Compatibility tests for dulwich
 # Copyright (C) 2010 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Compatibility tests for Dulwich."""
 

+ 14 - 13
dulwich/tests/compat/server_utils.py

@@ -1,21 +1,22 @@
 # server_utils.py -- Git server compatibility utilities
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Utilities for testing git server compatibility."""
 

+ 16 - 17
dulwich/tests/compat/test_client.py

@@ -1,21 +1,22 @@
 # test_client.py -- Compatibilty tests for git client.
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Compatibilty tests between the Dulwich client and the cgit server."""
 
@@ -58,7 +59,6 @@ from dulwich import (
     repo,
     )
 from dulwich.tests import (
-    get_safe_env,
     SkipTest,
     expectedFailure,
     )
@@ -268,7 +268,6 @@ class DulwichTCPClientTest(CompatTestCase, DulwichClientTestBase):
         if check_for_daemon(limit=1):
             raise SkipTest('git-daemon was already running on port %s' %
                               protocol.TCP_GIT_PORT)
-        env = get_safe_env()
         fd, self.pidfile = tempfile.mkstemp(prefix='dulwich-test-git-client',
                                             suffix=".pid")
         os.fdopen(fd).close()
@@ -279,7 +278,7 @@ class DulwichTCPClientTest(CompatTestCase, DulwichClientTestBase):
                 '--listen=localhost', '--reuseaddr',
                 self.gitroot]
         self.process = subprocess.Popen(
-            args, env=env, cwd=self.gitroot,
+            args, cwd=self.gitroot,
             stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         if not check_for_daemon():
             raise SkipTest('git-daemon failed to start')
@@ -324,7 +323,7 @@ class TestSSHVendor(object):
         cmd, path = command.split(b' ')
         cmd = cmd.split(b'-', 1)
         path = path.replace(b"'", b"")
-        p = subprocess.Popen(cmd + [path], bufsize=0, env=get_safe_env(), stdin=subprocess.PIPE,
+        p = subprocess.Popen(cmd + [path], bufsize=0, stdin=subprocess.PIPE,
                              stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         return client.SubprocessWrapper(p)
 

+ 14 - 13
dulwich/tests/compat/test_pack.py

@@ -1,21 +1,22 @@
 # test_pack.py -- Compatibility tests for git packs.
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Compatibility tests for git packs."""
 

+ 14 - 13
dulwich/tests/compat/test_repository.py

@@ -1,21 +1,22 @@
 # test_repo.py -- Git repo compatibility tests
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Compatibility tests for dulwich repositories."""
 

+ 14 - 13
dulwich/tests/compat/test_server.py

@@ -1,21 +1,22 @@
 # test_server.py -- Compatibility tests for git server.
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Compatibility tests between Dulwich and the cgit server.
 

+ 14 - 13
dulwich/tests/compat/test_utils.py

@@ -1,21 +1,22 @@
 # test_utils.py -- Tests for git compatibility utilities
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA  02110-1301, USA.
 
 """Tests for git compatibility utilities."""
 

+ 14 - 13
dulwich/tests/compat/test_web.py

@@ -1,21 +1,22 @@
 # test_web.py -- Compatibility tests for the git web server.
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Compatibility tests between Dulwich and the cgit HTTP server.
 

+ 15 - 15
dulwich/tests/compat/utils.py

@@ -1,21 +1,22 @@
 # utils.py -- Git compatibility utilities
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Utilities for interacting with cgit."""
 
@@ -34,7 +35,6 @@ from dulwich.repo import Repo
 from dulwich.protocol import TCP_GIT_PORT
 
 from dulwich.tests import (
-    get_safe_env,
     SkipTest,
     TestCase,
     )
@@ -123,7 +123,7 @@ def run_git(args, git_path=_DEFAULT_GIT, input=None, capture_stdout=False,
     :raise OSError: if the git executable was not found.
     """
 
-    env = get_safe_env(popen_kwargs.pop('env', None))
+    env = popen_kwargs.pop('env', {})
     env['LC_ALL'] = env['LANG'] = 'C'
 
     args = [git_path] + args

+ 14 - 12
dulwich/tests/test_archive.py

@@ -1,20 +1,22 @@
 # test_archive.py -- tests for archive
 # Copyright (C) 2015 Jelmer Vernooij <jelmer@jelmer.uk>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) a later version.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for archive support."""
 

+ 14 - 12
dulwich/tests/test_blackbox.py

@@ -1,20 +1,22 @@
 # test_blackbox.py -- blackbox tests
 # Copyright (C) 2010 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) a later version.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Blackbox tests for Dulwich commands."""
 

+ 66 - 12
dulwich/tests/test_client.py

@@ -1,20 +1,22 @@
 # test_client.py -- Tests for the git protocol, client side
 # Copyright (C) 2009 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# or (at your option) any later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 from contextlib import closing
 from io import BytesIO
@@ -582,6 +584,20 @@ class SSHGitClientTests(TestCase):
         super(SSHGitClientTests, self).tearDown()
         client.get_ssh_vendor = self.real_vendor
 
+    def test_get_url(self):
+        path = '/tmp/repo.git'
+        c = SSHGitClient('git.samba.org')
+
+        url = c.get_url(path)
+        self.assertEqual('ssh://git.samba.org/tmp/repo.git', url)
+
+    def test_get_url_with_username_and_port(self):
+        path = '/tmp/repo.git'
+        c = SSHGitClient('git.samba.org', port=2222, username='user')
+
+        url = c.get_url(path)
+        self.assertEqual('ssh://user@git.samba.org:2222/tmp/repo.git', url)
+
     def test_default_command(self):
         self.assertEqual(b'git-upload-pack',
                 self.client._get_cmd_path(b'upload-pack'))
@@ -641,6 +657,13 @@ class ReportStatusParserTests(TestCase):
 
 class LocalGitClientTests(TestCase):
 
+    def test_get_url(self):
+        path = "/tmp/repo.git"
+        c = LocalGitClient()
+
+        url = c.get_url(path)
+        self.assertEqual('file:///tmp/repo.git', url)
+
     def test_fetch_into_empty(self):
         c = LocalGitClient()
         t = MemoryRepo()
@@ -710,3 +733,34 @@ class LocalGitClientTests(TestCase):
         obj_local = local.get_object(new_refs[ref_name])
         obj_target = target.get_object(new_refs[ref_name])
         self.assertEqual(obj_local, obj_target)
+
+
+class HttpGitClientTests(TestCase):
+
+    def test_get_url(self):
+        base_url = 'https://github.com/jelmer/dulwich'
+        path = '/jelmer/dulwich'
+        c = HttpGitClient(base_url)
+
+        url = c.get_url(path)
+        self.assertEqual('https://github.com/jelmer/dulwich', url)
+
+
+class TCPGitClientTests(TestCase):
+
+    def test_get_url(self):
+        host = 'github.com'
+        path = '/jelmer/dulwich'
+        c = TCPGitClient(host)
+
+        url = c.get_url(path)
+        self.assertEqual('git://github.com/jelmer/dulwich', url)
+
+    def test_get_url_with_port(self):
+        host = 'github.com'
+        path = '/jelmer/dulwich'
+        port = 9090
+        c = TCPGitClient(host, port=9090)
+
+        url = c.get_url(path)
+        self.assertEqual('git://github.com:9090/jelmer/dulwich', url)

+ 15 - 12
dulwich/tests/test_config.py

@@ -1,24 +1,27 @@
 # test_config.py -- Tests for reading and writing configuration files
 # Copyright (C) 2011 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for reading and writing configuration files."""
 
 from io import BytesIO
+import os
 from dulwich.config import (
     ConfigDict,
     ConfigFile,

+ 14 - 12
dulwich/tests/test_diff_tree.py

@@ -1,20 +1,22 @@
 # test_diff_tree.py -- Tests for file and tree diff utilities.
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for file and tree diff utilities."""
 

+ 14 - 13
dulwich/tests/test_fastexport.py

@@ -1,21 +1,22 @@
 # test_fastexport.py -- Fast export/import functionality
 # Copyright (C) 2010 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 from io import BytesIO
 import stat

+ 14 - 12
dulwich/tests/test_file.py

@@ -1,20 +1,22 @@
 # test_file.py -- Test for git files
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 import errno
 import io

+ 14 - 12
dulwich/tests/test_grafts.py

@@ -1,19 +1,21 @@
 # test_grafts.py -- Tests for graftpoints
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for graftpoints."""
 

+ 14 - 13
dulwich/tests/test_greenthreads.py

@@ -3,21 +3,22 @@
 #
 # Author: Fabien Boucher <fabien.boucher@enovance.com>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 import time
 

+ 14 - 12
dulwich/tests/test_hooks.py

@@ -1,19 +1,21 @@
 # test_hooks.py -- Tests for executing hooks
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# or (at your option) a later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for executing hooks."""
 

+ 14 - 12
dulwich/tests/test_index.py

@@ -3,20 +3,22 @@
 # encoding: utf-8
 # Copyright (C) 2008-2009 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# or (at your option) any later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for the index."""
 

+ 14 - 11
dulwich/tests/test_lru_cache.py

@@ -1,18 +1,21 @@
 # Copyright (C) 2006, 2008 Canonical Ltd
 #
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
 """Tests for the lru_cache module."""
 

+ 14 - 12
dulwich/tests/test_missing_obj_finder.py

@@ -1,20 +1,22 @@
 # test_missing_obj_finder.py -- tests for MissingObjectFinder
 # Copyright (C) 2012 syntevo GmbH
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# or (at your option) any later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 from dulwich.object_store import (
     MemoryObjectStore,

+ 14 - 12
dulwich/tests/test_object_store.py

@@ -1,20 +1,22 @@
 # test_object_store.py -- tests for object_store.py
 # Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# or (at your option) any later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for the object store interface."""
 

+ 26 - 14
dulwich/tests/test_objects.py

@@ -1,21 +1,22 @@
 # test_objects.py -- tests for objects.py
 # Copyright (C) 2007 James Westby <jw+debian@jameswestby.net>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for git base objects."""
 
@@ -48,8 +49,9 @@ from dulwich.objects import (
     hex_to_filename,
     check_hexsha,
     check_identity,
-    parse_timezone,
     object_class,
+    parse_timezone,
+    pretty_format_tree_entry,
     parse_tree,
     _parse_tree_py,
     sorted_tree_items,
@@ -1130,3 +1132,13 @@ class ShaFileSerializeTests(TestCase):
 
         with self.assert_serialization_on_change(tag):
             tag.message = b'new message'
+
+
+class PrettyFormatTreeEntryTests(TestCase):
+
+    def test_format(self):
+        self.assertEqual(
+                '40000 tree 40820c38cfb182ce6c8b261555410d8382a5918b\tfoo\n',
+                pretty_format_tree_entry(b"foo", 0o40000,
+                    b"40820c38cfb182ce6c8b261555410d8382a5918b"))
+

+ 14 - 13
dulwich/tests/test_objectspec.py

@@ -1,21 +1,22 @@
 # test_objectspec.py -- tests for objectspec.py
 # Copyright (C) 2014 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for revision spec parsing."""
 

+ 14 - 12
dulwich/tests/test_pack.py

@@ -2,20 +2,22 @@
 # Copyright (C) 2007 James Westby <jw+debian@jameswestby.net>
 # Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License, or (at your option) any later version of the license.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for Dulwich packs."""
 

+ 14 - 12
dulwich/tests/test_patch.py

@@ -1,20 +1,22 @@
 # test_patch.py -- tests for patch.py
 # Copyright (C) 2010 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) a later version.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for patch.py."""
 

+ 69 - 23
dulwich/tests/test_porcelain.py

@@ -1,20 +1,22 @@
 # test_porcelain.py -- porcelain tests
 # Copyright (C) 2013 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) a later version.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for dulwich.porcelain."""
 
@@ -112,13 +114,16 @@ class CloneTests(PorcelainTestCase):
         c1, c2, c3 = build_commit_graph(self.repo.object_store,
                                         commit_spec, trees)
         self.repo.refs[b"refs/heads/master"] = c3.id
+        self.repo.refs[b"refs/tags/foo"] = c3.id
         target_path = tempfile.mkdtemp()
         errstream = BytesIO()
         self.addCleanup(shutil.rmtree, target_path)
         r = porcelain.clone(self.repo.path, target_path,
                             checkout=False, errstream=errstream)
         self.assertEqual(r.path, target_path)
-        self.assertEqual(Repo(target_path).head(), c3.id)
+        target_repo = Repo(target_path)
+        self.assertEqual(target_repo.head(), c3.id)
+        self.assertEquals(c3.id, target_repo.refs[b'refs/tags/foo'])
         self.assertTrue(b'f1' not in os.listdir(target_path))
         self.assertTrue(b'f2' not in os.listdir(target_path))
 
@@ -532,10 +537,8 @@ class PushTests(PorcelainTestCase):
 
 class PullTests(PorcelainTestCase):
 
-    def test_simple(self):
-        outstream = BytesIO()
-        errstream = BytesIO()
-
+    def setUp(self):
+        super(PullTests, self).setUp()
         # create a file for initial commit
         handle, fullpath = tempfile.mkstemp(dir=self.repo.path)
         os.close(handle)
@@ -545,10 +548,10 @@ class PullTests(PorcelainTestCase):
                          author=b'test', committer=b'test')
 
         # Setup target repo
-        target_path = tempfile.mkdtemp()
-        self.addCleanup(shutil.rmtree, target_path)
-        target_repo = porcelain.clone(self.repo.path, target=target_path,
-                                      errstream=errstream)
+        self.target_path = tempfile.mkdtemp()
+        self.addCleanup(shutil.rmtree, self.target_path)
+        target_repo = porcelain.clone(self.repo.path, target=self.target_path,
+                errstream=BytesIO())
         target_repo.close()
 
         # create a second file to be pushed
@@ -562,12 +565,28 @@ class PullTests(PorcelainTestCase):
         self.assertTrue(b'refs/heads/master' in self.repo.refs)
         self.assertTrue(b'refs/heads/master' in target_repo.refs)
 
+    def test_simple(self):
+        outstream = BytesIO()
+        errstream = BytesIO()
+
         # Pull changes into the cloned repo
-        porcelain.pull(target_path, self.repo.path, b'refs/heads/master',
+        porcelain.pull(self.target_path, self.repo.path, b'refs/heads/master',
             outstream=outstream, errstream=errstream)
 
         # Check the target repo for pushed changes
-        with closing(Repo(target_path)) as r:
+        with closing(Repo(self.target_path)) as r:
+            self.assertEqual(r[b'HEAD'].id, self.repo[b'HEAD'].id)
+
+    def test_no_refspec(self):
+        outstream = BytesIO()
+        errstream = BytesIO()
+
+        # Pull changes into the cloned repo
+        porcelain.pull(self.target_path, self.repo.path, outstream=outstream,
+                       errstream=errstream)
+
+        # Check the target repo for pushed changes
+        with closing(Repo(self.target_path)) as r:
             self.assertEqual(r[b'HEAD'].id, self.repo[b'HEAD'].id)
 
 
@@ -802,3 +821,30 @@ class RepackTests(PorcelainTestCase):
         filename = os.path.basename(fullpath)
         porcelain.add(repo=self.repo.path, paths=filename)
         porcelain.repack(self.repo)
+
+
+class LsTreeTests(PorcelainTestCase):
+
+    def test_empty(self):
+        porcelain.commit(repo=self.repo.path, message=b'test status',
+            author=b'', committer=b'')
+
+        f = StringIO()
+        porcelain.ls_tree(self.repo, b"HEAD", outstream=f)
+        self.assertEqual(f.getvalue(), "")
+
+    def test_simple(self):
+        # Commit a dummy file then modify it
+        fullpath = os.path.join(self.repo.path, 'foo')
+        with open(fullpath, 'w') as f:
+            f.write('origstuff')
+
+        porcelain.add(repo=self.repo.path, paths=['foo'])
+        porcelain.commit(repo=self.repo.path, message=b'test status',
+            author=b'', committer=b'')
+
+        f = StringIO()
+        porcelain.ls_tree(self.repo, b"HEAD", outstream=f)
+        self.assertEqual(
+                f.getvalue(),
+                '100644 blob 8b82634d7eae019850bb883f06abf428c58bc9aa\tfoo\n')

+ 14 - 12
dulwich/tests/test_protocol.py

@@ -1,20 +1,22 @@
 # test_protocol.py -- Tests for the git protocol
 # Copyright (C) 2009 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# or (at your option) any later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for the smart protocol utility functions."""
 

+ 14 - 13
dulwich/tests/test_reflog.py

@@ -2,21 +2,22 @@
 # encoding: utf-8
 # Copyright (C) 2015 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for dulwich.reflog."""
 

+ 14 - 13
dulwich/tests/test_refs.py

@@ -2,21 +2,22 @@
 # encoding: utf-8
 # Copyright (C) 2013 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for dulwich.refs."""
 

+ 14 - 13
dulwich/tests/test_repository.py

@@ -2,21 +2,22 @@
 # test_repository.py -- tests for repository.py
 # Copyright (C) 2007 James Westby <jw+debian@jameswestby.net>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for the repository."""
 

+ 14 - 12
dulwich/tests/test_server.py

@@ -1,20 +1,22 @@
 # test_server.py -- Tests for the git server
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# or (at your option) any later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for the smart protocol server."""
 

+ 14 - 13
dulwich/tests/test_utils.py

@@ -1,21 +1,22 @@
 # test_utils.py -- Tests for git test utilities.
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA  02110-1301, USA.
 
 """Tests for git test utilities."""
 

+ 14 - 12
dulwich/tests/test_walk.py

@@ -1,20 +1,22 @@
 # test_walk.py -- Tests for commit walking functionality.
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# or (at your option) any later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for commit walking functionality."""
 

+ 14 - 12
dulwich/tests/test_web.py

@@ -1,20 +1,22 @@
 # test_web.py -- Tests for the git HTTP server
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# or (at your option) any later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Tests for the Git HTTP server."""
 

+ 14 - 13
dulwich/tests/utils.py

@@ -1,21 +1,22 @@
 # utils.py -- Test utilities for Dulwich.
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License or (at your option) any later version of
-# the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """Utility functions common to Dulwich tests."""
 

+ 14 - 12
dulwich/walk.py

@@ -1,20 +1,22 @@
 # walk.py -- General implementation of walking commits and their contents.
 # Copyright (C) 2010 Google, Inc.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# or (at your option) any later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """General implementation of walking commits and their contents."""
 

+ 14 - 12
dulwich/web.py

@@ -2,20 +2,22 @@
 # Copyright (C) 2010 Google, Inc.
 # Copyright (C) 2012 Jelmer Vernooij <jelmer@samba.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# or (at your option) any later version of the License.
+# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
+# General Public License as public by the Free Software Foundation; version 2.0
+# or (at your option) any later version. You can redistribute it and/or
+# modify it under the terms of either of these two licenses.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# You should have received a copy of the licenses; if not, see
+# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
+# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
+# License, Version 2.0.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.
 
 """HTTP server for dulwich that implements the git smart HTTP protocol."""
 

+ 0 - 23
relicensing-apachev2.txt

@@ -1,23 +0,0 @@
-At the moment, Dulwich is licensed under the GNU General Public License,
-version 2 or later.
-
-We'd like to relicense Dulwich under the Apache v2 (or later) license, as
-the GPL is problematic for many free software Python projects that are under
-BSD-style licenses. See also https://github.com/jelmer/dulwich/issues/153
-
-For reference, a full copy of the Apachev2 license can be found here:
-https://www.apache.org/licenses/LICENSE-2.0
-
-New contributions to Dulwich should be dual licensed under the GNU GPLv2 (or
-later) and the Apachev2 (or later) licenses.
-
-Contributions made prior were contributed under the GPLv2 (or later) license
-alone. Code written by the following contributors has not (yet) been relicensed
-under dual Apachev2/GPLv2:
-
-Artem Tikhomirov <artem.tikhomirov@syntevo.com>
-Risto Kankkunen <risto.kankkunen@f-secure.com> <risto.kankkunen@iki.fi>
-
-If your name is in this list and you'd be happy to relicense your contribution
-under dual GPLv2/Apachev2, then please send me an e-mail (jelmer@jelmer.uk) or
-a pull request on GitHub removing your name from the list above.

+ 7 - 6
setup.py

@@ -1,6 +1,7 @@
 #!/usr/bin/python
+# encoding: utf-8
 # Setup file for dulwich
-# Copyright (C) 2008-2016 Jelmer Vernooij <jelmer@jelmer.uk>
+# Copyright (C) 2008-2016 Jelmer Vernooij <jelmer@jelmer.uk>
 
 try:
     from setuptools import setup, Extension
@@ -8,7 +9,7 @@ except ImportError:
     from distutils.core import setup, Extension
 from distutils.core import Distribution
 
-dulwich_version_string = '0.14.1'
+dulwich_version_string = '0.15.0'
 
 include_dirs = []
 # Windows MSVC support
@@ -70,8 +71,8 @@ setup(name='dulwich',
       keywords='git',
       version=dulwich_version_string,
       url='https://www.dulwich.io/',
-      license='GPLv2 or later',
-      author='Jelmer Vernooij',
+      license='Apachev2 or later or GPLv2',
+      author='Jelmer Vernooij',
       author_email='jelmer@jelmer.uk',
       long_description="""
       Python implementation of the Git file formats and protocols,
@@ -88,10 +89,10 @@ setup(name='dulwich',
       scripts=['bin/dulwich', 'bin/dul-receive-pack', 'bin/dul-upload-pack'],
       classifiers=[
           'Development Status :: 4 - Beta',
-          'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
-          'Programming Language :: Python :: 2.6',
+          'License :: OSI Approved :: Apache Software License',
           'Programming Language :: Python :: 2.7',
           'Programming Language :: Python :: 3.4',
+          'Programming Language :: Python :: 3.5',
           'Programming Language :: Python :: Implementation :: CPython',
           'Programming Language :: Python :: Implementation :: PyPy',
           'Operating System :: POSIX',