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 |
||
40
by David Allouche
remove --robust, pyflakes fixes, update README |
19 |
from bzrlib.commands import Command, register_command |
32
by David Allouche
make expensive sorting and parent filtering optional |
20 |
from bzrlib.option import Option |
1
by Scott James Remnant
Commit the first version of bzrk. |
21 |
from bzrlib.branch import Branch |
22 |
||
23 |
||
40
by David Allouche
remove --robust, pyflakes fixes, update README |
24 |
class cmd_visualise(Command): |
1
by Scott James Remnant
Commit the first version of bzrk. |
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 |
"""
|
|
32
by David Allouche
make expensive sorting and parent filtering optional |
33 |
takes_options = [ |
34 |
"revision", |
|
33
by David Allouche
add --maxnum option to cut-off long histories |
35 |
Option('maxnum', "maximum number of revisions to display", int, 'count')] |
1
by Scott James Remnant
Commit the first version of bzrk. |
36 |
takes_args = [ "location?" ] |
15
by Scott James Remnant
Add aliases for people who can't spell (Americans) |
37 |
aliases = [ "visualize", "vis", "viz" ] |
1
by Scott James Remnant
Commit the first version of bzrk. |
38 |
|
40
by David Allouche
remove --robust, pyflakes fixes, update README |
39 |
def run(self, location=".", revision=None, maxnum=None): |
16
by Scott James Remnant
Branch.open_containing now returns a tuple |
40 |
(branch, path) = Branch.open_containing(location) |
36
by Jamie Wilkinson
patch from Aaron Bentley to lock the repository to boost performance getting single revisions |
41 |
branch.lock_read() |
42 |
branch.repository.lock_read() |
|
43 |
try: |
|
44 |
if revision is None: |
|
45 |
revid = branch.last_revision() |
|
46 |
if revid is None: |
|
47 |
return
|
|
48 |
else: |
|
49 |
(revno, revid) = revision[0].in_history(branch) |
|
50 |
||
51 |
from bzrkapp import BzrkApp |
|
52 |
||
53 |
app = BzrkApp() |
|
40
by David Allouche
remove --robust, pyflakes fixes, update README |
54 |
app.show(branch, revid, maxnum) |
36
by Jamie Wilkinson
patch from Aaron Bentley to lock the repository to boost performance getting single revisions |
55 |
finally: |
56 |
branch.repository.unlock() |
|
57 |
branch.unlock() |
|
1
by Scott James Remnant
Commit the first version of bzrk. |
58 |
app.main() |
59 |
||
60 |
||
40
by David Allouche
remove --robust, pyflakes fixes, update README |
61 |
register_command(cmd_visualise) |