{- |
   The functions in this module are trivial wrappers around the functions
   in "Hakyll.FileStore.Context":

   @hgSomething@ is equivalent to @fsSomething hgStore@, where
   @hgStore = mercurialFileStore "."@.
-}

--------------------------------------------------------------------------------

module Hakyll.FileStore.Mercurial.Context
    ( hgStore
    , hgGetItemUTC
    , hgGetItemUTC'
    , hgDateField
    , hgDateFieldWith
    , hgGetItemModificationTime
    , hgGetItemModificationTime'
    , hgModificationTimeField
    , hgModificationTimeFieldWith
    , hgGetRevisions
    , hgGetAuthors
    , hgGetAuthorNames
    , hgAuthorNamesField
    , hgAuthorNamesFieldWith
    , hgGetAuthorEmails
    , hgAuthorEmailsField
    , hgAuthorEmailsFieldWith
    ) where

--------------------------------------------------------------------------------

import           Data.Time.Clock             (UTCTime)
import           Data.FileStore              (Author,
                                              FileStore,
                                              Revision,
                                              mercurialFileStore)
import           Data.Time.Locale.Compat     (TimeLocale)
import           Hakyll.Core.Compiler        (Compiler)
import           Hakyll.Core.Identifier      (Identifier)
import           Hakyll.Web.Template.Context (Context)

--------------------------------------------------------------------------------

import           Hakyll.FileStore.Context

--------------------------------------------------------------------------------

hgStore :: FileStore
hgStore :: FileStore
hgStore = FilePath -> FileStore
mercurialFileStore FilePath
"."
-- ^ @hgStore = mercurialFileStore "."@

--------------------------------------------------------------------------------

hgGetItemUTC :: TimeLocale
             -> Identifier
             -> Compiler UTCTime
hgGetItemUTC :: TimeLocale -> Identifier -> Compiler UTCTime
hgGetItemUTC = FileStore -> TimeLocale -> Identifier -> Compiler UTCTime
fsGetItemUTC FileStore
hgStore

hgGetItemUTC' :: Identifier
              -> Compiler (Maybe UTCTime)
hgGetItemUTC' :: Identifier -> Compiler (Maybe UTCTime)
hgGetItemUTC' = FileStore -> Identifier -> Compiler (Maybe UTCTime)
fsGetItemUTC' FileStore
hgStore

hgDateField :: String
            -> String
            -> Context a
hgDateField :: FilePath -> FilePath -> Context a
hgDateField = FileStore -> FilePath -> FilePath -> Context a
forall a. FileStore -> FilePath -> FilePath -> Context a
fsDateField FileStore
hgStore

hgDateFieldWith :: TimeLocale
                -> String
                -> String
                -> Context a
hgDateFieldWith :: TimeLocale -> FilePath -> FilePath -> Context a
hgDateFieldWith = FileStore -> TimeLocale -> FilePath -> FilePath -> Context a
forall a.
FileStore -> TimeLocale -> FilePath -> FilePath -> Context a
fsDateFieldWith FileStore
hgStore

hgGetItemModificationTime :: Identifier
                          -> Compiler UTCTime
hgGetItemModificationTime :: Identifier -> Compiler UTCTime
hgGetItemModificationTime = FileStore -> Identifier -> Compiler UTCTime
fsGetItemModificationTime FileStore
hgStore

hgGetItemModificationTime' :: Identifier
                           -> Compiler (Maybe UTCTime)
hgGetItemModificationTime' :: Identifier -> Compiler (Maybe UTCTime)
hgGetItemModificationTime' = FileStore -> Identifier -> Compiler (Maybe UTCTime)
fsGetItemModificationTime' FileStore
hgStore

hgModificationTimeField :: String
                        -> String
                        -> Context a
hgModificationTimeField :: FilePath -> FilePath -> Context a
hgModificationTimeField = FileStore -> FilePath -> FilePath -> Context a
forall a. FileStore -> FilePath -> FilePath -> Context a
fsModificationTimeField FileStore
hgStore

hgModificationTimeFieldWith :: TimeLocale
                            -> String
                            -> String
                            -> Context a
hgModificationTimeFieldWith :: TimeLocale -> FilePath -> FilePath -> Context a
hgModificationTimeFieldWith = FileStore -> TimeLocale -> FilePath -> FilePath -> Context a
forall a.
FileStore -> TimeLocale -> FilePath -> FilePath -> Context a
fsModificationTimeFieldWith FileStore
hgStore

--------------------------------------------------------------------------------

hgGetRevisions :: Identifier
               -> Compiler [Revision]
hgGetRevisions :: Identifier -> Compiler [Revision]
hgGetRevisions = FileStore -> Identifier -> Compiler [Revision]
fsGetRevisions FileStore
hgStore

hgGetAuthors :: Identifier
             -> Compiler [Author]
hgGetAuthors :: Identifier -> Compiler [Author]
hgGetAuthors = FileStore -> Identifier -> Compiler [Author]
fsGetAuthors FileStore
hgStore

hgGetAuthorNames :: Identifier
                 -> Compiler [String]
hgGetAuthorNames :: Identifier -> Compiler [FilePath]
hgGetAuthorNames = FileStore -> Identifier -> Compiler [FilePath]
fsGetAuthorNames FileStore
hgStore

hgAuthorNamesField :: String
                   -> Context a
hgAuthorNamesField :: FilePath -> Context a
hgAuthorNamesField = FileStore -> FilePath -> Context a
forall a. FileStore -> FilePath -> Context a
fsAuthorNamesField FileStore
hgStore

hgAuthorNamesFieldWith :: String
                       -> String
                       -> Context a
hgAuthorNamesFieldWith :: FilePath -> FilePath -> Context a
hgAuthorNamesFieldWith = FileStore -> FilePath -> FilePath -> Context a
forall a. FileStore -> FilePath -> FilePath -> Context a
fsAuthorNamesFieldWith FileStore
hgStore

hgGetAuthorEmails :: Identifier
                  -> Compiler [String]
hgGetAuthorEmails :: Identifier -> Compiler [FilePath]
hgGetAuthorEmails = FileStore -> Identifier -> Compiler [FilePath]
fsGetAuthorEmails FileStore
hgStore

hgAuthorEmailsField :: String
                    -> Context a
hgAuthorEmailsField :: FilePath -> Context a
hgAuthorEmailsField = FileStore -> FilePath -> Context a
forall a. FileStore -> FilePath -> Context a
fsAuthorEmailsField FileStore
hgStore

hgAuthorEmailsFieldWith :: String
                        -> String
                        -> Context a
hgAuthorEmailsFieldWith :: FilePath -> FilePath -> Context a
hgAuthorEmailsFieldWith = FileStore -> FilePath -> FilePath -> Context a
forall a. FileStore -> FilePath -> FilePath -> Context a
fsAuthorEmailsFieldWith FileStore
hgStore

--------------------------------------------------------------------------------