repo: basic support for quota detection

This commit is contained in:
Hylke Bons 2012-04-04 23:45:20 +01:00
parent 6f552f48a8
commit 8fc30c7d0f
3 changed files with 44 additions and 0 deletions

View file

@ -221,6 +221,12 @@ namespace SparkleLib.Git {
number = (number / 100 * 20);
} else {
if (line.StartsWith ("ERROR: QUOTA EXCEEDED")) {
int quota_limit = int.Parse (line.Substring (21).Trim ());
throw new QuotaExceededException ("Quota exceeded", quota_limit);
}
// "Writing objects" stage
number = (number / 100 * 80 + 20);

View file

@ -7,6 +7,7 @@ SOURCES = \
SparkleBackend.cs \
SparkleChangeSet.cs \
SparkleConfig.cs \
SparkleExceptions.cs \
SparkleExtensions.cs \
SparkleFetcherBase.cs \
SparkleHelpers.cs \

View file

@ -0,0 +1,37 @@
// SparkleShare, a collaboration and sharing tool.
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace SparkleLib {
public class QuotaExceededException : Exception {
public readonly int QuotaLimit = -1;
public QuotaExceededException ()
{
}
public QuotaExceededException (string message, int quota_limit) : base (message)
{
QuotaLimit = quota_limit;
}
}
}