/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/commands.py

  • Committer: Martin Pool
  • Date: 2005-05-30 01:37:52 UTC
  • Revision ID: mbp@sourcefrog.net-20050530013751-650874ded00ae1a1
- Use explicit lock methods on a branch, rather than doing it
  implicitly from the Branch constructor and relying on destroying the
  branch to release the lock.

- New with_readlock, _with_writelock decorators for branch methods.

- Branch locks can now be taken several times by a single caller, but
  they forbid upgrading or downgrading.

- Don't need assertions about whether the branch is locked anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
263
263
    
264
264
    def run(self, all=False, show_ids=False, file_list=None):
265
265
        if file_list:
266
 
            b = Branch(file_list[0], lock_mode='r')
 
266
            b = Branch(file_list[0])
267
267
            file_list = [b.relpath(x) for x in file_list]
268
268
            # special case: only one path was given and it's the root
269
269
            # of the branch
270
270
            if file_list == ['']:
271
271
                file_list = None
272
272
        else:
273
 
            b = Branch('.', lock_mode='r')
 
273
            b = Branch('.')
274
274
        import status
275
275
        status.show_status(b, show_unchanged=all, show_ids=show_ids,
276
276
                           specific_files=file_list)
531
531
        from bzrlib import find_branch
532
532
 
533
533
        if file_list:
534
 
            b = find_branch(file_list[0], lock_mode='r')
 
534
            b = find_branch(file_list[0])
535
535
            file_list = [b.relpath(f) for f in file_list]
536
536
            if file_list == ['']:
537
537
                # just pointing to top-of-tree
538
538
                file_list = None
539
539
        else:
540
 
            b = Branch('.', lock_mode='r')
 
540
            b = Branch('.')
541
541
    
542
542
        show_diff(b, revision, specific_files=file_list,
543
543
                  external_diff_options=diff_options)
652
652
        direction = (forward and 'forward') or 'reverse'
653
653
        
654
654
        if filename:
655
 
            b = find_branch(filename, lock_mode='r')
 
655
            b = find_branch(filename)
656
656
            fp = b.relpath(filename)
657
657
            if fp:
658
658
                file_id = b.read_working_inventory().path2id(fp)
659
659
            else:
660
660
                file_id = None  # points to branch root
661
661
        else:
662
 
            b = find_branch('.', lock_mode='r')
 
662
            b = find_branch('.')
663
663
            file_id = None
664
664
 
665
665
        if revision == None:
693
693
    hidden = True
694
694
    takes_args = ["filename"]
695
695
    def run(self, filename):
696
 
        b = Branch(filename, lock_mode='r')
 
696
        b = Branch(filename)
697
697
        inv = b.read_working_inventory()
698
698
        file_id = inv.path2id(b.relpath(filename))
699
699
        for revno, revision_id, what in bzrlib.log.find_touching_revisions(b, file_id):