From 9a8148079df4f8357d054260c43cc9adc5c40e4a Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Wed, 23 Jun 2010 00:22:10 +0200 Subject: [PATCH] prevent endless redirection if a requested branch does not exist, i.e. has no matching revisions --- src/IDF/Scm/Monotone.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/IDF/Scm/Monotone.php b/src/IDF/Scm/Monotone.php index 20c1acf..49c40b0 100644 --- a/src/IDF/Scm/Monotone.php +++ b/src/IDF/Scm/Monotone.php @@ -420,7 +420,8 @@ class IDF_Scm_Monotone extends IDF_Scm /** * monotone has no concept of a "main" branch, so just return - * the confiured one + * the configured one. Ensure however that we can select revisions + * with it at all. * * @see IDF_Scm::getMainBranch() */ @@ -431,6 +432,14 @@ class IDF_Scm_Monotone extends IDF_Scm || empty($branch)) { $branch = "*"; } + + if (count($this->_resolveSelector("h:$branch")) == 0) + { + throw new IDF_Scm_Exception( + "Branch $branch is empty" + ); + } + return $branch; }