aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xMakefile.PL5
-rw-r--r--debian/changelog10
-rw-r--r--doc/ikiwiki-makerepo.mdwn23
-rw-r--r--doc/rcs/git.mdwn23
-rw-r--r--doc/setup.mdwn67
-rw-r--r--doc/setup/git_pitfalls.mdwn22
-rwxr-xr-xikiwiki-makerepo76
7 files changed, 148 insertions, 78 deletions
diff --git a/Makefile.PL b/Makefile.PL
index d40cf3d56..cd9683d27 100755
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -39,13 +39,14 @@ extra_build: ikiwiki.out
--plugin=haiku --plugin=polygen --plugin=fortune
./mdwn2man ikiwiki 1 doc/usage.mdwn > ikiwiki.man
./mdwn2man ikiwiki-mass-rebuild 8 doc/ikiwiki-mass-rebuild.mdwn > ikiwiki-mass-rebuild.man
+ ./mdwn2man ikiwiki-makerepo 1 doc/ikiwiki-makerepo.mdwn > ikiwiki-makerepo.man
./mdwn2man ikiwiki-update-wikilist 1 doc/ikiwiki-update-wikilist.mdwn > ikiwiki-update-wikilist.man
$(MAKE) -C po
if [ "$$PROFILE" = 1 ]; then dprofpp; fi
extra_clean:
rm -rf html doc/.ikiwiki
- rm -f ikiwiki.man ikiwiki-mass-rebuild.man ikiwiki-update-wikilist.man ikiwiki.out
+ rm -f *.man ikiwiki.out
$(MAKE) -C po clean
extra_install:
@@ -70,6 +71,7 @@ extra_install:
install -d $(DESTDIR)$(PREFIX)/share/man/man1
install -m 644 ikiwiki.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki.1
+ install -m 644 ikiwiki-makerepo.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-makerepo.1
install -m 644 ikiwiki-update-wikilist.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-update-wikilist.1
install -d $(DESTDIR)$(PREFIX)/share/man/man8
@@ -83,6 +85,7 @@ extra_install:
install -d $(DESTDIR)$(PREFIX)/bin
install ikiwiki.out $(DESTDIR)$(PREFIX)/bin/ikiwiki
+ install ikiwiki-makerepo ikiwiki-update-wikilist $(DESTDIR)$(PREFIX)/bin/
$(MAKE) -C po install DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)
}
diff --git a/debian/changelog b/debian/changelog
index 299d7d571..2a9aae3ab 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+ikiwiki (2.15) UNRELEASED; urgency=low
+
+ * Add a new ikiwiki-makerepo program, that automates setting up a repo
+ and importing existing content for svn, git, and mercurial. This makes
+ the setup process much simpler.
+ * Reorganised git documentation.
+ * Actually install the ikiwiki-update-wikilist program.
+
+ -- Joey Hess <joeyh@debian.org> Tue, 27 Nov 2007 00:16:40 -0500
+
ikiwiki (2.14) unstable; urgency=high
* Let CC be used to control what compiler is used to build wrappers.
diff --git a/doc/ikiwiki-makerepo.mdwn b/doc/ikiwiki-makerepo.mdwn
new file mode 100644
index 000000000..19f891d0e
--- /dev/null
+++ b/doc/ikiwiki-makerepo.mdwn
@@ -0,0 +1,23 @@
+# NAME
+
+ikiwiki-makerepo - check an ikiwiki srcdir into revision control
+
+# SYNOPSIS
+
+ikiwiki-makerepo svn|git srcdir repository
+ikiwiki-makerepo mercurial srcdir
+
+# DESCRIPTION
+
+`ikiwiki-makerepo` injects a `srcdir` directory, containing an ikiwiki wiki,
+into a `repository` that it creates. The repository can be a svn, git, or
+mercurial repository.
+
+Note that for mercurial, the srcdir is converted into a mercurial
+repository. There is no need to have a separate repository with mercurial.
+
+# AUTHOR
+
+Joey Hess <joey@ikiwiki.info>
+
+Warning: this page is automatically made into ikiwiki-makerepo's man page, edit with care
diff --git a/doc/rcs/git.mdwn b/doc/rcs/git.mdwn
index 55e2f1d55..504ded17a 100644
--- a/doc/rcs/git.mdwn
+++ b/doc/rcs/git.mdwn
@@ -5,13 +5,26 @@ the Linux kernel. Ikiwiki supports storing a wiki in git.
[git]: http://git.or.cz/
-Ikiwiki can run as a post-update hook to update a wiki whenever commits
+Ikiwiki can run as a `post-update` hook to update a wiki whenever commits
come in. When running as a [[cgi]] with Git, ikiwiki automatically
commits edited pages, and uses the Git history to generate the
[[RecentChanges]] page.
-[[Setup]] documents current best practice for using git with ikiwiki. This
-involves setting up a pair of git repositories. This method isn't the most
-obvious, but it works the best.
+## git repository setup
-See also: [[common_git_pitfalls|/setup/git_pitfalls]]
+When using Git, you probably want to set up two repositories, of which
+one should be bare (meaning that it does not have a working tree
+checked out), and the other one with a working tree will be used as
+ikiwiki's srcdir for compiling the wiki. [[ikiwiki-makerepo]] can automate
+setting this up. Using a pair of repositories isn't the most obvious set up,
+but it works the best for typical ikiwiki use.
+[[tips/Laptop_wiki_with_git]] describes a different way to set up ikiwiki
+and git.
+
+It is **paramount** that you **never** push to the non-bare repository
+([this FAQ entry explains why](http://git.or.cz/gitwiki/GitFaq#head-b6a3d85f677763313159eb39f7dbf4579d4ee28b)).
+Instead, if you want to work on the wiki from a remote machine, clone
+the bare repository, using either the `git` transport (if available), or
+`ssh`.
+
+The ikiwiki `post-commit` hook should be put in the bare repository.
diff --git a/doc/setup.mdwn b/doc/setup.mdwn
index 213146a7a..7e8973bbc 100644
--- a/doc/setup.mdwn
+++ b/doc/setup.mdwn
@@ -107,56 +107,32 @@ At this point you might want to check your wiki in to a revision control
system so you can keep track of changes and revert edits. Depending
on the revision control system you choose, the way this is done varies.
-There's little that's ikiwiki specific about these instructions; this is
-just how you put a directory under revision control using the various
-systems that ikiwiki supports. Note that the .ikiwiki subdirectory is
-where ikiwiki keeps its state, and should be preserved, but not checked
-into revision control.
+Note that the .ikiwiki subdirectory is where ikiwiki keeps its state, and
+should be preserved, but not checked into revision control.
+
+The new [[ikiwiki-makerepo]] command automates setting up a wiki in
+revision control.
[[toggle id=subversion text="Subversion"]]
[[toggleable id=subversion text="""
REPOSITORY=~/wikirepo
- svnadmin create $REPOSITORY
- svn mkdir file://$REPOSITORY/trunk -m "create trunk"
- cd $SRCDIR
- svn co file://$REPOSITORY/trunk .
- svn add *
- svn commit -m "initial import"
+ ikiwiki-makerepo svn $SRCDIR $REPOSITORY
"""]]
[[toggle id=git text="Git"]]
[[toggleable id=git text="""
-When using Git, you probably want to set up two repositories, of which
-one should be bare (meaning that it does not have a working tree
-checked out). We call the bare repository the "repository" and the
-other will be the "srcdir" (which `ikiwiki` uses to compile the wiki).
-There are [other
-ways](http://blog.madduck.net/vcs/2007.07.11_publishing-git-repositories)
-to do the following, but this might be easiest:
-
REPOSITORY=~/wiki.git
- GIT_DIR=$REPOSITORY git --bare init --shared
- cd $SRCDIR
- git init
- echo /.ikiwiki > .gitignore
- git add .
- git commit -m "initial commit"
- git remote add origin $REPOSITORY
- git config branch.master.merge refs/heads/master
- git push --all
-
-It is **paramount** that you **never** push to the Git repository in
-`$SRCDIR` ([this FAQ entry explains
-why](http://git.or.cz/gitwiki/GitFaq#head-b6a3d85f677763313159eb39f7dbf4579d4ee28b)).
-Instead, if you want to work on the wiki from a remote machine, clone
-`$REPOSITORY`, using either the `git` transport (if available), or
-`ssh`.
-
-If at any point you commit changes in `$SRCDIR`, make sure to `git
-push` them to the `$REPOSITORY`. ikiwiki will do this automatically
-for any changes made via the web.
-
-Finally, see [[Git_pitfalls]] if you experience problems.
+ ikiwiki-makerepo git $SRCDIR $REPOSITORY
+
+ Please see [[rcs/git]] for detailed documentation about how
+ ikiwiki uses git repositories, and some important caveats
+ about using the git repositories.
+"""]]
+
+[[toggle id=mercurial text="Mercurial"]]
+[[toggleable id=mercurial text="""
+ REPOSITORY=$SRCDIR
+ ikiwiki-makerepo mercurial $SRCDIR
"""]]
[[toggle id=tla text="TLA"]]
@@ -173,15 +149,6 @@ Finally, see [[Git_pitfalls]] if you experience problems.
tla import
"""]]
-[[toggle id=mercurial text="Mercurial"]]
-[[toggleable id=mercurial text="""
- REPOSITORY=$SRCDIR
- hg init $REPOSITORY
- cd $REPOSITORY
- hg add *
- hg commit -m "initial import"
-"""]]
-
[[toggle id=monotone text="Monotone"]]
[[toggleable id=monotone text="""
# These instructions are standard instructions to import a directory into monotone
diff --git a/doc/setup/git_pitfalls.mdwn b/doc/setup/git_pitfalls.mdwn
deleted file mode 100644
index c3584775b..000000000
--- a/doc/setup/git_pitfalls.mdwn
+++ /dev/null
@@ -1,22 +0,0 @@
-I want to collect common problems and their solutions when using Ikiwiki with Git here. Nothing here yet though, so feel free to add...
-
-> Well, I have a question. :-)
->
-> If I follow the instructions, I get a bare $REPOSITORY and a $SRCDIR that
-> is cloned off of it. Web edits change the SRCDIR and ikiwiki automatically
-> pushes to origin, which updates REPOSITORY. But the instructions say not
-> to clone from SRCDIR; so I clone from REPOSITORY. Now if I manually edit
-> a file and push the commit, it goes to REPOSITORY. The wiki isn't
-> updated.
->
-> Seems like REPOSITORY needs a post-receive hook that cd's to SRCDIR and
-> does a git pull, and manually triggers ikiwiki. Which seems very messy.
->
-> Am I doing something wrong? --[[Joey]]
->
-> Hmm, perhaps I installed the wrapper to the wrong place? I had thought
-> it would go in $SRCDIR/.git/hooks/post-commit, but on second read, I see
-> that [[setup]] says it should be $REPOSITORY/hooks/post-update
->
-> That seems to have sorted it. Based on [[this|rcs/git/discussion]], I'm
-> not the only one to trip over how to do this. --[[Joey]]
diff --git a/ikiwiki-makerepo b/ikiwiki-makerepo
new file mode 100755
index 000000000..a6999cb4a
--- /dev/null
+++ b/ikiwiki-makerepo
@@ -0,0 +1,76 @@
+#!/bin/sh
+set -e
+
+rcs="$1"
+srcdir="$2"
+repository="$3"
+
+usage () {
+ echo "usage: ikiwiki-makerepo svn|git srcdir repository" >&2
+ echo " ikiwiki-makerepo mercurial srcdir" >&2
+ exit 1
+}
+
+if [ -z "$rcs" ] || [ -z "$srcdir" ]; then
+ usage
+fi
+
+if [ ! -d "$srcdir" ]; then
+ echo "srcdir $srcdir not found" >&2
+ exit 1
+fi
+
+if [ "$rcs" != mercurial ]; then
+ if [ -e "$repository" ]; then
+ echo "repository $repository already exists, aborting" >&2
+ exit 1
+ fi
+ repository="$(perl -e 'use Cwd q{abs_path}; print abs_path(shift)' $repository)"
+ if [ -z "$repository" ]; then
+ echo "internal error finding repository abs_path" >&2
+ exit 1
+ fi
+fi
+
+echo "Importing $srcdir into $rcs"
+
+case "$rcs" in
+svn)
+ if [ -e "$srcdir/.svn" ]; then
+ echo "$srcdir already seems to be a svn working copy" >&2
+ exit 1
+ fi
+ svnadmin create "$repository"
+ svn mkdir "file://$repository/trunk" -m "create trunk directory"
+ cd "$srcdir"
+ svn co "file://$repository/trunk" .
+ svn propset svn:ignore ".ikiwiki" .
+ svn add *
+ svn commit -m "initial import"
+ echo "Directory $srcdir is now a checkout of $rcs repository $repository"
+;;
+git)
+ GIT_DIR="$repository" git --bare init --shared
+ cd "$srcdir"
+ git init
+ echo /.ikiwiki > .gitignore
+ git add .
+ git commit -m "initial commit"
+ git remote add origin "$repository"
+ git config branch.master.merge refs/heads/master
+ git push --all
+ echo "Directory $srcdir is now a clone of $rcs repository $repository"
+;;
+mercurial)
+ hg init "$srcdir"
+ cd "$srcdir"
+ echo .ikiwiki > .hgignore
+ hg add * .hgignore
+ hg commit -m "initial import"
+ echo "Directory $srcdir is now set up as a mercurial repository"
+;;
+*)
+ echo "Unsupported revision control system $rcs" >&2
+ usage
+;;
+esac