/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 bzrlib/builtins.py

Refactored out ControlFiles and RevisionStore from _Branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
146
146
            raise BzrCommandError('You must supply either --revision or a revision_id')
147
147
        b = Branch.open_containing('.')[0]
148
148
        if revision_id is not None:
149
 
            sys.stdout.write(b.get_revision_xml_file(revision_id).read())
 
149
            sys.stdout.write(
 
150
                b.storage.get_revision_xml_file(revision_id).read())
150
151
        elif revision is not None:
151
152
            for rev in revision:
152
153
                if rev is None:
153
154
                    raise BzrCommandError('You cannot specify a NULL revision.')
154
155
                revno, rev_id = rev.in_history(b)
155
 
                sys.stdout.write(b.get_revision_xml_file(rev_id).read())
 
156
                sys.stdout.write(
 
157
                    b.storage.get_revision_xml_file(rev_id).read())
156
158
    
157
159
 
158
160
class cmd_revno(Command):
269
271
            if len(revision) > 1:
270
272
                raise BzrCommandError('bzr inventory --revision takes'
271
273
                    ' exactly one revision identifier')
272
 
            inv = b.get_revision_inventory(revision[0].in_history(b).rev_id)
 
274
            inv = b.storage.get_revision_inventory(
 
275
                revision[0].in_history(b).rev_id)
273
276
 
274
277
        for path, entry in inv.entries():
275
278
            if show_ids:
856
859
                try:
857
860
                    inv = b.working_tree().read_working_inventory()
858
861
                except NoWorkingTree:
859
 
                    inv = b.get_inventory(b.last_revision())
 
862
                    inv = b.storage.get_inventory(b.last_revision())
860
863
                file_id = inv.path2id(fp)
861
864
            else:
862
865
                file_id = None  # points to branch root
958
961
        if revision == None:
959
962
            tree = b.working_tree()
960
963
        else:
961
 
            tree = b.revision_tree(revision[0].in_history(b).rev_id)
 
964
            tree = b.storage.revision_tree(revision[0].in_history(b).rev_id)
962
965
        for fp, fc, kind, fid, entry in tree.list_files():
963
966
            if fp.startswith(relpath):
964
967
                fp = fp[len(relpath):]
1105
1108
            if len(revision) != 1:
1106
1109
                raise BzrError('bzr export --revision takes exactly 1 argument')
1107
1110
            rev_id = revision[0].in_history(b).rev_id
1108
 
        t = b.revision_tree(rev_id)
 
1111
        t = b.storage.revision_tree(rev_id)
1109
1112
        arg_root, ext = os.path.splitext(os.path.basename(dest))
1110
1113
        if ext in ('.gz', '.bz2'):
1111
1114
            new_root, new_ext = os.path.splitext(arg_root)
1536
1539
                                      + "multi-merges.")
1537
1540
            this_tree = b.working_tree()
1538
1541
            base_revision = common_ancestor(b.last_revision(), 
1539
 
                                            pending_merges[0], b)
1540
 
            base_tree = b.revision_tree(base_revision)
1541
 
            other_tree = b.revision_tree(pending_merges[0])
 
1542
                                            pending_merges[0], b.storage)
 
1543
            base_tree = b.storage.revision_tree(base_revision)
 
1544
            other_tree = b.storage.revision_tree(pending_merges[0])
1542
1545
            interesting_ids = None
1543
1546
            if file_list is not None:
1544
1547
                interesting_ids = set()
1737
1740
                rev_id = b.last_revision()
1738
1741
            else:
1739
1742
                rev_id = revision[0].in_history(b).rev_id
1740
 
            t = Testament.from_revision(b, rev_id)
 
1743
            t = Testament.from_revision(b.storage, rev_id)
1741
1744
            if long:
1742
1745
                sys.stdout.writelines(t.as_text_lines())
1743
1746
            else:
1772
1775
        b.lock_read()
1773
1776
        try:
1774
1777
            tree = WorkingTree(b.base, b)
1775
 
            tree = b.revision_tree(b.last_revision())
 
1778
            tree = b.storage.revision_tree(b.last_revision())
1776
1779
            file_id = tree.inventory.path2id(relpath)
1777
1780
            file_version = tree.inventory[file_id].revision
1778
1781
            annotate_file(b, file_version, file_id, long, all, sys.stdout)
1798
1801
        b = Branch.open_containing('.')[0]
1799
1802
        gpg_strategy = gpg.GPGStrategy(config.BranchConfig(b))
1800
1803
        if revision_id is not None:
1801
 
            b.sign_revision(revision_id, gpg_strategy)
 
1804
            b.storage.sign_revision(revision_id, gpg_strategy)
1802
1805
        elif revision is not None:
1803
1806
            if len(revision) == 1:
1804
1807
                revno, rev_id = revision[0].in_history(b)
1805
 
                b.sign_revision(rev_id, gpg_strategy)
 
1808
                b.storage.sign_revision(rev_id, gpg_strategy)
1806
1809
            elif len(revision) == 2:
1807
1810
                # are they both on rh- if so we can walk between them
1808
1811
                # might be nice to have a range helper for arbitrary
1814
1817
                if from_revno is None or to_revno is None:
1815
1818
                    raise BzrCommandError('Cannot sign a range of non-revision-history revisions')
1816
1819
                for revno in range(from_revno, to_revno + 1):
1817
 
                    b.sign_revision(b.get_rev_id(revno), gpg_strategy)
 
1820
                    b.storage.sign_revision(b.get_rev_id(revno), gpg_strategy)
1818
1821
            else:
1819
1822
                raise BzrCommandError('Please supply either one revision, or a range.')
1820
1823