Kiln » Dependencies » Dulwich Read More
Clone URL:  
Pushed to one repository · View In Graph Contained in master, master-1, and master-0

Fix formatting issues.

Changeset e82ea2af530f

Parent 91219a6b9e27

by Jelmer Vernooij

Changes to 16 files · Browse files at e82ea2af530f Showing diff from parent 91219a6b9e27 Diff from another changeset...

 
1
2
 
3
4
5
 
1
2
3
4
5
6
@@ -1,5 +1,6 @@
 # __init__.py -- The git module of dulwich  # Copyright (C) 2007 James Westby <jw+debian@jameswestby.net> +# Copyright (C) 2008 Jelmer Vernooji <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
Change 1 of 1 Show Entire File dulwich/​client.py Stacked
 
20
21
22
23
24
 
 
 
 
 
 
 
 
 
25
26
27
 
20
21
22
 
 
23
24
25
26
27
28
29
30
31
32
33
34
@@ -20,8 +20,15 @@
 import select  import socket  import subprocess -from dulwich.protocol import Protocol, TCP_GIT_PORT, extract_capabilities -from dulwich.pack import write_pack_data + +from dulwich.protocol import ( + Protocol, + TCP_GIT_PORT, + extract_capabilities, + ) +from dulwich.pack import ( + write_pack_data, + )    class SimpleFetchGraphWalker(object):  
Change 1 of 2 Show Entire File dulwich/​errors.py Stacked
 
16
17
18
 
 
19
20
21
 
29
30
31
 
32
33
34
35
 
36
37
38
39
40
41
 
42
43
44
45
 
46
47
48
 
16
17
18
19
20
21
22
23
 
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
@@ -16,6 +16,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301, USA.   +"""Dulwich-related exception classes and utility functions.""" +  class WrongObjectException(Exception):   """Baseclass for all the _ is not a _ exceptions on objects.   @@ -29,20 +31,24 @@
  string = "%s is not a %s" % (sha, self._type)   Exception.__init__(self, string)   +  class NotCommitError(WrongObjectException):   """Indicates that the sha requested does not point to a commit."""     _type = 'commit' +    class NotTreeError(WrongObjectException):   """Indicates that the sha requested does not point to a tree."""     _type = 'tree'   +  class NotBlobError(WrongObjectException):   """Indicates that the sha requested does not point to a blob."""     _type = 'blob' +    class MissingCommitError(Exception):   """Indicates that a commit was not found in the repository"""
Change 1 of 1 Show Entire File dulwich/​index.py Stacked
 
23
24
25
 
26
27
 
28
29
30
 
23
24
25
26
27
28
29
30
31
32
@@ -23,8 +23,10 @@
 def read_cache_time(f):   return struct.unpack(">LL", f.read(8))   +  def write_cache_time(f, t):   f.write(struct.pack(">LL", *t)) +    def read_cache_entry(f):   beginoffset = f.tell()
Change 1 of 4 Show Entire File dulwich/​misc.py Stacked
 
15
16
17
18
 
19
20
21
22
 
23
24
25
 
28
29
30
31
 
32
33
34
 
72
73
74
75
 
76
77
78
 
81
82
83
84
 
85
86
87
 
15
16
17
 
18
19
20
21
 
22
23
24
25
 
28
29
30
 
31
32
33
34
 
72
73
74
 
75
76
77
78
 
81
82
83
 
84
85
86
87
@@ -15,11 +15,11 @@
 # along with this program; if not, write to the Free Software  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301, USA. -'''Misc utilities to work with python2.4. +"""Misc utilities to work with python2.4.    These utilities can all be deleted when dulwich decides it wants to stop  support for python 2.4. -''' +"""  try:   import hashlib  except ImportError: @@ -28,7 +28,7 @@
     class defaultdict(dict): - '''A python 2.4 equivalent of collections.defaultdict.''' + """A python 2.4 equivalent of collections.defaultdict."""     def __init__(self, default_factory=None, *a, **kw):   if (default_factory is not None and @@ -72,7 +72,7 @@
     def make_sha(source=''): - '''A python2.4 workaround for the sha/hashlib module fiasco.''' + """A python2.4 workaround for the sha/hashlib module fiasco."""   try:   return hashlib.sha1(source)   except NameError: @@ -81,7 +81,7 @@
     def unpack_from(fmt, buf, offset=0): - '''A python2.4 workaround for struct missing unpack_from.''' + """A python2.4 workaround for struct missing unpack_from."""   try:   return struct.unpack_from(fmt, buf, offset)   except AttributeError:
 
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
37
38
 
16
17
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@@ -16,23 +16,23 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301, USA.   -from dulwich.objects import ( - hex_to_sha, - sha_to_hex, - ShaFile, - ) -from dulwich.pack import ( - iter_sha1, - load_packs, - write_pack, - write_pack_data, - write_pack_index_v2, - PackData, - ) -  import os  import tempfile  import urllib2 + +from dulwich.objects import ( + hex_to_sha, + sha_to_hex, + ShaFile, + ) +from dulwich.pack import ( + iter_sha1, + load_packs, + write_pack, + write_pack_data, + write_pack_index_v2, + PackData, + )    PACKDIR = 'pack'  
 
25
26
27
28
29
30
31
 
 
 
 
 
32
33
34
 
25
26
27
 
 
 
 
28
29
30
31
32
33
34
35
@@ -25,10 +25,11 @@
 import sha  import zlib   -from errors import (NotCommitError, - NotTreeError, - NotBlobError, - ) +from dulwich.errors import ( + NotBlobError, + NotCommitError, + NotTreeError, + )    BLOB_ID = "blob"  TAG_ID = "tag"
Change 1 of 2 Show Entire File dulwich/​pack.py Stacked
 
42
43
44
45
 
46
47
48
49
50
51
52
53
54
55
56
 
 
 
 
 
 
 
57
58
59
 
419
420
421
 
422
423
424
 
42
43
44
 
45
46
47
48
49
 
 
 
 
 
 
 
50
51
52
53
54
55
56
57
58
59
 
419
420
421
422
423
424
425
@@ -42,18 +42,18 @@
 try:   from struct import unpack_from  except ImportError: - from misc import unpack_from + from dulwich.misc import unpack_from  import sys  import zlib  import difflib   -from objects import ( - ShaFile, - hex_to_sha, - sha_to_hex, - ) -from errors import ApplyDeltaError -from misc import make_sha +from dulwich.objects import ( + ShaFile, + hex_to_sha, + sha_to_hex, + ) +from dulwich.errors import ApplyDeltaError +from dulwich.misc import make_sha    supports_mmap_offset = (sys.version_info[0] >= 3 or   (sys.version_info[0] == 2 and sys.version_info[1] >= 6)) @@ -419,6 +419,7 @@
  return self._num_objects     def calculate_checksum(self): + """Calculate the checksum for this pack."""   f = open(self._filename, 'rb')   try:   map = simple_mmap(f, 0, self._size)
 
17
18
19
20
 
 
21
 
 
 
 
 
22
23
24
 
122
123
124
 
 
 
 
 
 
125
126
127
 
17
18
19
 
20
21
22
23
24
25
26
27
28
29
30
 
128
129
130
131
132
133
134
135
136
137
138
139
@@ -17,8 +17,14 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301, USA.   -from errors import HangupException, GitProtocolError +"""Generic functions for talking the git smart server protocol.""" +  import socket + +from dulwich.errors import ( + HangupException, + GitProtocolError, + )    TCP_GIT_PORT = 9418   @@ -122,6 +128,12 @@
     def extract_capabilities(text): + """Extract a capabilities list from a string, if present. + + :param text: String to extract from + :return: Tuple with text with capabilities removed and list of + capabilities or None (if no capabilities were present. + """   if not "\0" in text:   return text, None   capabilities = text.split("\0")
Change 1 of 1 Show Entire File dulwich/​repo.py Stacked
 
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
40
41
 
18
19
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
@@ -18,24 +18,24 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301, USA.   -import os, stat - -from commit import Commit -from errors import ( - MissingCommitError, - NotBlobError, - NotCommitError, - NotGitRepository, - NotTreeError, - ) -from object_store import ObjectStore -from objects import ( - ShaFile, - Commit, - Tag, - Tree, - Blob, - ) +import os +import stat + +from dulwich.errors import ( + MissingCommitError, + NotBlobError, + NotCommitError, + NotGitRepository, + NotTreeError, + ) +from dulwich.object_store import ObjectStore +from dulwich.objects import ( + Blob, + Commit, + ShaFile, + Tag, + Tree, + )    OBJECTDIR = 'objects'  SYMREF = 'ref: '
Change 1 of 1 Show Entire File dulwich/​server.py Stacked
 
17
18
19
20
21
22
23
 
 
 
 
 
 
 
 
 
 
 
 
 
24
25
26
 
17
18
19
 
 
 
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
@@ -17,10 +17,20 @@
 # MA 02110-1301, USA.    import SocketServer -from dulwich.protocol import Protocol, ProtocolFile, TCP_GIT_PORT, extract_capabilities -from dulwich.repo import Repo -from dulwich.pack import write_pack_data  import tempfile + +from dulwich.protocol import ( + Protocol, + ProtocolFile, + TCP_GIT_PORT, + extract_capabilities, + ) +from dulwich.repo import ( + Repo, + ) +from dulwich.pack import ( + write_pack_data, + )    class Backend(object):  
 
18
19
20
21
22
23
 
 
 
 
 
 
24
25
26
 
18
19
20
 
 
 
21
22
23
24
25
26
27
28
29
@@ -18,9 +18,12 @@
 # MA 02110-1301, USA.    import unittest -import test_objects -import test_repository -import test_pack + +from dulwich.tests import ( + test_objects, + test_repository, + test_pack, + )    def test_suite():   test_modules = [test_objects, test_repository, test_pack]
 
16
17
18
19
20
21
 
 
 
 
 
22
23
24
 
16
17
18
 
19
20
21
22
23
24
25
26
27
28
@@ -16,9 +16,13 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301, USA.   -from dulwich.index import Index, write_index  import os  from unittest import TestCase + +from dulwich.index import ( + Index, + write_index, + )    class IndexTestCase(TestCase):  
 
16
17
18
 
 
19
20
21
22
23
 
16
17
18
19
20
21
 
22
23
24
@@ -16,8 +16,9 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301, USA.   +from unittest import TestCase +  from dulwich.object_store import ObjectStore -from unittest import TestCase    class ObjectStoreTests(TestCase):  
 
20
21
22
23
24
25
26
27
 
 
 
 
 
 
28
29
30
 
20
21
22
 
 
 
 
 
23
24
25
26
27
28
29
30
31
@@ -20,11 +20,12 @@
 import os  import unittest   -from dulwich.objects import (Blob, - Tree, - Commit, - Tag - ) +from dulwich.objects import ( + Blob, + Tree, + Commit, + Tag, + )    a_sha = '6f670c0fb53f9463760b7295fbb814e965fb20c8'  b_sha = '2969be3e8ee1c0222396a5611407e4769f14e54b'
 
21
22
23
24
25
 
 
26
27
28
29
30
31
32
33
34
35
36
37
38
 
 
 
 
 
 
 
 
 
 
 
 
39
40
41
 
21
22
23
 
 
24
25
26
 
 
 
 
 
 
 
 
 
 
 
 
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
@@ -21,21 +21,21 @@
 import unittest    from dulwich.objects import ( - Tree, - ) + Tree, + )  from dulwich.pack import ( - Pack, - PackIndex, - PackData, - hex_to_sha, - sha_to_hex, - write_pack_index_v1, - write_pack_index_v2, - write_pack, - apply_delta, - create_delta, - read_zlib, - ) + Pack, + PackIndex, + PackData, + apply_delta, + create_delta, + hex_to_sha, + read_zlib, + sha_to_hex, + write_pack_index_v1, + write_pack_index_v2, + write_pack, + )    pack1_sha = 'bc63ddad95e7321ee734ea11a7a62d314e0d7481'