From 11a234e135b38ad414f96d419e13bde1629f07d5 Mon Sep 17 00:00:00 2001
From: Thomas Keller
Date: Sat, 11 Jun 2011 00:47:54 +0200
Subject: [PATCH] Fix the branch links users of the Subversion frontend get
when they enter a wrong revision and only display this list if there are any
branches available for all SCMs.
---
NEWS.mdtext | 2 ++
src/IDF/Views/Source.php | 3 +-
.../idf/source/git/invalid_revision.html | 2 ++
.../idf/source/invalid_revision.html | 2 ++
.../source/mercurial/invalid_revision.html | 2 ++
.../idf/source/mtn/invalid_revision.html | 2 ++
.../idf/source/svn/invalid_revision.html | 30 +++++++++++++++++++
7 files changed, 42 insertions(+), 1 deletion(-)
create mode 100644 src/IDF/templates/idf/source/git/invalid_revision.html
create mode 100644 src/IDF/templates/idf/source/mercurial/invalid_revision.html
create mode 100644 src/IDF/templates/idf/source/mtn/invalid_revision.html
create mode 100644 src/IDF/templates/idf/source/svn/invalid_revision.html
diff --git a/NEWS.mdtext b/NEWS.mdtext
index 37ae1a7..51e6e84 100644
--- a/NEWS.mdtext
+++ b/NEWS.mdtext
@@ -31,6 +31,8 @@ or newer to properly run this version of Indefero!
a new project or monotone key, in case an error popped up in the middle (issue 697)
- Better error detection and reporting in the SyncMonotone plugin
ATTENTION: This needs Pluf 46b7f251 or newer!
+- Fix the branch links users of the Subversion frontend get when they enter a wrong revision
+ and only display this list if there are any branches available for all SCMs
## Documentation
diff --git a/src/IDF/Views/Source.php b/src/IDF/Views/Source.php
index 758830c..1496e54 100644
--- a/src/IDF/Views/Source.php
+++ b/src/IDF/Views/Source.php
@@ -66,7 +66,8 @@ class IDF_Views_Source
'commit' => $commit,
'branches' => $branches,
);
- return Pluf_Shortcuts_RenderToResponse('idf/source/invalid_revision.html',
+ $scmConf = $request->conf->getVal('scm', 'git');
+ return Pluf_Shortcuts_RenderToResponse('idf/source/'.$scmConf.'/invalid_revision.html',
$params, $request);
}
diff --git a/src/IDF/templates/idf/source/git/invalid_revision.html b/src/IDF/templates/idf/source/git/invalid_revision.html
new file mode 100644
index 0000000..2b5822e
--- /dev/null
+++ b/src/IDF/templates/idf/source/git/invalid_revision.html
@@ -0,0 +1,2 @@
+{extends "idf/source/invalid_revision.html"}
+
diff --git a/src/IDF/templates/idf/source/invalid_revision.html b/src/IDF/templates/idf/source/invalid_revision.html
index ded55fd..b030b27 100644
--- a/src/IDF/templates/idf/source/invalid_revision.html
+++ b/src/IDF/templates/idf/source/invalid_revision.html
@@ -5,6 +5,7 @@
{blocktrans}The branch or revision {$commit} is not valid or does not exist
in this repository.{/blocktrans}
+{if count($branches) > 0}
{blocktrans}The following list shows all available branches:{/blocktrans}
{foreach $branches as $branch => $path}
@@ -14,6 +15,7 @@ in this repository.{/blocktrans}
{/foreach}
+{/if}
{if $isOwner or $isMember}
{aurl 'url', 'IDF_Views_Source::help', array($project.shortname)}
diff --git a/src/IDF/templates/idf/source/mercurial/invalid_revision.html b/src/IDF/templates/idf/source/mercurial/invalid_revision.html
new file mode 100644
index 0000000..2b5822e
--- /dev/null
+++ b/src/IDF/templates/idf/source/mercurial/invalid_revision.html
@@ -0,0 +1,2 @@
+{extends "idf/source/invalid_revision.html"}
+
diff --git a/src/IDF/templates/idf/source/mtn/invalid_revision.html b/src/IDF/templates/idf/source/mtn/invalid_revision.html
new file mode 100644
index 0000000..2b5822e
--- /dev/null
+++ b/src/IDF/templates/idf/source/mtn/invalid_revision.html
@@ -0,0 +1,2 @@
+{extends "idf/source/invalid_revision.html"}
+
diff --git a/src/IDF/templates/idf/source/svn/invalid_revision.html b/src/IDF/templates/idf/source/svn/invalid_revision.html
new file mode 100644
index 0000000..8880b99
--- /dev/null
+++ b/src/IDF/templates/idf/source/svn/invalid_revision.html
@@ -0,0 +1,30 @@
+{extends "idf/source/base.html"}
+{block docclass}yui-t2{assign $inError=true}{/block}
+{block body}
+
+{blocktrans}The revision {$commit} is not valid or does not exist
+in this repository.{/blocktrans}
+
+{if count($branches) > 0}
+{blocktrans}The following list shows all available branches:{/blocktrans}
+
+{foreach $branches as $branch => $path}
+{if $path}{aurl 'url', 'IDF_Views_Source::tree', array($project.shortname, 'HEAD', $path)}
+{else}{aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, 'HEAD')}{/if}
+-
+ {$branch}
+
+{/foreach}
+
+{/if}
+
+{if $isOwner or $isMember}
+{aurl 'url', 'IDF_Views_Source::help', array($project.shortname)}
+{blocktrans}If this is a new repository, the reason for this error
+could be that you have not committed and / or pushed any change so far.
+In this case please take a look at the Help page
+how to access your repository.{/blocktrans}
+{/if}
+
+{/block}
+