/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 viz/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2006-05-19 16:56:46 UTC
  • mfrom: (0.1.25 gannotate)
  • Revision ID: jelmer@samba.org-20060519165646-0d867938fdbc9097
Merge in Dan Loda's gannotate plugin and put it in annotate/

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
1
2
# -*- coding: UTF-8 -*-
2
3
"""GTK+ Branch Visualisation.
3
4
 
11
12
The bottom hald of the window shows the details for the selected revision.
12
13
"""
13
14
 
14
 
from branchwin import BranchWindow
15
 
 
16
15
__copyright__ = "Copyright © 2005 Canonical Ltd."
17
16
__author__    = "Scott James Remnant <scott@ubuntu.com>"
18
17
 
 
18
 
 
19
from bzrlib.commands import Command, register_command
 
20
from bzrlib.option import Option
 
21
from bzrlib.branch import Branch
 
22
 
 
23
 
 
24
class cmd_visualise(Command):
 
25
    """Graphically visualise this branch.
 
26
 
 
27
    Opens a graphical window to allow you to see the history of the branch
 
28
    and relationships between revisions in a visual manner,
 
29
 
 
30
    The default starting point is latest revision on the branch, you can
 
31
    specify a starting point with -r revision.
 
32
    """
 
33
    takes_options = [
 
34
        "revision",
 
35
        Option('limit', "maximum number of revisions to display",
 
36
               int, 'count')]
 
37
    takes_args = [ "location?" ]
 
38
    aliases = [ "visualize", "vis", "viz" ]
 
39
 
 
40
    def run(self, location=".", revision=None, limit=None):
 
41
        (branch, path) = Branch.open_containing(location)
 
42
        branch.lock_read()
 
43
        branch.repository.lock_read()
 
44
        try:
 
45
            if revision is None:
 
46
                revid = branch.last_revision()
 
47
                if revid is None:
 
48
                    return
 
49
            else:
 
50
                (revno, revid) = revision[0].in_history(branch)
 
51
 
 
52
            from bzrkapp import BzrkApp
 
53
                
 
54
            app = BzrkApp()
 
55
            app.show(branch, revid, limit)
 
56
        finally:
 
57
            branch.repository.unlock()
 
58
            branch.unlock()
 
59
        app.main()
 
60
 
 
61
 
 
62
register_command(cmd_visualise)