equal
deleted
inserted
replaced
8 |
8 |
9 This software may be used and distributed according to the terms |
9 This software may be used and distributed according to the terms |
10 of the GNU General Public License, incorporated herein by reference. |
10 of the GNU General Public License, incorporated herein by reference. |
11 """ |
11 """ |
12 |
12 |
13 import zlib, struct, sha, binascii, heapq |
|
14 import mdiff |
|
15 from node import * |
13 from node import * |
|
14 from demandload import demandload |
|
15 demandload(globals(), "binascii errno heapq mdiff sha struct urllib2 zlib") |
16 |
16 |
17 def hash(text, p1, p2): |
17 def hash(text, p1, p2): |
18 """generate a hash from the given text and its parent hashes |
18 """generate a hash from the given text and its parent hashes |
19 |
19 |
20 This hash combines both the current file contents and its history |
20 This hash combines both the current file contents and its history |
177 self.opener = opener |
177 self.opener = opener |
178 self.cache = None |
178 self.cache = None |
179 |
179 |
180 try: |
180 try: |
181 i = self.opener(self.indexfile).read() |
181 i = self.opener(self.indexfile).read() |
182 except IOError: |
182 except urllib2.URLError: |
|
183 raise |
|
184 except IOError, inst: |
|
185 if inst.errno != errno.ENOENT: |
|
186 raise |
183 i = "" |
187 i = "" |
184 |
188 |
185 if len(i) > 10000: |
189 if len(i) > 10000: |
186 # big index, let's parse it on demand |
190 # big index, let's parse it on demand |
187 parser = lazyparser(i, self) |
191 parser = lazyparser(i, self) |