Merge lp:~cando/zeitgeist-datasources/bzr into lp:zeitgeist-datasources/0.8

Proposed by Stefano Candori
Status: Merged
Merged at revision: 96
Proposed branch: lp:~cando/zeitgeist-datasources/bzr
Merge into: lp:zeitgeist-datasources/0.8
Diff against target: 95 lines (+48/-5)
2 files modified
bzr/Makefile.am (+9/-0)
bzr/__init__.py (+39/-5)
To merge this branch: bzr merge lp:~cando/zeitgeist-datasources/bzr
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
Review via email: mp+39684@code.launchpad.net

Description of the change

In this branch i've:
 * added the support for Zeitgeist to register a Pull event from bzr;
 * improved the displayed text for a Commit event;
 * added a bzr-icon, not present before.

To post a comment you must log in.
lp:~cando/zeitgeist-datasources/bzr updated
95. By Stefano Candori

Fixed bzr Makefile for global install

Revision history for this message
Michal Hruby (mhr3) wrote :

While we're at it could you please change the subject interpretation to Interpretation.FOLDER? Seems like we had that wrong all the time...

review: Needs Fixing
lp:~cando/zeitgeist-datasources/bzr updated
96. By Stefano Candori

Changed subject intepretation to Interpretation.FOLDER

Revision history for this message
Stefano Candori (cando) wrote :

> While we're at it could you please change the subject interpretation to
> Interpretation.FOLDER? Seems like we had that wrong all the time...
here you are...

Revision history for this message
Michal Hruby (mhr3) wrote :

Sorry for forgetting about this... Merged.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzr/Makefile.am'
2--- bzr/Makefile.am 2010-06-07 19:50:44 +0000
3+++ bzr/Makefile.am 2010-11-01 16:35:59 +0000
4@@ -1,13 +1,22 @@
5+EXTRA_DIST = bzr-icon-64.png
6+
7 bzrplugindir = $(datadir)/pyshared/bzrlib/plugins/zeitgeist
8 bzrplugin_DATA = __init__.py
9
10+bzricondir = $(datadir)/pixmaps
11+bzricon_DATA = bzr-icon-64.png
12+
13 # we want to allow also local install
14 BZR_PLUGIN_HOME_DIR = ~/.bazaar/plugins/zeitgeist
15+BZR_ICON_DIR = ~/.local/share/icons
16
17 local-install:
18 mkdir -p $(BZR_PLUGIN_HOME_DIR)
19 cp __init__.py $(BZR_PLUGIN_HOME_DIR)
20+ mkdir -p $(BZR_ICON_DIR)
21+ cp bzr-icon-64.png $(BZR_ICON_DIR)
22
23 local-uninstall:
24 -rm -rf $(BZR_PLUGIN_HOME_DIR)
25+ -rm -rf $(BZR_ICON_DIR)
26
27
28=== modified file 'bzr/__init__.py'
29--- bzr/__init__.py 2010-06-04 20:31:58 +0000
30+++ bzr/__init__.py 2010-11-01 16:35:59 +0000
31@@ -22,6 +22,7 @@
32 Requires bzr 0.15 or higher.
33
34 Copyright (C) 2009, Markus Korn <thekorn@gmx.de>
35+Copyright (C) 2010, Stefano Candori <stefano.candori@gmail.com>
36 Published under the GNU GPLv2 or later
37
38 Installation:
39@@ -56,11 +57,42 @@
40 interpretation = Interpretation.CREATE_EVENT
41 else:
42 interpretation = Interpretation.MODIFY_EVENT
43- subject = Subject.new_for_values(
44- uri=unicode(master.base),
45- interpretation=unicode(Interpretation.SOURCE_CODE),
46- manifestation=unicode(Manifestation.FILE_DATA_OBJECT),
47- text=unicode(revision.message.rstrip()),
48+ _text = _("Commited on: ")
49+ _text += master.base[7:-1] #don't considere file://
50+ _text += _(" Revision no. : ")
51+ _text += str(new_revno) + "\n"
52+ _text += revision.message.rstrip()
53+
54+ subject = Subject.new_for_values(
55+ uri=unicode(master.base),
56+ interpretation=unicode(Interpretation.FOLDER),
57+ manifestation=unicode(Manifestation.FILE_DATA_OBJECT),
58+ text=unicode(_text),
59+ origin=unicode(master.base),
60+ )
61+ event = Event.new_for_values(
62+ timestamp=int(time.time()*1000),
63+ interpretation=unicode(interpretation),
64+ manifestation=unicode(Manifestation.USER_ACTIVITY),
65+ actor="application://bzr.desktop", #something usefull here, always olive-gtk?
66+ subjects=[subject,]
67+ )
68+ CLIENT.insert_event(event)
69+
70+def post_pull(pull_result):
71+ master = pull_result.master_branch
72+ revision = master.repository.get_revision(pull_result.new_revid)
73+ interpretation = Interpretation.RECEIVE_EVENT
74+ _text = _("Pulled ")
75+ _text += master.base[7:-1] #don't considere file://
76+ _text += (" to revision ")
77+ _text += str(master.revno())+":\n"
78+ _text += revision.get_summary()
79+ subject = Subject.new_for_values(
80+ uri=unicode(master.base),
81+ interpretation=unicode(Interpretation.FOLDER),
82+ manifestation=unicode(Manifestation.FILE_DATA_OBJECT),
83+ text=unicode(_text),
84 origin=unicode(master.base),
85 )
86 event = Event.new_for_values(
87@@ -75,3 +107,5 @@
88 if install_hook:
89 branch.Branch.hooks.install_named_hook("post_commit", post_commit,
90 "Zeitgeist dataprovider for bzr")
91+ branch.Branch.hooks.install_named_hook("post_pull", post_pull,
92+ "Zeitgeist dataprovider for bzr")
93
94=== added file 'bzr/bzr-icon-64.png'
95Binary files bzr/bzr-icon-64.png 1970-01-01 00:00:00 +0000 and bzr/bzr-icon-64.png 2010-11-01 16:35:59 +0000 differ

Subscribers

People subscribed via source and target branches