/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to dulwich/protocol.py

  • Committer: Jelmer Vernooij
  • Date: 2009-01-14 18:24:38 UTC
  • mto: (0.222.3 dulwich)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20090114182438-c0tn5eczyupi4ztn
Fix download url, add version number.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
# This program is free software; you can redistribute it and/or
6
6
# modify it under the terms of the GNU General Public License
7
7
# as published by the Free Software Foundation; version 2
8
 
# of the License.
 
8
# or (at your option) any later version of the License.
9
9
#
10
10
# This program is distributed in the hope that it will be useful,
11
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17
17
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
18
# MA  02110-1301, USA.
19
19
 
 
20
from errors import HangupException
 
21
 
20
22
TCP_GIT_PORT = 9418
21
23
 
22
24
class ProtocolFile(object):
50
52
        """
51
53
        sizestr = self.read(4)
52
54
        if not sizestr:
53
 
            return None
 
55
            raise HangupException()
54
56
        size = int(sizestr, 16)
55
57
        if size == 0:
56
58
            return None
80
82
        :param channel: int specifying which channel to write to
81
83
        :param blob: a blob of data (as a string) to send on this channel
82
84
        """
83
 
        # a pktline can be a max of 65535. a sideband line can therefore be
84
 
        # 65535-5 = 65530
 
85
        # a pktline can be a max of 65520. a sideband line can therefore be
 
86
        # 65520-5 = 65515
85
87
        # WTF: Why have the len in ASCII, but the channel in binary.
86
88
        while blob:
87
 
            self.write_pkt_line("%s%s" % (chr(channel), blob[:65530]))
88
 
            blob = blob[65530:]
 
89
            self.write_pkt_line("%s%s" % (chr(channel), blob[:65515]))
 
90
            blob = blob[65515:]
89
91
 
90
92
    def send_cmd(self, cmd, *args):
91
93
        """
110
112
        splice_at = line.find(" ")
111
113
        cmd, args = line[:splice_at], line[splice_at+1:]
112
114
        return cmd, args.split(chr(0))
113
 
 
 
115
 
114
116
 
115
117
def extract_capabilities(text):
116
118
    if not "\0" in text: