summaryrefslogtreecommitdiff
path: root/bzr
diff options
context:
space:
mode:
authorStefano Candori <stefano.candori@gmail.com>2010-10-30 11:28:49 +0200
committerStefano Candori <stefano.candori@gmail.com>2010-10-30 11:28:49 +0200
commitd84f7ebf1f7fe2576322b1b907f3b68f330c43e7 (patch)
tree5eed0dff562334a086e145d68de40280e20f0fc2 /bzr
parenta1ed4d2d7a996ded58b39661a65ab8f5ea684fc1 (diff)
Added post-pull event to bzr data-provider.Added bzr icon and modified makefile.
Diffstat (limited to 'bzr')
-rw-r--r--bzr/Makefile.am4
-rw-r--r--bzr/__init__.py36
-rw-r--r--bzr/bzr-icon-64.pngbin0 -> 3880 bytes
3 files changed, 39 insertions, 1 deletions
diff --git a/bzr/Makefile.am b/bzr/Makefile.am
index 945ec50..5c2cbfb 100644
--- a/bzr/Makefile.am
+++ b/bzr/Makefile.am
@@ -3,11 +3,15 @@ bzrplugin_DATA = __init__.py
# we want to allow also local install
BZR_PLUGIN_HOME_DIR = ~/.bazaar/plugins/zeitgeist
+BZR_ICON_DIR = ~/.local/share/icons
local-install:
mkdir -p $(BZR_PLUGIN_HOME_DIR)
cp __init__.py $(BZR_PLUGIN_HOME_DIR)
+ mkdir -p $(BZR_ICON_DIR)
+ cp bzr-icon-64.png $(BZR_ICON_DIR)
local-uninstall:
-rm -rf $(BZR_PLUGIN_HOME_DIR)
+ -rm -rf $(BZR_ICON_DIR)
diff --git a/bzr/__init__.py b/bzr/__init__.py
index ccf07b3..a253974 100644
--- a/bzr/__init__.py
+++ b/bzr/__init__.py
@@ -22,6 +22,7 @@
Requires bzr 0.15 or higher.
Copyright (C) 2009, Markus Korn <thekorn@gmx.de>
+Copyright (C) 2010, Stefano Candori <stefano.candori@gmail.com>
Published under the GNU GPLv2 or later
Installation:
@@ -56,11 +57,42 @@ def post_commit(local, master, old_revno, old_revid, new_revno, new_revid):
interpretation = Interpretation.CREATE_EVENT
else:
interpretation = Interpretation.MODIFY_EVENT
+ _text = _("Commited on: ")
+ _text += master.base[7:-1] #don't considere file://
+ _text += _(" Revision no. : ")
+ _text += str(new_revno) + "\n"
+ _text += revision.message.rstrip()
+
subject = Subject.new_for_values(
uri=unicode(master.base),
interpretation=unicode(Interpretation.SOURCE_CODE),
manifestation=unicode(Manifestation.FILE_DATA_OBJECT),
- text=unicode(revision.message.rstrip()),
+ text=unicode(_text),
+ origin=unicode(master.base),
+ )
+ event = Event.new_for_values(
+ timestamp=int(time.time()*1000),
+ interpretation=unicode(interpretation),
+ manifestation=unicode(Manifestation.USER_ACTIVITY),
+ actor="application://bzr.desktop", #something usefull here, always olive-gtk?
+ subjects=[subject,]
+ )
+ CLIENT.insert_event(event)
+
+def post_pull(pull_result):
+ master = pull_result.master_branch
+ revision = master.repository.get_revision(pull_result.new_revid)
+ interpretation = Interpretation.RECEIVE_EVENT
+ _text = _("Pulled ")
+ _text += master.base[7:-1] #don't considere file://
+ _text += (" to revision ")
+ _text += str(master.revno())+":\n"
+ _text += revision.get_summary()
+ subject = Subject.new_for_values(
+ uri=unicode(master.base),
+ interpretation=unicode(Interpretation.SOURCE_CODE),
+ manifestation=unicode(Manifestation.FILE_DATA_OBJECT),
+ text=unicode(_text),
origin=unicode(master.base),
)
event = Event.new_for_values(
@@ -75,3 +107,5 @@ def post_commit(local, master, old_revno, old_revid, new_revno, new_revid):
if install_hook:
branch.Branch.hooks.install_named_hook("post_commit", post_commit,
"Zeitgeist dataprovider for bzr")
+ branch.Branch.hooks.install_named_hook("post_pull", post_pull,
+ "Zeitgeist dataprovider for bzr")
diff --git a/bzr/bzr-icon-64.png b/bzr/bzr-icon-64.png
new file mode 100644
index 0000000..9dd8d07
--- /dev/null
+++ b/bzr/bzr-icon-64.png
Binary files differ