~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/log.py

  • Committer: Vincent Ladeuil
  • Date: 2011-05-26 20:30:53 UTC
  • mfrom: (5920 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5924.
  • Revision ID: v.ladeuil+lp@free.fr-20110526203053-hbjn6yuzwg03wnuv
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1159
1159
    This includes the revisions which directly change the file id,
1160
1160
    and the revisions which merge these changes. So if the
1161
1161
    revision graph is::
 
1162
 
1162
1163
        A-.
1163
1164
        |\ \
1164
1165
        B C E
1191
1192
    """
1192
1193
    # Lookup all possible text keys to determine which ones actually modified
1193
1194
    # the file.
 
1195
    graph = branch.repository.get_file_graph()
 
1196
    get_parent_map = graph.get_parent_map
1194
1197
    text_keys = [(file_id, rev_id) for rev_id, revno, depth in view_revisions]
1195
1198
    next_keys = None
1196
1199
    # Looking up keys in batches of 1000 can cut the time in half, as well as
1200
1203
    #       indexing layer. We might consider passing in hints as to the known
1201
1204
    #       access pattern (sparse/clustered, high success rate/low success
1202
1205
    #       rate). This particular access is clustered with a low success rate.
1203
 
    get_parent_map = branch.repository.texts.get_parent_map
1204
1206
    modified_text_revisions = set()
1205
1207
    chunk_size = 1000
1206
1208
    for start in xrange(0, len(text_keys), chunk_size):
1338
1340
    to indicate which LogRevision attributes it supports:
1339
1341
 
1340
1342
    - supports_delta must be True if this log formatter supports delta.
1341
 
        Otherwise the delta attribute may not be populated.  The 'delta_format'
1342
 
        attribute describes whether the 'short_status' format (1) or the long
1343
 
        one (2) should be used.
 
1343
      Otherwise the delta attribute may not be populated.  The 'delta_format'
 
1344
      attribute describes whether the 'short_status' format (1) or the long
 
1345
      one (2) should be used.
1344
1346
 
1345
1347
    - supports_merge_revisions must be True if this log formatter supports
1346
 
        merge revisions.  If not, then only mainline revisions will be passed
1347
 
        to the formatter.
 
1348
      merge revisions.  If not, then only mainline revisions will be passed
 
1349
      to the formatter.
1348
1350
 
1349
1351
    - preferred_levels is the number of levels this formatter defaults to.
1350
 
        The default value is zero meaning display all levels.
1351
 
        This value is only relevant if supports_merge_revisions is True.
 
1352
      The default value is zero meaning display all levels.
 
1353
      This value is only relevant if supports_merge_revisions is True.
1352
1354
 
1353
1355
    - supports_tags must be True if this log formatter supports tags.
1354
 
        Otherwise the tags attribute may not be populated.
 
1356
      Otherwise the tags attribute may not be populated.
1355
1357
 
1356
1358
    - supports_diff must be True if this log formatter supports diffs.
1357
 
        Otherwise the diff attribute may not be populated.
 
1359
      Otherwise the diff attribute may not be populated.
1358
1360
 
1359
1361
    Plugins can register functions to show custom revision properties using
1360
1362
    the properties_handler_registry. The registered function
1361
 
    must respect the following interface description:
 
1363
    must respect the following interface description::
 
1364
 
1362
1365
        def my_show_properties(properties_dict):
1363
1366
            # code that returns a dict {'name':'value'} of the properties
1364
1367
            # to be shown
1727
1730
 
1728
1731
    def log_string(self, revno, rev, max_chars, tags=None, prefix=''):
1729
1732
        """Format log info into one string. Truncate tail of string
1730
 
        :param  revno:      revision number or None.
1731
 
                            Revision numbers counts from 1.
1732
 
        :param  rev:        revision object
1733
 
        :param  max_chars:  maximum length of resulting string
1734
 
        :param  tags:       list of tags or None
1735
 
        :param  prefix:     string to prefix each line
1736
 
        :return:            formatted truncated string
 
1733
 
 
1734
        :param revno:      revision number or None.
 
1735
                           Revision numbers counts from 1.
 
1736
        :param rev:        revision object
 
1737
        :param max_chars:  maximum length of resulting string
 
1738
        :param tags:       list of tags or None
 
1739
        :param prefix:     string to prefix each line
 
1740
        :return:           formatted truncated string
1737
1741
        """
1738
1742
        out = []
1739
1743
        if revno:
1740
1744
            # show revno only when is not None
1741
1745
            out.append("%s:" % revno)
1742
 
        out.append(self.truncate(self.short_author(rev), 20))
 
1746
        if max_chars is not None:
 
1747
            out.append(self.truncate(self.short_author(rev), (max_chars+3)/4))
 
1748
        else:
 
1749
            out.append(self.short_author(rev))
1743
1750
        out.append(self.date_string(rev))
1744
1751
        if len(rev.parent_ids) > 1:
1745
1752
            out.append('[merge]')