~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/log.py

  • Committer: Robert Collins
  • Date: 2007-04-23 02:29:35 UTC
  • mfrom: (2441 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2442.
  • Revision ID: robertc@robertcollins.net-20070423022935-9hhongamvk6bfdso
Resolve conflicts with bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
224
224
    view_revisions = list(get_view_revisions(mainline_revs, rev_nos, branch,
225
225
                          direction, include_merges=include_merges))
226
226
 
 
227
    use_tags = getattr(lf, 'supports_tags', False)
 
228
    if use_tags:
 
229
        rev_tag_dict = {}
 
230
        if branch.supports_tags():
 
231
            rev_tag_dict = branch.tags.get_reverse_tag_dict()
 
232
 
227
233
    def iter_revisions():
228
234
        # r = revision, n = revno, d = merge depth
229
235
        revision_ids = [r for r, n, d in view_revisions]
257
263
 
258
264
        if merge_depth == 0:
259
265
            # a mainline revision.
260
 
                
 
266
 
261
267
            if specific_fileid:
262
268
                if not delta.touches_file_id(specific_fileid):
263
269
                    continue
264
 
    
 
270
 
265
271
            if not verbose:
266
272
                # although we calculated it, throw it away without display
267
273
                delta = None
268
274
 
269
 
            lf.show(revno, rev, delta)
 
275
            if use_tags:
 
276
                lf.show(revno, rev, delta, rev_tag_dict.get(rev_id))
 
277
            else:
 
278
                lf.show(revno, rev, delta)
270
279
        else:
271
280
            if show_merge_revno is None:
272
281
                lf.show_merge(rev, merge_depth)
273
282
            else:
274
 
                lf.show_merge_revno(rev, merge_depth, revno)
 
283
                if use_tags:
 
284
                    lf.show_merge_revno(rev, merge_depth, revno,
 
285
                                        rev_tag_dict.get(rev_id))
 
286
                else:
 
287
                    lf.show_merge_revno(rev, merge_depth, revno)
275
288
 
276
289
 
277
290
def get_view_revisions(mainline_revs, rev_nos, branch, direction,
340
353
 
341
354
    def short_committer(self, rev):
342
355
        return re.sub('<.*@.*>', '', rev.committer).strip(' ')
343
 
    
344
 
    
 
356
 
 
357
 
345
358
class LongLogFormatter(LogFormatter):
346
 
    def show(self, revno, rev, delta):
347
 
        return self._show_helper(revno=revno, rev=rev, delta=delta)
 
359
 
 
360
    supports_tags = True    # must exist and be True
 
361
                            # if this log formatter support tags.
 
362
                            # .show() and .show_merge_revno() must then accept
 
363
                            # the 'tags'-argument with list of tags
 
364
 
 
365
    def show(self, revno, rev, delta, tags=None):
 
366
        return self._show_helper(revno=revno, rev=rev, delta=delta, tags=tags)
348
367
 
349
368
    @deprecated_method(zero_eleven)
350
369
    def show_merge(self, rev, merge_depth):
351
 
        return self._show_helper(rev=rev, indent='    '*merge_depth, merged=True, delta=None)
 
370
        return self._show_helper(rev=rev, indent='    '*merge_depth,
 
371
                                 merged=True, delta=None)
352
372
 
353
 
    def show_merge_revno(self, rev, merge_depth, revno):
 
373
    def show_merge_revno(self, rev, merge_depth, revno, tags=None):
354
374
        """Show a merged revision rev, with merge_depth and a revno."""
355
375
        return self._show_helper(rev=rev, revno=revno,
356
 
            indent='    '*merge_depth, merged=True, delta=None)
 
376
            indent='    '*merge_depth, merged=True, delta=None, tags=tags)
357
377
 
358
 
    def _show_helper(self, rev=None, revno=None, indent='', merged=False, delta=None):
 
378
    def _show_helper(self, rev=None, revno=None, indent='', merged=False,
 
379
                     delta=None, tags=None):
359
380
        """Show a revision, either merged or not."""
360
381
        from bzrlib.osutils import format_date
361
382
        to_file = self.to_file
362
383
        print >>to_file,  indent+'-' * 60
363
384
        if revno is not None:
364
385
            print >>to_file,  indent+'revno:', revno
 
386
        if tags:
 
387
            print >>to_file, indent+'tags: %s' % (', '.join(tags))
365
388
        if merged:
366
389
            print >>to_file,  indent+'merged:', rev.revision_id
367
390
        elif self.show_ids:
370
393
            for parent_id in rev.parent_ids:
371
394
                print >>to_file, indent+'parent:', parent_id
372
395
        print >>to_file,  indent+'committer:', rev.committer
 
396
 
373
397
        try:
374
398
            print >>to_file, indent+'branch nick: %s' % \
375
399
                rev.properties['branch-nick']