Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/pure/parsers.py @ 24215:feddc5284724
manifest: move pure parsing code out of pure
This lets us transition more smoothly.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 06 Mar 2015 17:00:42 -0600 |
parents | e250b8300e6e |
children | 4ece2847cf4c |
comparison
equal
deleted
inserted
replaced
24214:a5f1bccd2996 | 24215:feddc5284724 |
---|---|
3 # Copyright 2009 Matt Mackall <mpm@selenic.com> and others | 3 # Copyright 2009 Matt Mackall <mpm@selenic.com> and others |
4 # | 4 # |
5 # This software may be used and distributed according to the terms of the | 5 # This software may be used and distributed according to the terms of the |
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 mercurial.node import bin, nullid | 8 from mercurial.node import nullid |
9 from mercurial import util | 9 from mercurial import util |
10 import struct, zlib, cStringIO | 10 import struct, zlib, cStringIO |
11 | 11 |
12 _pack = struct.pack | 12 _pack = struct.pack |
13 _unpack = struct.unpack | 13 _unpack = struct.unpack |
18 # Some code below makes tuples directly because it's more convenient. However, | 18 # Some code below makes tuples directly because it's more convenient. However, |
19 # code outside this module should always use dirstatetuple. | 19 # code outside this module should always use dirstatetuple. |
20 def dirstatetuple(*x): | 20 def dirstatetuple(*x): |
21 # x is a tuple | 21 # x is a tuple |
22 return x | 22 return x |
23 | |
24 def parse_manifest(mfdict, fdict, lines): | |
25 for l in lines.splitlines(): | |
26 f, n = l.split('\0') | |
27 if len(n) > 40: | |
28 fdict[f] = n[40:] | |
29 mfdict[f] = bin(n[:40]) | |
30 else: | |
31 mfdict[f] = bin(n) | |
32 | 23 |
33 def parse_index2(data, inline): | 24 def parse_index2(data, inline): |
34 def gettype(q): | 25 def gettype(q): |
35 return int(q & 0xFFFF) | 26 return int(q & 0xFFFF) |
36 | 27 |