summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-10-08 19:31:06 -0400
committerJoey Hess <joey@kitenet.net>2010-10-08 19:31:06 -0400
commitf826251a6d506d6f8a31e30abfbe89338351bd6a (patch)
tree0c15b7609f6e4c1efd7b9929ff877ca4e5c400e9 /doc
parentc8214300ed6198d3a59cc1e3b3d74b0722c26b91 (diff)
parent2d99fe0d34be35d9e5d556d530f2d8993007cdf6 (diff)
Merge branch 'revert'
Diffstat (limited to 'doc')
-rw-r--r--doc/forum/how_do_I_revert_edits_in_the_web_mode__63__.mdwn6
-rw-r--r--doc/plugins/recentchanges.mdwn2
-rw-r--r--doc/plugins/write.mdwn30
-rw-r--r--doc/rcs.mdwn2
-rw-r--r--doc/smileys/icon-error.pngbin159 -> 397 bytes
-rw-r--r--doc/style.css3
-rw-r--r--doc/templates.mdwn2
-rw-r--r--doc/todo/web_reversion.mdwn24
-rw-r--r--doc/wikiicons/revert.pngbin0 -> 397 bytes
9 files changed, 42 insertions, 27 deletions
diff --git a/doc/forum/how_do_I_revert_edits_in_the_web_mode__63__.mdwn b/doc/forum/how_do_I_revert_edits_in_the_web_mode__63__.mdwn
index 4998c1a75..d69b3801b 100644
--- a/doc/forum/how_do_I_revert_edits_in_the_web_mode__63__.mdwn
+++ b/doc/forum/how_do_I_revert_edits_in_the_web_mode__63__.mdwn
@@ -38,3 +38,9 @@ Puzzled a bit :-/
Perer Gammie and I are working on reversion over at [[todo/web_reversion]].
--[[Joey]]
+
+Update: Web reversion is now supported by ikiwiki. Only changes committed
+to your wiki after you upgrade to the version of ikiwiki that supports it
+will get revert buttons on the RecentChanges page. If you want to force
+adding buttons for older changes, you can delete `recentchanges/*._change`
+from your srcdir, and rebuild the wiki. --[[Joey]]
diff --git a/doc/plugins/recentchanges.mdwn b/doc/plugins/recentchanges.mdwn
index 823f68502..6fff18e8a 100644
--- a/doc/plugins/recentchanges.mdwn
+++ b/doc/plugins/recentchanges.mdwn
@@ -6,6 +6,8 @@ generates a page describing each recent change made to the wiki. These
pages can be joined together with [[inline]] to generate the
[[RecentChanges]] page.
+This plugin also currently handles web-based reversion of changes.
+
Typically only the RecentChanges page will use the pages generated by this
plugin, but you can use it elsewhere too if you like. It's used like this:
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index d5bd1dd76..6b751f0cd 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -1154,8 +1154,6 @@ context, and the whole diff in scalar context.
This is used to get the page creation time for a file from the RCS, by looking
it up in the history.
-It's ok if this is not implemented, and throws an error.
-
If the RCS cannot determine a ctime for the file, return 0.
#### `rcs_getmtime($)`
@@ -1176,9 +1174,9 @@ sense to implement for all RCSs.
It should examine the incoming changes, and do any sanity
checks that are appropriate for the RCS to limit changes to safe file adds,
-removes, and changes. If something bad is found, it should exit
-nonzero, to abort the push. Otherwise, it should return a list of
-files that were changed, in the form:
+removes, and changes. If something bad is found, it should die, to abort
+the push. Otherwise, it should return a list of files that were changed,
+in the form:
{
file => # name of file that was changed
@@ -1191,6 +1189,28 @@ files that were changed, in the form:
The list will then be checked to make sure that each change is one that
is allowed to be made via the web interface.
+#### `rcs_preprevert($)`
+
+This is called by the revert web interface. It is passed a RCS-specific
+change ID, and should determine what the effects would be of reverting
+that change, and return the same data structure as `rcs_receive`.
+
+Like `rcs_receive`, it should do whatever sanity checks are appropriate
+for the RCS to limit changes to safe changes, and die if a change would
+be unsafe to revert.
+
+#### `rcs_revert($)`
+
+This is called by the revert web interface. It is passed a named
+parameter rev that is the RCS-specific change ID to revert.
+
+It should try to revert the specified rev, and leave the reversion staged
+so `rcs_commit_staged` will complete it. It should return undef on _success_
+and an error message on failure.
+
+This hook and `rcs_preprevert` are optional, if not implemented, no revert
+web interface will be available.
+
### PageSpec plugins
It's also possible to write plugins that add new functions to
diff --git a/doc/rcs.mdwn b/doc/rcs.mdwn
index 83c6910d0..06af9807c 100644
--- a/doc/rcs.mdwn
+++ b/doc/rcs.mdwn
@@ -23,6 +23,8 @@ auto.setup |yes |yes |incomplete|yes |incomplete |yes
`rcs_diff` |yes |yes |yes |yes |no |yes |yes |yes
`rcs_getctime` |fast |slow |slow |slow |slow |slow |slow |slow
`rcs_getmtime` |fast |slow |slow |no |no |no |no |no
+`rcs_preprevert` |yes |no |no |no |no |no |no |no
+`rcs_revert` |yes |no |no |no |no |no |no |no
anonymous push |yes |no |no |no |no |no |no |no
conflict handling |yes |yes |yes |buggy |yes |yes |yes |yes
openid username |yes |no |no |no |no |no |no |no
diff --git a/doc/smileys/icon-error.png b/doc/smileys/icon-error.png
index 53b1055f6..c39e65c33 100644
--- a/doc/smileys/icon-error.png
+++ b/doc/smileys/icon-error.png
Binary files differ
diff --git a/doc/style.css b/doc/style.css
index fa4b2a38a..aa27d8866 100644
--- a/doc/style.css
+++ b/doc/style.css
@@ -172,7 +172,8 @@ div.recentchanges {
width: 35%;
font-size: small;
}
-.recentchanges .pagelinks {
+.recentchanges .pagelinks,
+.recentchanges .revert {
float: right;
margin: 0;
width: 60%;
diff --git a/doc/templates.mdwn b/doc/templates.mdwn
index bfb6a439a..4fd2bf501 100644
--- a/doc/templates.mdwn
+++ b/doc/templates.mdwn
@@ -74,7 +74,7 @@ html out of ikiwiki and in the templates.
* `editpage.tmpl`, `editconflict.tmpl`, `editcreationconflict.tmpl`,
`editfailedsave.tmpl`, `editpagegone.tmpl`, `pocreatepage.tmpl`,
`editcomment.tmpl` `commentmoderation.tmpl`, `renamesummary.tmpl`,
- `passwordmail.tmpl`, `openid-selector.tmpl` - Parts of ikiwiki's user
+ `passwordmail.tmpl`, `openid-selector.tmpl`, `revert.tmpl` - Parts of ikiwiki's user
interface; do not normally need to be customised.
[[!meta robots="noindex, follow"]]
diff --git a/doc/todo/web_reversion.mdwn b/doc/todo/web_reversion.mdwn
index 33fa79aad..9550fa58b 100644
--- a/doc/todo/web_reversion.mdwn
+++ b/doc/todo/web_reversion.mdwn
@@ -55,7 +55,6 @@ Peter Gammie has done an initial implementation of the above.
> (The data from `rcs_preprevert` could also be used for a confirmation
> prompt -- it doesn't currently include enough info for diffs, but at
> least could have a list of changed files.)
->> I added `rcs_showpatch` which simply yields the output of `git show <patch-id>`. -- [[peteg]]
>
> Note that it's possible for a git repo to have commits that modify wiki
> files in a subdir, and code files elsewhere. `rcs_preprevert` should
@@ -63,29 +62,14 @@ Peter Gammie has done an initial implementation of the above.
>> Taken care of by refactoring `rcs_receive` in `git.pm`
>> I've tested it lightly in my single-user setup. It's a little nasty that the `attachment` plugin
>> gets used to check whether attachments are allowed -- there really should be a hook for that.
+>>> I agree, but have not figured out a way to make a hook work yet.
+>>> --[[Joey]]
>>
>> Please look it over and tell me what else needs fixing... -- [[peteg]]
>>> I have made my own revert branch and put a few fixes in there
>>> [[!template id=gitbranch branch=origin/revert author="[[joey]]"]]
->>> (and fixed all the indention..). Issues I noticed but have not gotten
->>> to: --[[Joey]]
+>>> (and fixed all the indention..). --[[Joey]]
>>>> Please change the git pointer above, then. I will work on your branch. -- [[peteg]]
->>>
->>> * `rcs_diff` already exists; why add `rcs_showpatch`?
->>>> If `rcs_diff` is intended for human consumption, by all means we can use that. -- [[peteg]]
->>> * Would it be better for `rcs_revert` to not commit, and
->>> `rcs_commit_staged` to then be used? This would work for git, but
->>> maybe other RCSs would be problimatic. It would simplifiy the
->>> interface and allow for future mulitple-revert interfaces.
->>> * I quite don't understand why one caller of `git_parse_changes`
->>> needs it to chdir, and not the other one. It's running
->>> in the same git repo either way, and git doesn't need
->>> `git show` to run in a subdir at all..
->>>> I was aping (preserving) what was already there. I don't understand what you say about `git show` - it must run under $srcdir, surely? And empirically the CGI process wasn't in the right place. By all means simplify that. -- [[peteg]]
-
->>> * Probably needs to untaint the revs passed in.
->>> * Seems backwards for `rcs_preprevert` to import and
->>> use `IkiWiki::Receive`.
->>>> Indeed. This is saying that the checking code in IkiWiki::Receive is in the wrong place. I think it would be better to set up some general hooks and shuffle it into a plugin, for then other plugins that maintain special files in the repo can have a say about validity. -- [[peteg]]
+[[done]]
diff --git a/doc/wikiicons/revert.png b/doc/wikiicons/revert.png
new file mode 100644
index 000000000..c39e65c33
--- /dev/null
+++ b/doc/wikiicons/revert.png
Binary files differ