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
=== modified file 'bzr/Makefile.am'
--- bzr/Makefile.am 2010-06-07 19:50:44 +0000
+++ bzr/Makefile.am 2010-11-01 16:35:59 +0000
@@ -1,13 +1,22 @@
1EXTRA_DIST = bzr-icon-64.png
2
1bzrplugindir = $(datadir)/pyshared/bzrlib/plugins/zeitgeist3bzrplugindir = $(datadir)/pyshared/bzrlib/plugins/zeitgeist
2bzrplugin_DATA = __init__.py4bzrplugin_DATA = __init__.py
35
6bzricondir = $(datadir)/pixmaps
7bzricon_DATA = bzr-icon-64.png
8
4# we want to allow also local install9# we want to allow also local install
5BZR_PLUGIN_HOME_DIR = ~/.bazaar/plugins/zeitgeist10BZR_PLUGIN_HOME_DIR = ~/.bazaar/plugins/zeitgeist
11BZR_ICON_DIR = ~/.local/share/icons
612
7local-install:13local-install:
8 mkdir -p $(BZR_PLUGIN_HOME_DIR)14 mkdir -p $(BZR_PLUGIN_HOME_DIR)
9 cp __init__.py $(BZR_PLUGIN_HOME_DIR)15 cp __init__.py $(BZR_PLUGIN_HOME_DIR)
16 mkdir -p $(BZR_ICON_DIR)
17 cp bzr-icon-64.png $(BZR_ICON_DIR)
1018
11local-uninstall:19local-uninstall:
12 -rm -rf $(BZR_PLUGIN_HOME_DIR)20 -rm -rf $(BZR_PLUGIN_HOME_DIR)
21 -rm -rf $(BZR_ICON_DIR)
1322
1423
=== modified file 'bzr/__init__.py'
--- bzr/__init__.py 2010-06-04 20:31:58 +0000
+++ bzr/__init__.py 2010-11-01 16:35:59 +0000
@@ -22,6 +22,7 @@
22Requires bzr 0.15 or higher.22Requires bzr 0.15 or higher.
2323
24Copyright (C) 2009, Markus Korn <thekorn@gmx.de>24Copyright (C) 2009, Markus Korn <thekorn@gmx.de>
25Copyright (C) 2010, Stefano Candori <stefano.candori@gmail.com>
25Published under the GNU GPLv2 or later26Published under the GNU GPLv2 or later
2627
27Installation:28Installation:
@@ -56,11 +57,42 @@
56 interpretation = Interpretation.CREATE_EVENT57 interpretation = Interpretation.CREATE_EVENT
57 else:58 else:
58 interpretation = Interpretation.MODIFY_EVENT59 interpretation = Interpretation.MODIFY_EVENT
59 subject = Subject.new_for_values(60 _text = _("Commited on: ")
60 uri=unicode(master.base),61 _text += master.base[7:-1] #don't considere file://
61 interpretation=unicode(Interpretation.SOURCE_CODE),62 _text += _(" Revision no. : ")
62 manifestation=unicode(Manifestation.FILE_DATA_OBJECT),63 _text += str(new_revno) + "\n"
63 text=unicode(revision.message.rstrip()),64 _text += revision.message.rstrip()
65
66 subject = Subject.new_for_values(
67 uri=unicode(master.base),
68 interpretation=unicode(Interpretation.FOLDER),
69 manifestation=unicode(Manifestation.FILE_DATA_OBJECT),
70 text=unicode(_text),
71 origin=unicode(master.base),
72 )
73 event = Event.new_for_values(
74 timestamp=int(time.time()*1000),
75 interpretation=unicode(interpretation),
76 manifestation=unicode(Manifestation.USER_ACTIVITY),
77 actor="application://bzr.desktop", #something usefull here, always olive-gtk?
78 subjects=[subject,]
79 )
80 CLIENT.insert_event(event)
81
82def post_pull(pull_result):
83 master = pull_result.master_branch
84 revision = master.repository.get_revision(pull_result.new_revid)
85 interpretation = Interpretation.RECEIVE_EVENT
86 _text = _("Pulled ")
87 _text += master.base[7:-1] #don't considere file://
88 _text += (" to revision ")
89 _text += str(master.revno())+":\n"
90 _text += revision.get_summary()
91 subject = Subject.new_for_values(
92 uri=unicode(master.base),
93 interpretation=unicode(Interpretation.FOLDER),
94 manifestation=unicode(Manifestation.FILE_DATA_OBJECT),
95 text=unicode(_text),
64 origin=unicode(master.base),96 origin=unicode(master.base),
65 )97 )
66 event = Event.new_for_values(98 event = Event.new_for_values(
@@ -75,3 +107,5 @@
75if install_hook:107if install_hook:
76 branch.Branch.hooks.install_named_hook("post_commit", post_commit,108 branch.Branch.hooks.install_named_hook("post_commit", post_commit,
77 "Zeitgeist dataprovider for bzr")109 "Zeitgeist dataprovider for bzr")
110 branch.Branch.hooks.install_named_hook("post_pull", post_pull,
111 "Zeitgeist dataprovider for bzr")
78112
=== added file 'bzr/bzr-icon-64.png'
79Binary 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 differ113Binary 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