Show More
@@ -5,7 +5,7 b'' | |||||
5 | # This software may be used and distributed according to the terms |
|
5 | # This software may be used and distributed according to the terms | |
6 | # of the GNU General Public License, incorporated herein by reference. |
|
6 | # of the GNU General Public License, incorporated herein by reference. | |
7 |
|
7 | |||
8 |
import sys, struct, sha, socket, os, time, |
|
8 | import sys, struct, sha, socket, os, time, re, urllib2 | |
9 | import urllib |
|
9 | import urllib | |
10 | from mercurial import byterange |
|
10 | from mercurial import byterange | |
11 | from mercurial.transaction import * |
|
11 | from mercurial.transaction import * | |
@@ -14,16 +14,7 b' from difflib import SequenceMatcher' | |||||
14 |
|
14 | |||
15 | class filelog(revlog): |
|
15 | class filelog(revlog): | |
16 | def __init__(self, opener, path): |
|
16 | def __init__(self, opener, path): | |
17 | s = self.encodepath(path) |
|
17 | revlog.__init__(self, opener, path + ".i", path + ".d") | |
18 | revlog.__init__(self, opener, os.path.join("data", s + "i"), |
|
|||
19 | os.path.join("data", s)) |
|
|||
20 |
|
||||
21 | def encodepath(self, path): |
|
|||
22 | s = sha.sha(path).digest() |
|
|||
23 | s = base64.encodestring(s)[:-3] |
|
|||
24 | s = re.sub("\+", "%", s) |
|
|||
25 | s = re.sub("/", "_", s) |
|
|||
26 | return s |
|
|||
27 |
|
18 | |||
28 | def read(self, node): |
|
19 | def read(self, node): | |
29 | return self.revision(node) |
|
20 | return self.revision(node) | |
@@ -210,8 +201,14 b' def opener(base):' | |||||
210 |
|
201 | |||
211 | f = os.path.join(p, path) |
|
202 | f = os.path.join(p, path) | |
212 |
|
203 | |||
213 |
if mode != "r" |
|
204 | if mode != "r": | |
|
205 | try: | |||
214 | s = os.stat(f) |
|
206 | s = os.stat(f) | |
|
207 | except OSError: | |||
|
208 | d = os.path.dirname(f) | |||
|
209 | if not os.path.isdir(d): | |||
|
210 | os.makedirs(d) | |||
|
211 | else: | |||
215 | if s.st_nlink > 1: |
|
212 | if s.st_nlink > 1: | |
216 | file(f + ".tmp", "w").write(file(f).read()) |
|
213 | file(f + ".tmp", "w").write(file(f).read()) | |
217 | os.rename(f+".tmp", f) |
|
214 | os.rename(f+".tmp", f) |
General Comments 0
You need to be logged in to leave comments.
Login now