-- Copyright (C) 2002-2005 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.{-# LANGUAGE CPP #-}moduleDarcs.Patch.Show(ShowPatchBasic(..),ShowPatch(..),showNamedPrefix,writePatch,gzWritePatch,formatFileName)whereimportPreludehiding(pi)importDarcs.Lock(writeDocBinFile,gzWriteDocFile)importDarcs.Patch.FileName(FileName,fn2ps,encodeWhite,fn2fp)importDarcs.Patch.Format(FileNameFormat(..))importDarcs.Patch.Info(PatchInfo,showPatchInfo)importDarcs.Witnesses.Ordered(FL)importEnglish(plural,Noun(Noun))importPrinter(Doc,vcat,blueText,($$),(<>),text,packedString)importDarcs.Patch.ApplyMonad(ApplyMonadTrans,ApplyMonad)importDarcs.Patch.Apply(ApplyState)#include "gadts.h"showNamedPrefix::PatchInfo->[PatchInfo]->DocshowNamedPrefixnd=showPatchInfon$$blueText"<"$$vcat(mapshowPatchInfod)$$blueText">"classShowPatchBasicpwhereshowPatch::pC(xy)->DocclassShowPatchBasicp=>ShowPatchpwhereshowNicely::pC(xy)->DocshowNicely=showPatch-- | showContextPatch is used to add context to a patch, as diff-- -u does. Thus, it differs from showPatch only for hunks. It is-- used for instance before putting it into a bundle. As this-- unified context is not included in patch representation, this-- requires access to the tree.showContextPatch::(Monadm,ApplyMonadTransm(ApplyStatep),ApplyMonadm(ApplyStatep))=>pC(xy)->mDocshowContextPatchp=return$showPatchpdescription::pC(xy)->Docdescription=showPatchsummary::pC(xy)->DocsummaryFL::FLpC(xy)->Docthing::pC(xy)->Stringthing_="patch"things::pC(xy)->Stringthingsx=plural(Noun$thingx)""writePatch::ShowPatchBasicp=>FilePath->pC(xy)->IO()writePatchfp=writeDocBinFilef$showPatchp<>text"\n"gzWritePatch::ShowPatchBasicp=>FilePath->pC(xy)->IO()gzWritePatchfp=gzWriteDocFilef$showPatchp<>text"\n"formatFileName::FileNameFormat->FileName->DocformatFileNameOldFormat=packedString.fn2psformatFileNameNewFormat=text.encodeWhite.fn2fp