bzr branch
http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
1
by Scott James Remnant
Commit the first version of bzrk. |
1 |
#!/usr/bin/python
|
2 |
# -*- coding: UTF-8 -*-
|
|
3 |
"""GTK+ Branch Visualisation.
|
|
4 |
||
5 |
This is a bzr plugin that adds a new 'visualise' (alias: 'viz') command
|
|
6 |
which opens a GTK+ window to allow you to see the history of the branch
|
|
7 |
and relationships between revisions in a visual manner.
|
|
8 |
||
9 |
It's somewhat based on a screenshot I was handed of gitk. The top half
|
|
10 |
of the window shows the revisions in a list with a graph drawn down the
|
|
11 |
left hand side that joins them up and shows how they relate to each other.
|
|
12 |
The bottom hald of the window shows the details for the selected revision.
|
|
13 |
"""
|
|
14 |
||
15 |
__copyright__ = "Copyright © 2005 Canonical Ltd." |
|
16 |
__author__ = "Scott James Remnant <scott@ubuntu.com>" |
|
17 |
||
18 |
||
19 |
import bzrlib |
|
20 |
import bzrlib.commands |
|
21 |
||
22 |
from bzrlib.branch import Branch |
|
23 |
||
24 |
||
25 |
class cmd_visualise(bzrlib.commands.Command): |
|
26 |
"""Graphically visualise this branch. |
|
27 |
||
28 |
Opens a graphical window to allow you to see the history of the branch
|
|
29 |
and relationships between revisions in a visual manner,
|
|
30 |
||
31 |
The default starting point is latest revision on the branch, you can
|
|
32 |
specify a starting point with -r revision.
|
|
33 |
"""
|
|
34 |
takes_options = [ "revision" ] |
|
35 |
takes_args = [ "location?" ] |
|
15
by Scott James Remnant
Add aliases for people who can't spell (Americans) |
36 |
aliases = [ "visualize", "vis", "viz" ] |
1
by Scott James Remnant
Commit the first version of bzrk. |
37 |
|
38 |
def run(self, location=".", revision=None): |
|
16
by Scott James Remnant
Branch.open_containing now returns a tuple |
39 |
(branch, path) = Branch.open_containing(location) |
1
by Scott James Remnant
Commit the first version of bzrk. |
40 |
if revision is None: |
41 |
revid = branch.last_revision() |
|
42 |
if revid is None: |
|
43 |
return
|
|
44 |
else: |
|
45 |
(revno, revid) = revision[0].in_history(branch) |
|
46 |
||
13.1.1
by Jelmer Vernooij
Import Bzrkapp() only when running "bzr viz" so other |
47 |
from bzrkapp import BzrkApp |
48 |
||
1
by Scott James Remnant
Commit the first version of bzrk. |
49 |
app = BzrkApp() |
50 |
app.show(branch, revid) |
|
51 |
app.main() |
|
52 |
||
53 |
||
54 |
bzrlib.commands.register_command(cmd_visualise) |