~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-05-05 08:29:29 UTC
  • mfrom: (1697.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060505082929-a037ee137f1ff240
Merge break-lock command.

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
        a transport connected to the directory this bzr was opened from.
63
63
    """
64
64
 
 
65
    def break_lock(self):
 
66
        """Invoke break_lock on the first object in the bzrdir.
 
67
 
 
68
        If there is a tree, the tree is opened and break_lock() called.
 
69
        Otherwise, branch is tried, and finally repository.
 
70
        """
 
71
        try:
 
72
            thing_to_unlock = self.open_workingtree()
 
73
        except (errors.NotLocalUrl, errors.NoWorkingTree):
 
74
            try:
 
75
                thing_to_unlock = self.open_branch()
 
76
            except errors.NotBranchError:
 
77
                try:
 
78
                    thing_to_unlock = self.open_repository()
 
79
                except errors.NoRepositoryPresent:
 
80
                    return
 
81
        thing_to_unlock.break_lock()
 
82
 
65
83
    def can_convert_format(self):
66
84
        """Return true if this bzrdir is one whose format we can convert from."""
67
85
        return True
581
599
                                            self._format._lock_file_name,
582
600
                                            self._format._lock_class)
583
601
 
 
602
    def break_lock(self):
 
603
        """Pre-splitout bzrdirs do not suffer from stale locks."""
 
604
        raise NotImplementedError(self.break_lock)
 
605
 
584
606
    def clone(self, url, revision_id=None, basis=None, force_new_repo=False):
585
607
        """See BzrDir.clone()."""
586
608
        from bzrlib.workingtree import WorkingTreeFormat2