/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/shelf.py

  • Committer: Parth Malwankar
  • Date: 2010-09-17 15:15:34 UTC
  • mto: This revision was merged to the branch mainline in revision 5444.
  • Revision ID: parth.malwankar@gmail.com-20100917151534-587xpe9adve1jhw3
used active_shelves instead of creating a new function for listing shelves

Show diffs side-by-side

added added

removed removed

Lines of Context:
429
429
            return active[-1]
430
430
        else:
431
431
            return None
432
 
 
433
 
 
434
 
def list_shelves(tree):
435
 
    """Return a list of all shelves as a tuple (shelf_id, message).
436
 
 
437
 
    :param tree: Tree for which we want the information.
438
 
    """
439
 
    manager = tree.get_shelf_manager()
440
 
    shelves = manager.active_shelves()
441
 
    info = []
442
 
    if len(shelves) == 0:
443
 
        return info
444
 
    for shelf_id in reversed(shelves):
445
 
        message = manager.get_metadata(shelf_id).get('message')
446
 
        if message is None:
447
 
            message = '<no message>'
448
 
        info.append((shelf_id, message))
449
 
    return info
450