~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/check.py

Abstracted discovery of elements away.

Show diffs side-by-side

added added

removed removed

Lines of Context:
277
277
    finally:
278
278
        tree.unlock()
279
279
 
280
 
 
281
 
def check_dwim(path, verbose):
 
280
def _get_elements(path):
282
281
    try:
283
 
        _check_working_tree(WorkingTree.open(path))
 
282
        tree = WorkingTree.open(path)
284
283
    except (errors.NoWorkingTree, errors.NotLocalUrl):
285
284
        tree = None
286
285
    except errors.NotBranchError:
298
297
    except errors.NotBranchError:
299
298
        branch = None
300
299
 
 
300
    return tree, repo, branch
 
301
 
 
302
 
 
303
def check_dwim(path, verbose):
 
304
    tree, repo, branch = _get_elements(path)
 
305
 
 
306
    if tree is not None:
 
307
        _check_working_tree(tree)
 
308
 
301
309
    if branch is not None:
302
310
        # We have a branch
303
311
        if repo is None: