~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzr.py

  • Committer: mbp at sourcefrog
  • Date: 2005-03-11 06:36:25 UTC
  • Revision ID: mbp@sourcefrog.net-20050311063625-07858525021f270b
- bzr info: show summary information on branch history
- nicer plurals

Show diffs side-by-side

added added

removed removed

Lines of Context:
194
194
def cmd_info():
195
195
    b = Branch('.')
196
196
    print 'branch format:', b.controlfile('branch-format', 'r').readline().rstrip('\n')
197
 
    print 'revision number:', b.revno()
 
197
 
 
198
    def plural(n, base='', pl=None):
 
199
        if n == 1:
 
200
            return base
 
201
        elif pl is not None:
 
202
            return pl
 
203
        else:
 
204
            return 's'
198
205
 
199
206
    count_version_dirs = 0
200
207
 
212
219
                     ('renamed', 'R'), ('unknown', '?'), ('ignored', 'I'),
213
220
                     ):
214
221
        print '  %5d %s' % (count_status[fs], name)
215
 
    print '  %5d versioned subdirectories' % count_version_dirs
216
 
            
 
222
    print '  %5d versioned subdirector%s' % (count_version_dirs,
 
223
                                             plural(count_version_dirs, 'y', 'ies'))
 
224
 
 
225
    print
 
226
    print 'branch history:'
 
227
    history = b.revision_history()
 
228
    revno = len(history)
 
229
    print '  %5d revision%s' % (revno, plural(revno))
 
230
    committers = Set()
 
231
    for rev in history:
 
232
        committers.add(b.get_revision(rev).committer)
 
233
    print '  %5d committer%s' % (len(committers), plural(len(committers)))
 
234
    if revno > 0:
 
235
        firstrev = b.get_revision(history[0])
 
236
        age = int((time.time() - firstrev.timestamp) / 3600 / 24)
 
237
        print '  %5d day%s old' % (age, plural(age))
 
238
    
217
239
 
218
240
 
219
241
def cmd_remove(file_list, verbose=False):