1 -- Copyright (C) 2003 David Roundy
    2 --
    3 -- This program is free software; you can redistribute it and/or modify
    4 -- it under the terms of the GNU General Public License as published by
    5 -- the Free Software Foundation; either version 2, or (at your option)
    6 -- any later version.
    7 --
    8 -- This program is distributed in the hope that it will be useful,
    9 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
   10 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   11 -- GNU General Public License for more details.
   12 --
   13 -- You should have received a copy of the GNU General Public License
   14 -- along with this program; see the file COPYING.  If not, write to
   15 -- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   16 -- Boston, MA 02110-1301, USA.
   17 
   18 {-# OPTIONS_GHC -cpp #-}
   19 {-# LANGUAGE CPP #-}
   20 
   21 #include "gadts.h"
   22 
   23 module Darcs.Patch.Set ( PatchSet, SealedPatchSet ) where
   24 
   25 import Darcs.Hopefully ( PatchInfoAnd )
   26 import Darcs.Ordered ( RL )
   27 import Darcs.Sealed ( Sealed )
   28 
   29 -- | A PatchSet is in reverse order, plus has information about which
   30 -- tags are clean, meaning all patches applied prior to them are in
   31 -- the tag itself, so we can stop reading at that point.  Just to
   32 -- clarify, the first patch in a PatchSet is the one most recently
   33 -- applied to the repo.
   34 --
   35 -- 'PatchSet's have the property that if
   36 -- @
   37 -- (info $ last $ head a) == (info $ last $ head b)
   38 -- @
   39 -- then @(tail a)@ and @(tail b)@ are identical repositories
   40 --
   41 -- Questions:
   42 --
   43 -- Does this mean that in a patch set such as @[[a b t1 c d e t2][f g
   44 -- t3] [h i]]@, t1, t2 and t3 are tags, and t2 and t3 are clean?
   45 --
   46 -- Can we have PatchSet with length at least 3?
   47 -- Florent
   48 type PatchSet p C(x) = RL (RL (PatchInfoAnd p)) C(() x)
   49 
   50 type SealedPatchSet p = Sealed (RL (RL (PatchInfoAnd p)) C(()))