summaryrefslogtreecommitdiff
path: root/bzr
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2011-12-04 21:11:33 +0100
committerJelmer Vernooij <jelmer@samba.org>2011-12-04 21:11:33 +0100
commite1792e1a4901ab62f140acaafb9b0a115ce1cfb6 (patch)
tree9b4e9166d1473397f47fa39f96182d1129617b9d /bzr
parent7742125884a00f42d20984a34054e7fa37c9f2aa (diff)
Cope with some repository formats not supporting .get_revisions().
Diffstat (limited to 'bzr')
-rw-r--r--bzr/__init__.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/bzr/__init__.py b/bzr/__init__.py
index 8699c4d..7ede025 100644
--- a/bzr/__init__.py
+++ b/bzr/__init__.py
@@ -32,6 +32,7 @@ Copy this directory to ~/.bazaar/plugins/zeitgeist/*
from bzrlib import (
branch,
+ errors,
trace,
urlutils,
)
@@ -110,7 +111,14 @@ def post_pull(pull_result):
if client is None:
return
from zeitgeist.datamodel import Event, Interpretation, Manifestation
- revision = pull_result.master_branch.repository.get_revision(pull_result.new_revid)
+ try:
+ revision = pull_result.master_branch.repository.get_revision(
+ pull_result.new_revid)
+ except errors.UnsupportedOperation:
+ # Some remote repository formats (e.g. git) don't support looking at invidual
+ # revisions
+ revision = pull_result.source_branch.repository.get_revision(
+ pull_result.new_revid)
_text = _("Pulled to revision %s:\n %s") % (pull_result.new_revno,
revision.get_summary())
subject = subject_for_branch(pull_result.master_branch)
@@ -128,8 +136,12 @@ def post_push(push_result):
if client is None:
return
from zeitgeist.datamodel import Event, Interpretation, Manifestation
- revision = push_result.master_branch.repository.get_revision(
- push_result.new_revid)
+ try:
+ revision = push_result.master_branch.repository.get_revision(
+ push_result.new_revid)
+ except errors.UnsupportedOperation:
+ revision = push_result.source_branch.repository.get_revision(
+ push_result.new_revid)
_text = _("Pushed to revision %s:\n %s") % (push_result.new_revno,
revision.get_summary())
subject = subject_for_branch(push_result.master_branch)