~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/info.py

  • Committer: Robert Collins
  • Date: 2006-03-05 11:48:54 UTC
  • mto: This revision was merged to the branch mainline in revision 1590.
  • Revision ID: robertc@robertcollins.net-20060305114854-d95dbe4adfee32e9
Make bound branch creation happen via 'checkout'

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())