~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/info.py

  • Committer: Aaron Bentley
  • Date: 2006-03-07 05:59:14 UTC
  • mfrom: (1558.1.20 Aaron's integration)
  • mto: This revision was merged to the branch mainline in revision 1595.
  • Revision ID: aaron.bentley@utoronto.ca-20060307055914-a88728997afceb90
MergeĀ fromĀ mainline

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