~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/bundle_data.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-01-02 08:23:44 UTC
  • mfrom: (3140.1.9 find-branches)
  • Revision ID: pqm@pqm.ubuntu.com-20080102082344-qret383z2bdk1ud4
Optimize find_branches for standalone repositories (abentley)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
from bzrlib import (
25
25
    osutils,
 
26
    timestamp,
26
27
    )
27
28
import bzrlib.errors
28
29
from bzrlib.bundle import apply_bundle
87
88
 
88
89
        return rev
89
90
 
 
91
    @staticmethod
 
92
    def from_revision(revision):
 
93
        revision_info = RevisionInfo(revision.revision_id)
 
94
        date = timestamp.format_highres_date(revision.timestamp,
 
95
                                             revision.timezone)
 
96
        revision_info.date = date
 
97
        revision_info.timezone = revision.timezone
 
98
        revision_info.timestamp = revision.timestamp
 
99
        revision_info.message = revision.message.split('\n')
 
100
        revision_info.properties = [': '.join(p) for p in
 
101
                                    revision.properties.iteritems()]
 
102
        return revision_info
 
103
 
90
104
 
91
105
class BundleInfo(object):
92
106
    """This contains the meta information. Stuff that allows you to
93
107
    recreate the revision or inventory XML.
94
108
    """
95
 
    def __init__(self):
 
109
    def __init__(self, bundle_format=None):
 
110
        self.bundle_format = None
96
111
        self.committer = None
97
112
        self.date = None
98
113
        self.message = None
179
194
        raise KeyError(revision_id)
180
195
 
181
196
    def revision_tree(self, repository, revision_id, base=None):
182
 
        revision_id = osutils.safe_revision_id(revision_id)
183
197
        revision = self.get_revision(revision_id)
184
198
        base = self.get_base(revision)
185
199
        assert base != revision_id
442
456
                        ' (unrecognized action): %r' % action_line)
443
457
            valid_actions[action](kind, extra, lines)
444
458
 
445
 
    def install_revisions(self, target_repo):
446
 
        """Install revisions and return the target revision"""
 
459
    def install_revisions(self, target_repo, stream_input=True):
 
460
        """Install revisions and return the target revision
 
461
 
 
462
        :param target_repo: The repository to install into
 
463
        :param stream_input: Ignored by this implementation.
 
464
        """
447
465
        apply_bundle.install_bundle(target_repo, self)
448
466
        return self.target
449
467
 
 
468
    def get_merge_request(self, target_repo):
 
469
        """Provide data for performing a merge
 
470
 
 
471
        Returns suggested base, suggested target, and patch verification status
 
472
        """
 
473
        return None, self.target, 'inapplicable'
 
474
 
450
475
 
451
476
class BundleTree(Tree):
452
477
    def __init__(self, base_tree, revision_id):