/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to olive/info_helper.py

  • Committer: Daniel Schierbeck
  • Date: 2008-01-13 14:12:49 UTC
  • mto: (423.1.2 trunk)
  • mto: This revision was merged to the branch mainline in revision 429.
  • Revision ID: daniel.schierbeck@gmail.com-20080113141249-gd0i2lknr3yik55r
Moved branch view to its own package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
 
19
19
import time
20
 
import sys
21
20
 
22
21
import bzrlib
23
22
 
29
28
    urlutils,
30
29
    )
31
30
 
32
 
from bzrlib.diff import show_diff_trees
33
31
from bzrlib.missing import find_unmerged
34
 
    
 
32
 
35
33
def _repo_rel_url(repo_url, inner_url):
36
34
    """Return path with common prefix of repository path removed.
37
35
 
262
260
    if revno > 0:
263
261
        firstrev = repository.get_revision(history[0])
264
262
        age = int((time.time() - firstrev.timestamp) / 3600 / 24)
265
 
        ret['age'] = '%d days'%age
 
263
        ret['age'] = age
266
264
        ret['firstrev'] = osutils.format_date(firstrev.timestamp,
267
265
                                              firstrev.timezone)
268
266
 
281
279
    if repository.bzrdir.root_transport.listable():
282
280
        c, t = repository._revision_store.total_size(repository.get_transaction())
283
281
        ret['revisions'] = c
284
 
        ret['size'] = '%d KiB'%t
 
282
        ret['size'] = t
285
283
 
286
284
    return ret
287
285
 
300
298
 
301
299
    :param new_revision_spec:  if None, use working tree as new revision, otherwise use the tree for the specified revision.
302
300
    """
 
301
    import sys
 
302
    
 
303
    from bzrlib.diff import show_diff_trees
303
304
    
304
305
    if output == None:
305
306
        output = sys.stdout
306
307
    
 
308
    def spec_tree(spec):
 
309
        revision_id = spec.in_store(tree.branch).rev_id
 
310
        return tree.branch.repository.revision_tree(revision_id)
 
311
    
307
312
    if old_revision_spec is None:
308
313
        old_tree = tree.basis_tree()
309
314
    else:
317
322
    return show_diff_trees(old_tree, new_tree, output, specific_files,
318
323
                           external_diff_options,
319
324
                           old_label=old_label, new_label=new_label)
320
 
 
321
 
def spec_tree(spec):
322
 
        revision_id = spec.in_store(tree.branch).rev_id
323
 
        return tree.branch.repository.revision_tree(revision_id)