/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: 2012-07-09 15:23:26 UTC
  • mto: This revision was merged to the branch mainline in revision 794.
  • Revision ID: jelmer@samba.org-20120709152326-dzxb8zoz0btull7n
Remove bzr-notify.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
1
# -*- coding: UTF-8 -*-
3
2
"""GTK+ Branch Visualisation.
4
3
 
12
11
The bottom hald of the window shows the details for the selected revision.
13
12
"""
14
13
 
 
14
from branchwin import BranchWindow
 
15
 
15
16
__copyright__ = "Copyright © 2005 Canonical Ltd."
16
17
__author__    = "Scott James Remnant <scott@ubuntu.com>"
17
18
 
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)