From e1792e1a4901ab62f140acaafb9b0a115ce1cfb6 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 4 Dec 2011 21:11:33 +0100 Subject: Cope with some repository formats not supporting .get_revisions(). --- bzr/__init__.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'bzr') 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) -- cgit v1.2.3