~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Robert Collins
  • Date: 2006-05-05 04:43:35 UTC
  • mfrom: (1687.1.17 break-lock)
  • mto: This revision was merged to the branch mainline in revision 1701.
  • Revision ID: robertc@robertcollins.net-20060505044335-0e785bae0df1047e
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