Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added support for the new mercurial filestore backend.

  • Loading branch information...
commit 13b66f49b74efa5eaf39c1964c94fc3bcec1c6d1 1 parent 5bf9e08
@jgm authored
View
7 Network/Gitit/Config.hs
@@ -162,9 +162,10 @@ extractConfig cp = do
let authMethod = map toLower cfAuthenticationMethod
let stripTrailingSlash = reverse . dropWhile (=='/') . reverse
let repotype' = case map toLower cfRepositoryType of
- "git" -> Git
- "darcs" -> Darcs
- x -> error $ "Unknown repository type: " ++ x
+ "git" -> Git
+ "darcs" -> Darcs
+ "mercurial" -> Mercurial
+ x -> error $ "Unknown repository type: " ++ x
return $! Config{
repositoryPath = cfRepositoryPath
View
5 Network/Gitit/Framework.hs
@@ -352,5 +352,6 @@ withInput name val handler = do
filestoreFromConfig :: Config -> FileStore
filestoreFromConfig conf =
case repositoryType conf of
- Git -> gitFileStore $ repositoryPath conf
- Darcs -> darcsFileStore $ repositoryPath conf
+ Git -> gitFileStore $ repositoryPath conf
+ Darcs -> darcsFileStore $ repositoryPath conf
+ Mercurial -> mercurialFileStore $ repositoryPath conf
View
2  Network/Gitit/Types.hs
@@ -42,7 +42,7 @@ import Text.Pandoc.CharacterReferences (decodeCharacterReferences)
data PageType = Markdown | RST | LaTeX | HTML
deriving (Read, Show, Eq)
-data FileStoreType = Git | Darcs deriving Show
+data FileStoreType = Git | Darcs | Mercurial deriving Show
data MathMethod = MathML | JsMathScript | RawTeX
deriving (Read, Show, Eq)
View
43 README.markdown
@@ -1,13 +1,13 @@
Gitit
=====
-Gitit is a wiki program written in Haskell. It uses [Happstack][]
-for the web server and [pandoc][] for markup processing. Pages and
-uploaded files are stored in a [git][] or [darcs][] repository and may
-be modified either by using the VCS's command-line tools or through the
-wiki's web interface. By default, pandoc's extended version of markdown
-is used as a markup language, but reStructuredText, LaTeX, or HTML
-can also be used. Pages can be exported in a number of different
+Gitit is a wiki program written in Haskell. It uses [Happstack][] for
+the web server and [pandoc][] for markup processing. Pages and uploaded
+files are stored in a [git][], [darcs][], or [mercurial][] repository
+and may be modified either by using the VCS's command-line tools or
+through the wiki's web interface. By default, pandoc's extended version
+of markdown is used as a markup language, but reStructuredText, LaTeX,
+or HTML can also be used. Pages can be exported in a number of different
formats, including LaTeX, RTF, OpenOffice ODT, and MediaWiki markup.
Gitit can be configured to display TeX math (using [texmath][]) and
highlighted source code (using [highlighting-kate][]).
@@ -35,6 +35,7 @@ You can see a running demo at <http://gitit.johnmacfarlane.net>.
[git]: http://git.or.cz
[darcs]: http://darcs.net
+[mercurial]: http://mercurial.selenic.com/
[pandoc]: http://johnmacfarlane.net/pandoc
[Happstack]: http://happstack.com
[highlighting-kate]: http://johnmacfarlane.net/highlighting-kate/
@@ -99,8 +100,8 @@ is compiled with highlighting support, then install gitit as above:
Running gitit
-------------
-To run gitit, you'll need [git][] in your system path. (Or
-[darcs][], if you're using darcs to store the wiki data.)
+To run gitit, you'll need `git` in your system path. (Or `darcs` or
+`hg`, if you're using darcs or mercurial to store the wiki data.)
Gitit assumes that the page files (stored in the git repository) are
encoded as UTF-8. Even page names may be UTF-8 if the file system
@@ -246,7 +247,7 @@ can ensure that others who clone your wiki repository get these files
as well. It will not be possible to modify these files using the web
interface, but they will be modifiable via git.
-Using darcs instead of git
+Using a VCS other than git
--------------------------
By default, gitit will store wiki pages in a git repository in the
@@ -255,6 +256,10 @@ you need to add the following field to the configuration file:
repository-type: Darcs
+If you'd prefer to use mercurial, add:
+
+ repository-type: Mercurial
+
This program may be called "darcsit" instead of "gitit" when a darcs
backend is used.
@@ -339,23 +344,27 @@ support. To do this, unset the `plugins` Cabal flag:
Note also that if you compile gitit for executable profiling, attempts
to load plugins will result in "internal error: PAP object entered!"
-Accessing the wiki via git or darcs
-===================================
+Accessing the wiki through git
+==============================
-All the pages and uploaded files are stored in a git or darcs
-repository. By default, this lives in the `wikidata` directory (though
-this can be changed through configuration options). So you can interact
-with the wiki using git command line tools:
+All the pages and uploaded files are stored in a git repository. By
+default, this lives in the `wikidata` directory (though this can be
+changed through configuration options). So you can interact with the
+wiki using git command line tools:
git clone ssh://my.server.edu/path/of/wiki/wikidata
cd wikidata
vim Front\ Page.page # edit the page
git commit -m "Added message about wiki etiquette" Front\ Page.page
- git push
+ git push
If you now look at the Front Page on the wiki, you should see your changes
reflected there. Note that the pages all have the extension `.page`.
+If you are using the darcs or mercurial backend, the commands will
+be slightly different. See the documentation for your VCS for
+details.
+
Caching
=======
View
2  data/default.conf
@@ -8,7 +8,7 @@ wiki-title: Wiki
repository-type: Git
# specifies the type of repository used for wiki content.
-# Options are Git and Darcs.
+# Options are Git, Darcs, and Mercurial.
repository-path: wikidata
# specifies the path of the repository directory. If it does not
View
6 gitit.hs
@@ -29,7 +29,6 @@ import Control.Monad.Reader
import System.Log.Logger (Priority(..), setLevel, setHandlers,
getLogger, saveGlobalLogger)
import System.Log.Handler.Simple (fileHandler)
-import Data.Char (toLower)
main :: IO ()
main = do
@@ -38,7 +37,10 @@ main = do
conf <- getConfigFromOpts
-- check for external programs that are needed
- let repoProg = map toLower $ show $ repositoryType conf
+ let repoProg = case repositoryType conf of
+ Mercurial -> "hg"
+ Darcs -> "darcs"
+ Git -> "git"
let prereqs = ["grep", repoProg]
forM_ prereqs $ \prog ->
findExecutable prog >>= \mbFind ->
Please sign in to comment.
Something went wrong with that request. Please try again.