X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=lbs.py;h=80240e70d44a351aa0dc6efe54412978fb9a8bce;hb=ab51d5778a1f19c204c935de231737df2e62c20c;hp=31089989a3e10b5a6c2b5fd59ac5872b689e1d42;hpb=2fc79690f0e5066b689746b18d42b95eca48a0ab;p=cumulus.git diff --git a/lbs.py b/lbs.py index 3108998..80240e7 100644 --- a/lbs.py +++ b/lbs.py @@ -139,11 +139,11 @@ class ObjectStore: @staticmethod def parse_ref(refstr): - m = re.match(r"^zero\[(\d+)\+(\d+)\]$", refstr) + m = re.match(r"^zero\[(\d+)\]$", refstr) if m: - return ("zero", None, None, (int(m.group(1)), int(m.group(2)))) + return ("zero", None, None, (0, int(m.group(1)))) - m = re.match(r"^([-0-9a-f]+)\/([0-9a-f]+)(\(\S+\))?(\[(\d+)\+(\d+)\])?$", refstr) + m = re.match(r"^([-0-9a-f]+)\/([0-9a-f]+)(\(\S+\))?(\[((\d+)\+)?(\d+)\])?$", refstr) if not m: return segment = m.group(1) @@ -155,7 +155,11 @@ class ObjectStore: checksum = checksum.lstrip("(").rstrip(")") if slice is not None: - slice = (int(m.group(5)), int(m.group(6))) + if m.group(5) is None: + # Abbreviated slice + slice = (0, int(m.group(7))) + else: + slice = (int(m.group(6)), int(m.group(7))) return (segment, object, checksum, slice)