You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2014/04/04 21:57:33 UTC
[4/6] git commit: [#7168] ticket:569 Avoid hitting repo twice
[#7168] ticket:569 Avoid hitting repo twice
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/bed557cd
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/bed557cd
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/bed557cd
Branch: refs/heads/master
Commit: bed557cd0d8761de782557e7949af8c0615a4b80
Parents: 2b86457
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Apr 3 08:37:57 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri Apr 4 19:51:24 2014 +0000
----------------------------------------------------------------------
Allura/allura/lib/macro.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/bed557cd/Allura/allura/lib/macro.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/macro.py b/Allura/allura/lib/macro.py
index 3b173fe..87a09af 100644
--- a/Allura/allura/lib/macro.py
+++ b/Allura/allura/lib/macro.py
@@ -349,10 +349,12 @@ def include_file(repo, path=None, rev=None, **kw):
if not app:
return '[[include repo %s (not found)]]' % repo
rev = app.repo.head if rev is None else rev
- if not path or not app.repo.is_file(path, rev):
+
+ try:
+ file = app.repo.commit(rev).get_path(path)
+ except Exception:
return "[[include can't find file %s in revision %s]]" % (path, rev)
- file = app.repo.commit(rev).get_path(path)
text = ''
if file.has_pypeline_view:
text = h.render_any_markup(file.name, file.text, code_mode=True)