/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/plugins/git/unpeel_map.py

Merge test-run support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from collections import defaultdict
22
22
from io import BytesIO
23
23
 
24
 
from .. import (
 
24
from ... import (
25
25
    errors,
26
26
    trace,
27
27
    )
46
46
    def load(self, f):
47
47
        firstline = f.readline()
48
48
        if firstline != b"unpeel map version 1\n":
49
 
            raise AssertionError(
50
 
                "invalid format for unpeel map: %r" % firstline)
 
49
            raise AssertionError("invalid format for unpeel map: %r" % firstline)
51
50
        for l in f.readlines():
52
51
            (k, v) = l.split(b":", 1)
53
52
            k = k.strip()
62
61
                f.write(b"%s: %s\n" % (k, v))
63
62
 
64
63
    def save_in_repository(self, repository):
65
 
        with BytesIO() as f:
 
64
        f = BytesIO()
 
65
        try:
66
66
            self.save(f)
67
67
            f.seek(0)
68
68
            repository.control_transport.put_file("git-unpeel-map", f)
 
69
        finally:
 
70
            f.close()
69
71
 
70
72
    def peel_tag(self, git_sha, default=None):
71
73
        """Peel a tag."""