def prepareObj(obj): ( tree, branch, repo, relpath, ) = BzrDir.open_containing_tree_branch_or_repository(obj.vcsDir) obj.branch = branch obj.repo = repo ### obj.est = EventSearchTree() obj.firstRev = None obj.lastRev = None for ( rev_id, depth, revno, end_of_merge, ) in branch.iter_merge_sorted_revisions(direction="forward"): rev = obj.repo.get_revision(rev_id) epoch = rev.timestamp obj.est.add(epoch, epoch, rev_id) if not obj.firstRev: obj.firstRev = rev obj.lastRev = rev
def check_dwim(path, verbose, do_branch=False, do_repo=False, do_tree=False): try: tree, branch, repo, relpath = \ BzrDir.open_containing_tree_branch_or_repository(path) except errors.NotBranchError: tree = branch = repo = None if do_tree: if tree is not None: note("Checking working tree at '%s'." % (tree.bzrdir.root_transport.base, )) tree._check() else: log_error("No working tree found at specified location.") if branch is not None: # We have a branch if repo is None: # The branch is in a shared repository repo = branch.repository branches = [branch] elif repo is not None: branches = repo.find_branches(using=True) if repo is not None: repo.lock_read() try: if do_repo: note("Checking repository at '%s'." % (repo.bzrdir.root_transport.base, )) result = repo.check() result.report_results(verbose) if do_branch: if branches == []: log_error("No branch found at specified location.") else: for branch in branches: note("Checking branch at '%s'." % (branch.bzrdir.root_transport.base, )) check_branch(branch, verbose) finally: repo.unlock() else: if do_branch: log_error("No branch found at specified location.") if do_repo: log_error("No repository found at specified location.")
def prepareObj(obj): tree, branch, repository, relpath = \ BzrDir.open_containing_tree_branch_or_repository(obj.vcsDir) obj.branch = branch obj.repo = repository