~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_chk_map_py.py

  • Committer: Wouter van Heyst
  • Date: 2012-01-25 21:13:15 UTC
  • mto: (6437.3.27 2.5)
  • mto: This revision was merged to the branch mainline in revision 6451.
  • Revision ID: larstiq@larstiq.dyndns.org-20120125211315-ch74doua37bqet0i
mechanically replace file().write() pattern with a with-keyword version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009 Canonical Ltd
 
1
# Copyright (C) 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
16
16
 
17
17
"""Python implementation of _search_key functions, etc."""
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
import zlib
20
22
import struct
21
23
 
157
159
    result._node_width = len(prefix)
158
160
    result._search_prefix = common_prefix
159
161
    return result
 
162
 
 
163
 
 
164
def _bytes_to_text_key(bytes):
 
165
    """Take a CHKInventory value string and return a (file_id, rev_id) tuple"""
 
166
    sections = bytes.split('\n')
 
167
    kind, file_id = sections[0].split(': ')
 
168
    return (intern(file_id), intern(sections[3]))
 
169