~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/info.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-03-06 00:49:26 UTC
  • mfrom: (1587.1.14 bound-branches)
  • Revision ID: pqm@pqm.ubuntu.com-20060306004926-6d7a10c990bc17d1
Merge in bound branches core support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
 
24
24
import bzrlib.diff as diff
 
25
from bzrlib.missing import find_unmerged
25
26
from bzrlib.osutils import format_date
26
27
from bzrlib.symbol_versioning import *
27
28
 
42
43
def show_bzrdir_info(a_bzrdir):
43
44
    """Output to stdout the 'info' for a_bzrdir."""
44
45
 
 
46
    def plural(n, base='', pl=None):
 
47
        if n == 1:
 
48
            return base
 
49
        elif pl != None:
 
50
            return pl
 
51
        else:
 
52
            return 's'
 
53
 
45
54
    working = a_bzrdir.open_workingtree()
46
55
    b = a_bzrdir.open_branch()
47
56
    
55
64
        format = b.bzrdir._format
56
65
    print 'branch format:', format
57
66
 
58
 
    def plural(n, base='', pl=None):
59
 
        if n == 1:
60
 
            return base
61
 
        elif pl != None:
62
 
            return pl
63
 
        else:
64
 
            return 's'
 
67
    if b.get_bound_location():
 
68
        print 'bound to branch:',  b.get_bound_location()
65
69
 
66
70
    count_version_dirs = 0
67
71
 
71
75
    history = b.revision_history()
72
76
    
73
77
    print
 
78
    # Try with inaccessible branch ?
 
79
    master = b.get_master_branch()
 
80
    if master:
 
81
        local_extra, remote_extra = find_unmerged(b, b.get_master_branch())
 
82
        if remote_extra:
 
83
            print 'Branch is out of date: missing %d revision%s.' % (
 
84
                len(remote_extra), plural(len(remote_extra)))
 
85
 
74
86
    if len(history) and working.last_revision() != history[-1]:
75
87
        try:
76
88
            missing_count = len(history) - history.index(working.last_revision())