add gensetup for git
authorJoey Hess <joey@kodama.kitenet.net>
Sat, 26 Jul 2008 22:10:01 +0000 (18:10 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Sat, 26 Jul 2008 22:10:01 +0000 (18:10 -0400)
IkiWiki/Rcs/git.pm
IkiWiki/Setup/Standard.pm

index ecf560d0ba8dc09edf2c48da59eddd0cfe864143..7c3ae9276edc3c924831ecc3ae246181cb89f846 100644 (file)
@@ -11,6 +11,40 @@ use open qw{:utf8 :std};
 my $sha1_pattern     = qr/[0-9a-fA-F]{40}/; # pattern to validate Git sha1sums
 my $dummy_commit_msg = 'dummy commit';      # message to skip in recent changes
 
+hook(type => "getsetup", id => "git", call => sub { #{{{
+       return
+               historyurl => {
+                       type => "string",
+                       default => "",
+                       example => "http://git.example.com/gitweb.cgi?p=wiki.git;a=history;f=[[file]]",
+                       description => "gitweb url to show file history ([[file]] substituted)",
+                       safe => 1,
+                       rebuild => 1,
+               },
+               diffurl => {
+                       type => "string",
+                       default => "",
+                       example => "http://git.example.com/gitweb.cgi?p=wiki.git;a=blobdiff;h=[[sha1_to]];hp=[[sha1_from]];hb=[[sha1_parent]];f=[[file]]",
+                       description => "gitweb url to show a diff ([[sha1_to]], [[sha1_from]], [[sha1_parent]], and [[file]] substituted)",
+                       safe => 1,
+                       rebuild => 1,
+               },
+               gitorigin_branch => {
+                       type => "string",
+                       default => "origin",
+                       description => "where to pull and push changes (unset to not pull/push)",
+                       safe => 0, # paranoia
+                       rebuild => 0,
+               },
+               gitmaster_branch => {
+                       type => "string",
+                       default => "master",
+                       description => "branch that the wiki is stored in",
+                       safe => 0, # paranoia
+                       rebuild => 0,
+               },
+}); #}}}
+
 sub _safe_git (&@) { #{{{
        # Start a child process safely without resorting /bin/sh.
        # Return command output or success state (in scalar context).
index 54819ae75d822b85f86d7ecdb0b0c30a28094855..b8ad091448c025d3b3400b0e38b883e84754d6fa 100644 (file)
@@ -80,11 +80,18 @@ sub gendump ($) { #{{{
        push @ret, dumpvalues(\%setup, IkiWiki::getsetup());
        push @ret, "";
 
+       # sort rcs plugin first
+       my @plugins=sort {
+               ($a eq $config{rcs}) <=> ($b eq $config{rcs})
+               ||
+               $a cmp $b
+       } keys %{$IkiWiki::hooks{getsetup}};
+
        foreach my $id (sort keys %{$IkiWiki::hooks{getsetup}}) {
                # use an array rather than a hash, to preserve order
                my @s=$IkiWiki::hooks{getsetup}{$id}{call}->();
                return unless @s;
-               push @ret, "\t# $id plugin";
+               push @ret, "\t# $id".($id ne $config{rcs} ? " plugin" : "");
                push @ret, dumpvalues(\%setup, @s);
                push @ret, "";
        }