~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Jelmer Vernooij
  • Date: 2005-11-04 17:26:05 UTC
  • mfrom: (1185.16.146)
  • mto: (1185.33.1)
  • mto: This revision was merged to the branch mainline in revision 1509.
  • Revision ID: jelmer@samba.org-20051104172605-9288f261492667fd
MergeĀ fromĀ Martin

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
from bzrlib.commands import Command, display_command
28
28
from bzrlib.branch import Branch
29
29
from bzrlib.errors import BzrError, BzrCheckError, BzrCommandError, NotBranchError
30
 
from bzrlib.errors import DivergedBranches, NoSuchFile
 
30
from bzrlib.errors import DivergedBranches, NoSuchFile, NoWorkingTree
31
31
from bzrlib.option import Option
32
32
from bzrlib.revisionspec import RevisionSpec
33
33
import bzrlib.trace
262
262
    def run(self, revision=None, show_ids=False):
263
263
        b = Branch.open_containing('.')[0]
264
264
        if revision is None:
265
 
            inv = b.read_working_inventory()
 
265
            inv = b.working_tree().read_working_inventory()
266
266
        else:
267
267
            if len(revision) > 1:
268
268
                raise BzrCommandError('bzr inventory --revision takes'
560
560
    def run(self, dir='.'):
561
561
        b = Branch.open_containing(dir)[0]
562
562
        old_inv = b.basis_tree().inventory
563
 
        new_inv = b.read_working_inventory()
 
563
        new_inv = b.working_tree().read_working_inventory()
564
564
 
565
565
        renames = list(bzrlib.tree.find_renames(old_inv, new_inv))
566
566
        renames.sort()
655
655
    """Display list of versioned directories in this branch."""
656
656
    @display_command
657
657
    def run(self):
658
 
        for name, ie in Branch.open_containing('.')[0].read_working_inventory().directories():
 
658
        for name, ie in (Branch.open_containing('.')[0].working_tree().
 
659
                         read_working_inventory().directories()):
659
660
            if name == '':
660
661
                print '.'
661
662
            else:
675
676
        bzr status
676
677
        bzr commit -m 'imported project'
677
678
    """
678
 
    def run(self):
679
 
        Branch.initialize('.')
 
679
    takes_args = ['location?']
 
680
    def run(self, location=None):
 
681
        from bzrlib.branch import Branch
 
682
        if location is None:
 
683
            location = '.'
 
684
        else:
 
685
            # The path has to exist to initialize a
 
686
            # branch inside of it.
 
687
            # Just using os.mkdir, since I don't
 
688
            # believe that we want to create a bunch of
 
689
            # locations if the user supplies an extended path
 
690
            if not os.path.exists(location):
 
691
                os.mkdir(location)
 
692
        Branch.initialize(location)
680
693
 
681
694
 
682
695
class cmd_diff(Command):
838
851
        if filename:
839
852
            b, fp = Branch.open_containing(filename)
840
853
            if fp != '':
841
 
                file_id = b.read_working_inventory().path2id(fp)
 
854
                try:
 
855
                    inv = b.working_tree().read_working_inventory()
 
856
                except NoWorkingTree:
 
857
                    inv = b.get_inventory(b.last_revision())
 
858
                file_id = inv.path2id(fp)
842
859
            else:
843
860
                file_id = None  # points to branch root
844
861
        else:
897
914
    @display_command
898
915
    def run(self, filename):
899
916
        b, relpath = Branch.open_containing(filename)[0]
900
 
        inv = b.read_working_inventory()
 
917
        inv = b.working_tree().read_working_inventory()
901
918
        file_id = inv.path2id(relpath)
902
919
        for revno, revision_id, what in bzrlib.log.find_touching_revisions(b, file_id):
903
920
            print "%6d %s" % (revno, what)