Show More
@@ -6,7 +6,7 b'' | |||||
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from i18n import _ |
|
8 | from i18n import _ | |
9 | import mdiff, parsers, error, revlog |
|
9 | import mdiff, parsers, error, revlog, util | |
10 | import array, struct |
|
10 | import array, struct | |
11 |
|
11 | |||
12 | class manifestdict(dict): |
|
12 | class manifestdict(dict): | |
@@ -164,7 +164,7 b' class manifest(revlog.revlog):' | |||||
164 | dline = [""] |
|
164 | dline = [""] | |
165 | start = 0 |
|
165 | start = 0 | |
166 | # zero copy representation of addlist as a buffer |
|
166 | # zero copy representation of addlist as a buffer | |
167 | addbuf = buffer(addlist) |
|
167 | addbuf = util.buffer(addlist) | |
168 |
|
168 | |||
169 | # start with a readonly loop that finds the offset of |
|
169 | # start with a readonly loop that finds the offset of | |
170 | # each line and creates the deltas |
|
170 | # each line and creates the deltas | |
@@ -196,7 +196,7 b' class manifest(revlog.revlog):' | |||||
196 | # apply the delta to the addlist, and get a delta for addrevision |
|
196 | # apply the delta to the addlist, and get a delta for addrevision | |
197 | cachedelta = (self.rev(p1), addlistdelta(addlist, delta)) |
|
197 | cachedelta = (self.rev(p1), addlistdelta(addlist, delta)) | |
198 | arraytext = addlist |
|
198 | arraytext = addlist | |
199 | text = buffer(arraytext) |
|
199 | text = util.buffer(arraytext) | |
200 |
|
200 | |||
201 | n = self.addrevision(text, transaction, link, p1, p2, cachedelta) |
|
201 | n = self.addrevision(text, transaction, link, p1, p2, cachedelta) | |
202 | self._mancache = (n, map, arraytext) |
|
202 | self._mancache = (n, map, arraytext) |
@@ -318,7 +318,7 b' def patchtext(bin):' | |||||
318 | def patch(a, bin): |
|
318 | def patch(a, bin): | |
319 | if len(a) == 0: |
|
319 | if len(a) == 0: | |
320 | # skip over trivial delta header |
|
320 | # skip over trivial delta header | |
321 | return buffer(bin, 12) |
|
321 | return util.buffer(bin, 12) | |
322 | return mpatch.patches(a, [bin]) |
|
322 | return mpatch.patches(a, [bin]) | |
323 |
|
323 | |||
324 | # similar to difflib.SequenceMatcher.get_matching_blocks |
|
324 | # similar to difflib.SequenceMatcher.get_matching_blocks |
@@ -104,18 +104,15 b" def _fastsha1(s=''):" | |||||
104 | _fastsha1 = sha1 = _sha1 |
|
104 | _fastsha1 = sha1 = _sha1 | |
105 | return _sha1(s) |
|
105 | return _sha1(s) | |
106 |
|
106 | |||
107 | import __builtin__ |
|
|||
108 |
|
||||
109 | if sys.version_info[0] < 3: |
|
|||
110 | def fakebuffer(sliceable, offset=0): |
|
|||
111 | return sliceable[offset:] |
|
|||
112 | else: |
|
|||
113 | def fakebuffer(sliceable, offset=0): |
|
|||
114 | return memoryview(sliceable)[offset:] |
|
|||
115 | try: |
|
107 | try: | |
116 | buffer |
|
108 | buffer = buffer | |
117 | except NameError: |
|
109 | except NameError: | |
118 | __builtin__.buffer = fakebuffer |
|
110 | if sys.version_info[0] < 3: | |
|
111 | def buffer(sliceable, offset=0): | |||
|
112 | return sliceable[offset:] | |||
|
113 | else: | |||
|
114 | def buffer(sliceable, offset=0): | |||
|
115 | return memoryview(sliceable)[offset:] | |||
119 |
|
116 | |||
120 | import subprocess |
|
117 | import subprocess | |
121 | closefds = os.name == 'posix' |
|
118 | closefds = os.name == 'posix' |
General Comments 0
You need to be logged in to leave comments.
Login now