/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/log.py

Merge in format-5 work - release bzr 0.1rc1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
from bzrlib.tree import EmptyTree
54
54
from bzrlib.delta import compare_trees
55
55
from bzrlib.trace import mutter
56
 
from bzrlib.errors import InvalidRevisionNumber
57
56
 
58
57
 
59
58
def find_touching_revisions(branch, file_id):
110
109
    return rh
111
110
 
112
111
 
 
112
def _get_revision_delta(branch, revno):
 
113
    """Return the delta for a mainline revision.
 
114
    
 
115
    This is used to show summaries in verbose logs, and also for finding 
 
116
    revisions which touch a given file."""
 
117
    # FIXME: The current version is very inefficient; it retrieves all revisions
 
118
    # twice and reads the weave twice.  We ought to keep revisions in memory 
 
119
    # in case they're used again, either in a general cache or perhaps 
 
120
    # in this code.
 
121
    # XXX: What are we supposed to do when showing a summary for something 
 
122
    # other than a mainline revision.  The delta to it's first parent, or
 
123
    # (more useful) the delta to a nominated other revision.
 
124
    return branch.get_revision_delta(revno)
 
125
 
 
126
 
113
127
def show_log(branch,
114
128
             lf,
115
129
             specific_fileid=None,
162
176
    
163
177
    if start_revision is None:
164
178
        start_revision = 1
165
 
    elif start_revision < 1 or start_revision >= len(which_revs):
166
 
        raise InvalidRevisionNumber(start_revision)
 
179
    else:
 
180
        branch.check_real_revno(start_revision)
167
181
    
168
182
    if end_revision is None:
169
183
        end_revision = len(which_revs)
170
 
    elif end_revision < 1 or end_revision >= len(which_revs):
171
 
        raise InvalidRevisionNumber(end_revision)
 
184
    else:
 
185
        branch.check_real_revno(end_revision)
172
186
 
173
187
    # list indexes are 0-based; revisions are 1-based
174
188
    cut_revs = which_revs[(start_revision-1):(end_revision)]
182
196
 
183
197
    for revno, rev_id in cut_revs:
184
198
        if verbose or specific_fileid:
185
 
            delta = branch.get_revision_delta(revno)
 
199
            delta = _get_revision_delta(branch, revno)
186
200
            
187
201
        if specific_fileid:
188
202
            if not delta.touches_file_id(specific_fileid):
294
308
 
295
309
    def show(self, revno, rev, delta):
296
310
        raise NotImplementedError('not implemented in abstract base')
297
 
        
298
 
 
299
 
 
300
 
 
301
 
 
302
 
 
 
311
 
 
312
    
303
313
class LongLogFormatter(LogFormatter):
304
314
    def show(self, revno, rev, delta):
305
315
        from osutils import format_date
310
320
        print >>to_file,  'revno:', revno
311
321
        if self.show_ids:
312
322
            print >>to_file,  'revision-id:', rev.revision_id
 
323
 
 
324
            for parent_id in rev.parent_ids:
 
325
                print >>to_file, 'parent:', parent_id
 
326
            
313
327
        print >>to_file,  'committer:', rev.committer
314
328
 
315
329
        date_str = format_date(rev.timestamp,
360
374
 
361
375
 
362
376
def log_formatter(name, *args, **kwargs):
 
377
    """Construct a formatter from arguments.
 
378
 
 
379
    name -- Name of the formatter to construct; currently 'long' and
 
380
        'short' are supported.
 
381
    """
363
382
    from bzrlib.errors import BzrCommandError
364
 
    
365
383
    try:
366
384
        return FORMATTERS[name](*args, **kwargs)
367
385
    except IndexError: