equal
deleted
inserted
replaced
16 |
16 |
17 $ cat > cacheprocess-logger.py <<EOF |
17 $ cat > cacheprocess-logger.py <<EOF |
18 > import os |
18 > import os |
19 > import shutil |
19 > import shutil |
20 > import sys |
20 > import sys |
21 > if sys.version_info[0] > 2: |
|
22 > xrange = range |
|
23 > f = open('$TESTTMP/cachelog.log', 'w') |
21 > f = open('$TESTTMP/cachelog.log', 'w') |
24 > srccache = os.path.join('$TESTTMP', 'oldhgcache') |
22 > srccache = os.path.join('$TESTTMP', 'oldhgcache') |
25 > def log(message): |
23 > def log(message): |
26 > f.write(message) |
24 > f.write(message) |
27 > f.flush() |
25 > f.flush() |
34 > sys.exit(0) |
32 > sys.exit(0) |
35 > elif cmd == 'get': |
33 > elif cmd == 'get': |
36 > count = int(sys.stdin.readline()) |
34 > count = int(sys.stdin.readline()) |
37 > log('client wants %r blobs\n' % count) |
35 > log('client wants %r blobs\n' % count) |
38 > wants = [] |
36 > wants = [] |
39 > for _ in xrange(count): |
37 > for _ in range(count): |
40 > key = sys.stdin.readline()[:-1] |
38 > key = sys.stdin.readline()[:-1] |
41 > wants.append(key) |
39 > wants.append(key) |
42 > if '\0' in key: |
40 > if '\0' in key: |
43 > _, key = key.split('\0') |
41 > _, key = key.split('\0') |
44 > srcpath = os.path.join(srccache, key) |
42 > srcpath = os.path.join(srccache, key) |