Merge commit '3.20110715' into prv/po
authorintrigeri <intrigeri@boum.org>
Mon, 18 Jul 2011 16:41:37 +0000 (18:41 +0200)
committerintrigeri <intrigeri@boum.org>
Mon, 18 Jul 2011 16:41:37 +0000 (18:41 +0200)
21 files changed:
IkiWiki/Plugin/attachment.pm
IkiWiki/Plugin/remove.pm
IkiWiki/Plugin/rename.pm
debian/changelog
debian/control
doc/bugs/Not_all_comments_are_listed_by___33__map_or___33__inline.mdwn [new file with mode: 0644]
doc/bugs/plugin___96__rename__96___fails_if___96__attachment__96___is_not_enabled.mdwn [new file with mode: 0644]
doc/news/version_3.20110328.mdwn [deleted file]
doc/news/version_3.20110430.mdwn [deleted file]
doc/news/version_3.20110711.mdwn [new file with mode: 0644]
doc/news/version_3.20110712.mdwn [new file with mode: 0644]
doc/plugins/contrib/default_content_for___42__copyright__42___and___42__license__42__.mdwn
doc/plugins/contrib/texinfo.mdwn
doc/sandbox.mdwn
doc/tips/JavaScript_to_add_index.html_to_file:_links.mdwn
doc/tips/Make_calendar_start_week_on_Monday.mdwn [new file with mode: 0644]
doc/todo/Attempt_to_extend_Mercurial_backend_support.mdwn [new file with mode: 0644]
doc/users/Daniel_Andersson.mdwn [new file with mode: 0644]
ikiwiki.spec
po/ikiwiki.pot
templates/editpage.tmpl

index d8e2f627150e62bdaa4c4ed80a80bb8731f971bb..fd4096edf7de153ef01145f310c459f255e3fffc 100644 (file)
@@ -273,11 +273,13 @@ sub attachments_save {
        my $dir=attachment_holding_location($form->field('page'));
        foreach my $filename (glob("$dir/*")) {
                next unless -f $filename;
-               my $dest=$config{srcdir}."/".
+               my $destdir=$config{srcdir}."/".
                        linkpage(IkiWiki::possibly_foolish_untaint(
-                               attachment_location($form->field('page')))).
-                       IkiWiki::basename($filename);
+                               attachment_location($form->field('page'))));
+               my $destfile=IkiWiki::basename($filename);
+               my $dest=$destdir.$destfile;
                unlink($dest);
+               IkiWiki::prep_writefile($destfile, $destdir);
                rename($filename, $dest);
                push @attachments, $dest;
        }
index b94447020de8f5f00cdb81776546a52a6ca00499..14ac01c9bcfc390f370f1a8fca74c3b51d7f0baa 100644 (file)
@@ -120,10 +120,9 @@ sub removal_confirm ($$@) {
                
        # Special case for unsaved attachments.
        foreach my $page (@pages) {
-               if (IkiWiki::Plugin::attachment->can("is_held_attachment")) {
+               if ($attachment && IkiWiki::Plugin::attachment->can("is_held_attachment")) {
                        my $f=IkiWiki::Plugin::attachment::is_held_attachment($page);
                        if (defined $f) {
-                               print STDERR "!! remove $f\n";
                                require IkiWiki::Render;
                                IkiWiki::prune($f);
                        }
index aa108175667fce0e23493a45c14d3ec2542819b1..8e32d41aecfd58934fc7353612c680162abd2914 100644 (file)
@@ -184,7 +184,7 @@ sub rename_start ($$$$) {
        my $held=$attachment &&
                IkiWiki::Plugin::attachment->can("is_held_attachment") &&
                IkiWiki::Plugin::attachment::is_held_attachment($page);
-       if (! defined $held) {
+       if (! $held) {
                check_canrename($page, $pagesources{$page}, undef, undef,
                        $q, $session);
        }
@@ -322,7 +322,7 @@ sub sessioncgi ($$) {
                        my $held=$q->param("attachment") &&
                                IkiWiki::Plugin::attachment->can("is_held_attachment") &&
                                IkiWiki::Plugin::attachment::is_held_attachment($src);
-                       if (defined $held) {
+                       if ($held) {
                                rename($held, IkiWiki::Plugin::attachment::attachment_holding_location($dest));
                                postrename($session, $src, $dest, $q->param("attachment"))
                                        unless defined $srcfile;
index 498857cad3d15452dd90573b4f733060053d8a82..8e280f9c718f44567f5b0d74a59be045a84abb2b 100644 (file)
@@ -1,3 +1,20 @@
+ikiwiki (3.20110715) unstable; urgency=low
+
+  * rename: Fix logic error that broke renaming pages when the attachment
+    plugin was disabled.
+  * rename: Fix logic error that bypassed the usual pagespec checks.
+
+ -- Joey Hess <joeyh@debian.org>  Fri, 15 Jul 2011 18:36:29 -0400
+
+ikiwiki (3.20110712) unstable; urgency=low
+
+  * attachment: Bugfix to create directory when moving attachment out of 
+    holding area.
+  * Display attachment manipulation links always, since attachments can be
+    uploaded via javascript.
+
+ -- Joey Hess <joeyh@debian.org>  Tue, 12 Jul 2011 00:41:26 -0400
+
 ikiwiki (3.20110711) unstable; urgency=low
 
   * Add build dep on python-support. Closes: #633536
index 0ddbe5b6f5c1f5ee49e2d6fa8376dfd1c1dcf4e5..ff2fafab5f327b0258ad15fff68c2caa2baf8e7d 100644 (file)
@@ -10,7 +10,7 @@ Build-Depends-Indep: dpkg-dev (>= 1.9.0), libxml-simple-perl,
   libfile-chdir-perl, libyaml-perl, python-support
 Maintainer: Joey Hess <joeyh@debian.org>
 Uploaders: Josh Triplett <josh@freedesktop.org>
-Standards-Version: 3.9.1
+Standards-Version: 3.9.2
 Homepage: http://ikiwiki.info/
 Vcs-Git: git://git.ikiwiki.info/
 Vcs-Browser: http://git.ikiwiki.info/?p=ikiwiki
diff --git a/doc/bugs/Not_all_comments_are_listed_by___33__map_or___33__inline.mdwn b/doc/bugs/Not_all_comments_are_listed_by___33__map_or___33__inline.mdwn
new file mode 100644 (file)
index 0000000..08953db
--- /dev/null
@@ -0,0 +1,32 @@
+While working on our forum I was surprised to see that some of the comments were not appearing in the RSS feed created by `!inline pages="forum/* or comment(forum/*)" feedonly="yes" show="25"`.
+
+> I'm seeing some comments in the rss feed. The feed is limited to the 25
+> most recent items, you can increase that with feedshow. --[[Joey]]
+
+>> Of course, but in the feed, some of the new comments don't show up.
+>> Most does but not all. For example, none of the comments of this thread
+>> appears in the RSS, even though they should according to the « 25 most
+>> recent items » criteria:
+>> <https://tails.boum.org/forum/Security_Updates:_apt-get_Sufficient__63__/> --sajolida
+
+Then I found out that a map directive such as `!map pages="forum/* or
+comment(forum/*)"` was bringing a weird result too. The output is a map
+with quite a few broken links.
+
+> This is the same as if you tried to link to a comment page or other 
+> internal page with a [[ikiwiki/WikiLink]] -- you'd get a broken link
+> or a create link because these are not true wiki pages. --[[Joey]]
+
+>> So I don't understand why 90 % of the comments are linked well and 10 %
+>> are broken links. Why does this map behave differently for only a few comments? --sajolida
+
+Plus, some broken links in the map do match the comments missing on the RSS feed but some others do not.
+
+Unfortunately, I couldn't find an obvious pattern for this failure.
+
+We think it's a bug in ikiwiki. Our git repo is publicly available at
+`git://git.immerda.ch/amnesia.git` (the ikiwiki source is in `/wiki/src`)
+and the corresponding online version is available at
+<https://tails.boum.org/forum/>. The buggy `!inline` is already included in
+the original `forum.mdwn`. The buggy `!map` is not but the bug can be
+reproduced by just including it in the source of the forum.
diff --git a/doc/bugs/plugin___96__rename__96___fails_if___96__attachment__96___is_not_enabled.mdwn b/doc/bugs/plugin___96__rename__96___fails_if___96__attachment__96___is_not_enabled.mdwn
new file mode 100644 (file)
index 0000000..6bc8bb8
--- /dev/null
@@ -0,0 +1,7 @@
+ikiwiki 3.20110712: A try to rename a page through the web interface without plugin `attachment` enabled renders:
+
+    Error: Undefined subroutine &IkiWiki::Plugin::attachment::attachment_holding_location called at /usr/share/perl5/IkiWiki/Plugin/rename.pm line 326.
+
+Enabling `attachment` makes it work. Some check if `attachment` is enabled before running that code path would solve it. Not sure of the best way to check it. --[[Daniel Andersson]]
+
+> [[fixed|done]] --[[Joey]] 
diff --git a/doc/news/version_3.20110328.mdwn b/doc/news/version_3.20110328.mdwn
deleted file mode 100644 (file)
index db19e35..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-ikiwiki 3.20110328 released with [[!toggle text="these changes"]]
-[[!toggleable text="""
-   * Yaml formatted setup files are now produced by default.
-     (Perl formatted setup files can still be used.)
-   * Add timezone setting in setup file. This alows time zone to be configured
-     via the web.
-   * comment: Better fix to avoid showing comments of subpages, while
-     not breaking manual inlining of comments.
-   * meta: Security fix; don't allow alternative stylesheets to be added
-     on pages where the htmlscrubber is enabled."""]]
\ No newline at end of file
diff --git a/doc/news/version_3.20110430.mdwn b/doc/news/version_3.20110430.mdwn
deleted file mode 100644 (file)
index ac2c815..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-ikiwiki 3.20110430 released with [[!toggle text="these changes"]]
-[[!toggleable text="""
-   * meta: Allow adding javascript to pages. Only when htmlscrubber is
-     disabled, naturally. (Thanks, Giuseppe Bilotta) Closes: #[623154](http://bugs.debian.org/623154)
-   * comments: Add avatar picture of comment author, using Libravatar::URL
-     when available. The avatar is looked up based on the user's openid,
-     or email address. (Thanks, Francois Marier)
-   * Recommend libgravatar-url-perl, which contains Libravatar::URL.
-   * monotone: Implement rcs\_getmtime, and work around a problem with monotone
-     0.48 that affects rcs\_getctime. (Thanks, Richard Levitte)
-   * meta: Fix bug in loading of HTML::Entities that can break inline
-     archive=yes (mostly masked by other plugins that load the module).
-   * Be quiet about updating wrappers, except in verbose mode. (jmtd)
-   * meta: Add FOAF support. Closes: #[623156](http://bugs.debian.org/623156) (Jonas Smedegaard)
-   * Promote Crypt::SSLeay to Recommends; needed for https openid auth.
-   * tag: Avoid autocreating multiple tag pages that vary only in
-     capitalization. The first capitalization seen of a tag will be used
-     for the tag page.
-   * Fix yaml build dep. Closes: #[624712](http://bugs.debian.org/624712)"""]]
\ No newline at end of file
diff --git a/doc/news/version_3.20110711.mdwn b/doc/news/version_3.20110711.mdwn
new file mode 100644 (file)
index 0000000..c4006cb
--- /dev/null
@@ -0,0 +1,7 @@
+ikiwiki 3.20110711 released with [[!toggle text="these changes"]]
+[[!toggleable text="""
+   * Add build dep on python-support. Closes: #[633536](http://bugs.debian.org/633536)
+   * attachment: Bugfix to move upload attachments out of holding area
+     when saving.
+   * attachment: Bugfix for trying to attach files to a subpage of the index
+     page."""]]
\ No newline at end of file
diff --git a/doc/news/version_3.20110712.mdwn b/doc/news/version_3.20110712.mdwn
new file mode 100644 (file)
index 0000000..8744d68
--- /dev/null
@@ -0,0 +1,6 @@
+ikiwiki 3.20110712 released with [[!toggle text="these changes"]]
+[[!toggleable text="""
+   * attachment: Bugfix to create directory when moving attachment out of
+     holding area.
+   * Display attachment manipulation links always, since attachments can be
+     uploaded via javascript."""]]
\ No newline at end of file
index b76bf55dca48bd208bb254589bb13c810aaa511f..38d40a35faee0798b65efb06c0ef7db35ea1218b 100644 (file)
@@ -6,9 +6,9 @@
 Someone was just asking for it and I had written these two plugins already some months ago,
 so I'm now publishing them here.
 
-[`copyright.pm`](http://schwinge.homeip.net/~thomas/tmp/copyright.pm)
+[`copyright.pm`](http://git.savannah.gnu.org/cgit/hurd/web.git/plain/.library/IkiWiki/Plugin/copyright.pm)
 and
-[`license.pm`](http://schwinge.homeip.net/~thomas/tmp/license.pm)
+[`license.pm`](http://git.savannah.gnu.org/cgit/hurd/web.git/plain/.library/IkiWiki/Plugin/license.pm)
 
 Usage instructions are found inside the two plugin files.
 
@@ -51,6 +51,9 @@ by ikiwiki are likewise fine.  --[[tschwinge]]
 > and rebuilt the wiki, but the copyright/license text doesn't show up. Does these plugin work with Ikiwiki `3.20100815`?
 > -- 9unmetal
 
+>> Solved by email long ago; the problem was that the user had not put them
+>> into the *add_plugins* set in the wiki's `ikiwiki.setup`.  --[[tschwinge]]
+
 [[!template id=gitbranch branch=smcv/contrib/defcopyright author="[[tschwinge]]"]]
 
 > For `./gitremotes` convenience (taking the Linus approach to backups :-) )
index a2769166de943bdcfe9072bd027e3c4868571a78..8c55962d1ecb8c982ed03771ca8d4d415bea1de2 100644 (file)
@@ -8,10 +8,13 @@ This plugin is not neccessarily meant to enable people to write arbitrary
 wiki pages in the Texinfo format (even though that is possible, of course),
 but rather to ease collaboration on existing Texinfo documents.
 
-The plugin is available at <http://schwinge.homeip.net/~thomas/tmp/texinfo.pm>.
+The plugin is available at
+<http://git.savannah.gnu.org/cgit/hurd/web.git/plain/.library/IkiWiki/Plugin/texinfo.pm>.
 
 It's very basic at the moment, but will be improved over time.
 
+It also has not really been audited for any security issues.
+
 
 # Issues
 
index c538ddaeb9a96346408c37d4de60a069b12752ac..7c2fa13d712a404b75197631e7d5cf358c0f5325 100644 (file)
@@ -1,5 +1,7 @@
 # Sandbox
 
+## number 2
+
 This is the [[SandBox]], a page anyone can edit to try out ikiwiki
 (version [[!version  ]]).
 
@@ -107,7 +109,7 @@ Now let's write the same block, with a bullest list preceding it.
 
 ----
 
-This **SandBox** is also a [[blog]]!
+This **SandBox** is also a [[blog]]! xxx
 
 [[!inline pages="sandbox/* and !*/Discussion" rootpage="sandbox" show="4" archive="yes"]]a
 
index a11c807e8c7ace028f3a3fba4e33131eb3f36d51..250bb26af4e998a3aeb842cfb7773cd19cca83a6 100644 (file)
@@ -36,4 +36,28 @@ This can be placed in `page.tmpl`:
        ...
        </html>
 
-This script has not been extensively tested.
\ No newline at end of file
+This script has not been extensively tested.
+
+---
+
+A version that handles anchors:
+
+
+       function fixLinks() {
+         var scheme = location.protocol;
+         if (scheme != "file:") return;
+         var links = document.getElementsByTagName("a");
+         for (var i = links.length; --i >= 0; ) {
+           var link = links[i];
+           var href = link.href;
+           var anchor = "";
+           var anchorIndex = href.indexOf("#");
+           if (anchorIndex != -1) {
+             anchor = href.substring(anchorIndex);
+             href = href.substring(0, anchorIndex);
+           };
+           var hlen = href.length;
+           if (hlen > 0 && link.protocol==scheme && href.charAt(hlen-1) == "/")
+             links[i].href = href + "index.html" + anchor;
+         }
+       }
diff --git a/doc/tips/Make_calendar_start_week_on_Monday.mdwn b/doc/tips/Make_calendar_start_week_on_Monday.mdwn
new file mode 100644 (file)
index 0000000..5bce4b6
--- /dev/null
@@ -0,0 +1,9 @@
+To accomplish this on a blog setup, I ran:
+
+    mkdir ${SRCDIR}/templates
+    cp /usr/share/ikiwiki/templates/calendar* ${SRCDIR}/templates/
+    sed -i 's/^\(\[\[!calendar\)/\1 week_start_day="1"/' ${SRCDIR}/templates/calendar* ${SRCDIR}/sidebar.mdwn
+
+where `${SRCDIR}` was the source directory for the blog. This overrides the standard templates with ones that have the `week_start_day="1"` option added. If the upstream templates change, one has to manually update the locally overriding ones.
+
+I personally managed to forget about having to change also the initially auto-generated `sidebar.mdwn` page, which led to some brain activity for me.
diff --git a/doc/todo/Attempt_to_extend_Mercurial_backend_support.mdwn b/doc/todo/Attempt_to_extend_Mercurial_backend_support.mdwn
new file mode 100644 (file)
index 0000000..868b57a
--- /dev/null
@@ -0,0 +1,248 @@
+Using the Mercurial backend, the lack of `rcs_commit_staged` is noticed
+frequently. I couldn't find any tries to update `mercurial.pm`, so not
+letting lack of Mercurial AND Perl knowledge bring me down, I copy-pasted
+from `git.pm` to mimic its behaviour from a Mercurial perspective. I hope
+it can be a foundation for development by those more proficient in
+ikiwiki's inner workings. I have doubts that I personally will be able to
+revise it more, based on my Perl skills.
+
+I've tested it briefly. `ikiwiki-calendar` and posting of comments now
+works with automatic commits, i.e. the `rcs_commit_staged` function works
+in those cases. Under my current setup, I don't know where else to expect
+it to work. I would be flabberghasted if there wasn't any problems with it,
+though.
+
+> Absolutely, the [[/rcs]] chart shows mercurial is lagging behind
+> nearly everything. 
+> 
+> I don't think this stuff is hard, or unlikely to work, familiarity with
+> the rcs's particular details is the main thing. --[[Joey]] 
+
+Diff follows, for anyone to annotate. First code version is also available at [my hg-repo](http://510x.se/hg/program/ikiwiki/file/e741fcfd800f/Plugin/mercurial.pm). Latest version should be [here](http://46.239.104.5:81/hg/program/ikiwiki/file/tip/Plugin/mercurial.pm) ([raw format](http://46.239.104.5:81/hg/program/ikiwiki/raw-file/tip/Plugin/mercurial.pm)). I'll notify on this page with "*Done*" remarks when I've actually commited changes to my local repository. I don't know if I should replace the code and the comments below when I've changed something. I'll probably do this when the code feels more mature. --[[Daniel Andersson]]
+
+> I've looked over the current version and it looks ok to me. --[[Joey]]
+
+       diff -r 20c61288d7bd Plugin/mercurial.pm
+       --- a/Plugin/mercurial.pm       Fri Jul 15 02:55:12 2011 +0200
+       +++ b/Plugin/mercurial.pm       Fri Jul 15 03:29:10 2011 +0200
+       @@ -7,6 +7,8 @@
+        use Encode;
+        use open qw{:utf8 :std};
+        
+       +my $hg_dir=undef;
+       +
+        sub import {
+               hook(type => "checkconfig", id => "mercurial", call => \&checkconfig);
+               hook(type => "getsetup", id => "mercurial", call => \&getsetup);
+
+A corresponding variable is declared for git. It is unused as of yet for
+Mercurial, but when more advanced merge features become available for
+`mercurial.pm`, I think it will come into play.
+
+> Maybe.. I'd rather avoid unused cruft though. --[[Joey]]
+
+>> OK, will be removed. *Done* --[[Daniel Andersson]]
+
+       @@ -69,6 +71,62 @@
+                       },
+        }
+        
+       +sub safe_hg (&@) {
+       +       # Start a child process safely without resorting to /bin/sh.
+       +       # Returns command output (in list content) or success state
+       +       # (in scalar context), or runs the specified data handler.
+       +
+       +       my ($error_handler, $data_handler, @cmdline) = @_;
+       +
+       +       my $pid = open my $OUT, "-|";
+       +
+       +       error("Cannot fork: $!") if !defined $pid;
+       +
+       +       if (!$pid) {
+       +               # In child.
+       +               # hg commands want to be in wc.
+       +               if (! defined $hg_dir) {
+       +                       chdir $config{srcdir}
+       +                           or error("cannot chdir to $config{srcdir}: $!");
+       +               }
+       +               else {
+       +                       chdir $hg_dir
+       +                           or error("cannot chdir to $hg_dir: $!");
+       +               }
+
+> How can this possibly work, since `$hg_dir` is not set? The code
+> that is being replaced seems to use `-R` to make hg use the right
+> directory. If it worked for you without specifying the directory,
+> it's quite likely this is the place the patch fails in some
+> unusual circumstance.. but I think it could easily use `-R` here.
+
+>> It works since `if (! defined $hg_dir)` always hits, and `chdir $config{srcdir}` is well defined. The whole logic is just used in `git.pm` for merge functionality that is not present in `mercurial.pm`, so by the cruft argument above, this should be replaced with just chdir `$config{srcdir}` (which is equivalent to `hg -R` or `hg --cwd` from what I know). Will be removed. *Done* --[[Daniel Andersson]]
+
+       +               exec @cmdline or error("Cannot exec '@cmdline': $!");
+       +       }
+       +       # In parent.
+       +
+       +       # hg output is probably utf-8 encoded, but may contain
+       +       # other encodings or invalidly encoded stuff. So do not rely
+       +       # on the normal utf-8 IO layer, decode it by hand.
+       +       binmode($OUT);
+
+> Is this actually true for hg?
+
+>> I don't know. ["hg stores everything internally as UTF-8, except for pathnames"](https://jira.atlassian.com/browse/FE-3198), but output is dependent on the system's locale. The environment variable `HGENCODING=utf-8` can be set to ensure that Mercurial's own output is always UTF-8, but when viewing a diff containing non-UTF-8 changes, the affected lines are nevertheless output in their original encoding. I personally think that this is the correct way to output it, though, unless there is a possibility that someone is running ikiwiki wih a non-UTF-8 locale.
+
+>>> *Done*. I removed the `encode_utf8()` part and instead set `HGENCODING=utf-8` where the external `hg` command was called. It seems to have taken care of "all" character encoding issues (but it is an almost infinite error pool to draw from, so some problem might pop up). --[[Daniel Andersson]]
+
+       +       my @lines;
+       +       while (<$OUT>) {
+       +               $_=decode_utf8($_, 0);
+       +
+       +               chomp;
+       +
+       +               if (! defined $data_handler) {
+       +                       push @lines, $_;
+       +               }
+       +               else {
+       +                       last unless $data_handler->($_);
+       +               }
+       +       }
+       +
+       +       close $OUT;
+       +
+       +       $error_handler->("'@cmdline' failed: $!") if $? && $error_handler;
+       +
+       +       return wantarray ? @lines : ($? == 0);
+       +}
+       +# Convenient wrappers.
+       +sub run_or_die ($@) { safe_hg(\&error, undef, @_) }
+       +sub run_or_cry ($@) { safe_hg(sub { warn @_ }, undef, @_) }
+       +sub run_or_non ($@) { safe_hg(undef, undef, @_) }
+       +
+        sub mercurial_log ($) {
+               my $out = shift;
+               my @infos;
+       @@ -116,10 +174,7 @@
+        }
+        
+        sub rcs_update () {
+       -       my @cmdline = ("hg", "-q", "-R", "$config{srcdir}", "update");
+       -       if (system(@cmdline) != 0) {
+       -               warn "'@cmdline' failed: $!";
+       -       }
+       +       run_or_cry('hg', '-q', 'update');
+        }
+        
+        sub rcs_prepedit ($) {
+
+With the `run_or_{die,cry,non}()` functions defined as in `git.pm`, some old Mercurial functions can be rewritten more compactly.
+
+       @@ -129,6 +184,14 @@
+        sub rcs_commit (@) {
+               my %params=@_;
+        
+       +       return rcs_commit_helper(@_);
+       +}
+       +
+       +sub rcs_commit_helper (@) {
+       +       my %params=@_;
+       +
+       +       my %env=%ENV;
+
+> This `%env` stash is unused; `%ENV` is never modified.
+
+>> Yes, the code is missing setting the username at all. The local `hgrc` file is always used. I'll add setting of `$ENV{HGUSER}`. *Done* --[[Daniel Andersson]]
+
+       +
+               my $user="Anonymous";
+               if (defined $params{session}) {
+                       if (defined $params{session}->param("name")) {
+
+Here comes the `rcs_commit{,_staged}` part. It is modeled on a `rcs_commit_helper` function, as in `git.pm`.
+
+Some old `mercurial.pm` logic concerning commiter name is kept instead of transplanting the more elaborate logic from `git.pm`. Maybe it is better to "steal" that as well.
+
+> Exactly how to encode the nickname from openid in the commit metadata,
+> and get it back out in `rcs_recentchanges`, would probably vary from git.
+
+>> Yes, right now the long and ugly OpenID strings, e.g. `https://www.google.com/accounts/o8/id?id=AItOawmUIes3yDLfQME0uvZvJKDN0NsdKPx_PTw`, gets recorded as author and are shown as `id [www.google.com/accounts/o8]` in RecentChanges. I see that here on `ikiwiki.info`, my commits, identified by OpenID, are shown as authored by simply `Daniel`. I'll look into it. --[[Daniel Andersson]]
+
+       @@ -143,43 +206,45 @@
+                       $params{message} = "no message given";
+               }
+        
+       -       my @cmdline = ("hg", "-q", "-R", $config{srcdir}, "commit", 
+       -                      "-m", IkiWiki::possibly_foolish_untaint($params{message}),
+       -                      "-u", IkiWiki::possibly_foolish_untaint($user));
+       -       if (system(@cmdline) != 0) {
+       -               warn "'@cmdline' failed: $!";
+       +       $params{message} = IkiWiki::possibly_foolish_untaint($params{message});
+       +
+       +       my @opts;
+       +       
+       +       if (exists $params{file}) {
+       +               push @opts, '--', $params{file};
+               }
+       -
+       +       # hg commit returns non-zero if nothing really changed.
+       +       # So we should ignore its exit status (hence run_or_non).
+       +       run_or_non('hg', 'commit', '-m', $params{message}, '-q', @opts);
+       +       
+       +       %ENV=%env;
+               return undef; # success
+        }
+        
+        sub rcs_commit_staged (@) {
+               # Commits all staged changes. Changes can be staged using rcs_add,
+               # rcs_remove, and rcs_rename.
+       -       my %params=@_;
+       -       
+       -       error("rcs_commit_staged not implemented for mercurial"); # TODO
+       +       return rcs_commit_helper(@_);
+        }
+        
+        sub rcs_add ($) {
+               my ($file) = @_;
+        
+       -       my @cmdline = ("hg", "-q", "-R", "$config{srcdir}", "add", "$config{srcdir}/$file");
+       -       if (system(@cmdline) != 0) {
+       -               warn "'@cmdline' failed: $!";
+       -       }
+       +       run_or_cry('hg', 'add', $file);
+        }
+        
+        sub rcs_remove ($) {
+       +       # Remove file from archive.
+       +
+               my ($file) = @_;
+        
+       -       error("rcs_remove not implemented for mercurial"); # TODO
+       +       run_or_cry('hg', 'remove', '-f', $file);
+        }
+        
+        sub rcs_rename ($$) {
+               my ($src, $dest) = @_;
+        
+       -       error("rcs_rename not implemented for mercurial"); # TODO
+       +       run_or_cry('hg', 'rename', '-f', $src, $dest);
+        }
+        
+        sub rcs_recentchanges ($) {
+
+> Remainder seems ok to me. Should probably test that the remove plugin 
+> works, since this implements `rcs_remove` too and you didn't mention
+> any tests that would run that code path. --[[Joey]] 
+
+>> I tested `rename`. It fails if the page title includes e.g. åäö. Trying to rename a page from "title without special chars" to "title with åäö" renders in `/var/log/apache2/error.log`:
+
+    [Fri Jul 15 14:58:17 2011] [error] [client 46.239.104.5] transaction abort!, referer: http://46.239.104.5:81/blog/ikiwiki.cgi
+    [Fri Jul 15 14:58:17 2011] [error] [client 46.239.104.5] rollback completed, referer: http://46.239.104.5:81/blog/ikiwiki.cgi
+    [Fri Jul 15 14:58:17 2011] [error] [client 46.239.104.5] abort: decoding near 'itle_with_\xc3\xa5\xc3\xa4\xc3\xb6.mdw': 'ascii' codec can't decode byte 0xc3 in position 66: ordinal not in range(128)!, referer: http://46.239.104.5:81/blog/ikiwiki.cgi
+    [Fri Jul 15 14:58:17 2011] [error] [client 46.239.104.5] 'hg commit -m rename posts/title_without_special_chars.mdwn to posts/title_with_\xc3\xa5\xc3\xa4\xc3\xb6.mdwn -q' failed:  at /usr/share/perl5/IkiWiki/Plugin/mercurial.pm line 123., referer: http://46.239.104.5:81/blog/ikiwiki.cgi
+
+>>> I added setting the environment variable `HGENCODING=utf-8` in `rcs_commit_helper`, which took care of these problems. *Done* --[[Daniel Andersson]]
+
+>> When this has happened, directly following by `rename` and `remove` doesn't work as it should, since the file is not commited. `hg remove -f` doesn't physically remove files that aren't tracked (no `hg` command does). Perhaps a regular `unlink $file` should be called to not clutter the source dir if `hg remove` failed because the file wasn't tracked. --[[Daniel Andersson]]
+
+>> I've also noted that when a post is added or removed, the commit message lacks the page title. It contains the title when the page is renamed though, so it should be an easy fix. I'll look into it. --[[Daniel Andersson]]
+
+>>> This is to do with `{rename,remove,editchanges}.pm`. The last two simply don't give a message to `rcs_commit_staged`. Separate issue. --[[Daniel Andersson]]
diff --git a/doc/users/Daniel_Andersson.mdwn b/doc/users/Daniel_Andersson.mdwn
new file mode 100644 (file)
index 0000000..8565be1
--- /dev/null
@@ -0,0 +1,3 @@
+Heard about ikiwiki through Planet Debian and Joey Hess. Started playing with it, and make attempts to report bugs and maybe even fix them, though my Perl experience is equal to zero.
+
+At the moment I'm fiddling with ikiwiki at <http://510x.se/notes>.
index 48f6065fa8a2f26ca76e9a604f0cce85c257ef50..a526ee9602baea39ca9b30c08574a94f8585adb8 100644 (file)
@@ -1,5 +1,5 @@
 Name:           ikiwiki
-Version: 3.20110711
+Version: 3.20110715
 Release:        1%{?dist}
 Summary:        A wiki compiler
 
index cd288c503bf4b73c59f0d9b9bd1cc8421a506b4c..4f2a458e65297cf4a00bb89765f539e3f200e472 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-07-11 18:36-0400\n"
+"POT-Creation-Date: 2011-07-15 18:48-0400\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -171,15 +171,15 @@ msgstr ""
 msgid "bad attachment filename"
 msgstr ""
 
-#: ../IkiWiki/Plugin/attachment.pm:293
+#: ../IkiWiki/Plugin/attachment.pm:295
 msgid "attachment upload"
 msgstr ""
 
-#: ../IkiWiki/Plugin/attachment.pm:344
+#: ../IkiWiki/Plugin/attachment.pm:346
 msgid "this attachment is not yet saved"
 msgstr ""
 
-#: ../IkiWiki/Plugin/attachment.pm:361
+#: ../IkiWiki/Plugin/attachment.pm:363
 msgid "just uploaded"
 msgstr ""
 
@@ -835,16 +835,16 @@ msgstr ""
 msgid "%s is not a file"
 msgstr ""
 
-#: ../IkiWiki/Plugin/remove.pm:150
+#: ../IkiWiki/Plugin/remove.pm:149
 #, perl-format
 msgid "confirm removal of %s"
 msgstr ""
 
-#: ../IkiWiki/Plugin/remove.pm:187
+#: ../IkiWiki/Plugin/remove.pm:186
 msgid "Please select the attachments to remove."
 msgstr ""
 
-#: ../IkiWiki/Plugin/remove.pm:231
+#: ../IkiWiki/Plugin/remove.pm:230
 msgid "removed"
 msgstr ""
 
index efe077f84ad07dfc3eee8403333a7137e57de1db..696c8dcad197134bb7264d17d9f5cf950c24aba0 100644 (file)
@@ -44,7 +44,7 @@ $(function () { $('#fileupload').fileupload(); }); // initialize upload widget
 </script> 
 <script id="template-download" type="text/x-jquery-tmpl"> 
     <tr class="template-download{{if error}} ui-state-error{{/if}}">
-        <td><input type="checkbox" name="attachment_select" value="${name}" />${name}</td>
+        <td><input type="checkbox" checked name="attachment_select" value="${name}" />${name}</td>
         <td>${humansize}</td>
         {{if error}}
         <td class="error" colspan="2">failed!</td>
@@ -62,9 +62,7 @@ $(function () { $('#fileupload').fileupload(); }); // initialize upload widget
 </div>
 <TMPL_VAR FIELD-ATTACHMENT>
 <noscript><TMPL_VAR FIELD-UPLOAD></noscript>
-<TMPL_IF NAME="ATTACHMENT_LIST">
 <TMPL_VAR FIELD-LINK><TMPL_VAR FIELD-RENAME><TMPL_VAR FIELD-REMOVE>
-</TMPL_IF>
 </div> 
 </div>
 </TMPL_IF>