-- Copyright (C) 2002-2005,2007 David Roundy---- 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 2, 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; see the file COPYING. If not, write to-- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,-- Boston, MA 02110-1301, USA.{-# OPTIONS_GHC -cpp #-}{-# LANGUAGE CPP #-}#include "gadts.h"moduleDarcs.Repository.ApplyPatches(apply_patches,apply_patches_with_feedback)whereimportDarcs.Patch(Patchy,apply)importDarcs.Hopefully(PatchInfoAnd,hopefully,info)importDarcs.Patch.Info(human_friendly)importDarcs.Ordered(FL(..),lengthFL,mapFL)importDarcs.Flags(DarcsFlag)importDarcs.Utils(putDocLnError)importProgress(beginTedious,endTedious,tediousSize,finishedOneIO)importPrinter(text)apply_patches_with_feedback::Patchyp=>[DarcsFlag]->String->FL(PatchInfoAndp)C(xy)->IO()apply_patches_with_feedback__NilFL=return()apply_patches_with_feedbackoptskpatches=dobeginTediousktediousSizek(lengthFLpatches)sequence_$mapFLapply_cautiouslypatchesendTediouskwhereapply_cautiously::Patchyp=>PatchInfoAndpC(ab)->IO()apply_cautiouslyhp=dofinishedOneIOk(show$human_friendly$infohp)applyopts(hopefullyhp)`catch`\e->doputDocLnError$text"Unapplicable patch:"putDocLnError$human_friendly(infohp)ioErroreapply_patches::Patchyp=>[DarcsFlag]->FL(PatchInfoAndp)C(xy)->IO()apply_patchesoptsps=apply_patches_with_feedbackopts"Applying patch"ps