~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/info.py

  • Committer: Aaron Bentley
  • Date: 2007-03-20 15:09:49 UTC
  • mto: This revision was merged to the branch mainline in revision 2528.
  • Revision ID: abentley@panoramicfeedback.com-20070320150949-ng8lv3yxi3lkzj7p
Implement layout description

Show diffs side-by-side

added added

removed removed

Lines of Context:
322
322
    _show_repository_stats(stats)
323
323
 
324
324
 
 
325
def describe_layout(repository=None, branch=None, tree=None):
 
326
    """Convert a control directory layout into a user-understandable term
 
327
 
 
328
    Common outputs include "Standalone tree", "Repository branch" and
 
329
    "Checkout".  Uncommon outputs include "Unshared repository with trees"
 
330
    and "Empty control directory"
 
331
    """
 
332
    if repository is None:
 
333
        return 'Empty control directory'
 
334
    if branch is None and tree is None:
 
335
        if repository.is_shared():
 
336
            phrase = 'Shared repository'
 
337
        else:
 
338
            phrase = 'Unshared repository'
 
339
        if repository.make_working_trees():
 
340
            phrase += ' with trees'
 
341
        return phrase
 
342
    else:
 
343
        if repository.is_shared():
 
344
            independence = "Repository "
 
345
        else:
 
346
            independence = "Standalone "
 
347
        if tree is not None:
 
348
            phrase = "tree"
 
349
        else:
 
350
            phrase = "branch"
 
351
        if branch is None and tree is not None:
 
352
            phrase = "branchless tree"
 
353
        else:
 
354
            if (tree is not None and tree.bzrdir.root_transport.base !=
 
355
                branch.bzrdir.root_transport.base):
 
356
                if independence == 'Standalone ':
 
357
                    independence = ''
 
358
                phrase = "Lightweight checkout"
 
359
            elif branch.get_bound_location() is not None:
 
360
                if independence == 'Standalone ':
 
361
                    independence = ''
 
362
                if tree is None:
 
363
                    phrase = "Bound branch"
 
364
                else:
 
365
                    phrase = "Checkout"
 
366
        if independence != "":
 
367
            phrase = phrase.lower()
 
368
        return "%s%s" % (independence, phrase)
 
369
 
 
370
 
325
371
@deprecated_function(zero_eight)
326
372
def show_info(b):
327
373
    """Please see show_bzrdir_info."""