From c936ba171929b43963afd68dd66944199e2351f4 Mon Sep 17 00:00:00 2001
From: joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Date: Sat, 24 Mar 2007 15:14:53 +0000
Subject: [PATCH] * Fix mercurial backend to deal with empty commit messages.

---
 IkiWiki/Rcs/mercurial.pm                                  | 7 +++++--
 debian/changelog                                          | 3 ++-
 doc/bugs/Http_error_500_when_using_mercurial_backend.mdwn | 8 +++++++-
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/IkiWiki/Rcs/mercurial.pm b/IkiWiki/Rcs/mercurial.pm
index e4cc6deb3..84bf99c68 100644
--- a/IkiWiki/Rcs/mercurial.pm
+++ b/IkiWiki/Rcs/mercurial.pm
@@ -79,9 +79,12 @@ sub rcs_commit ($$$;$$) { #{{{
 	}
 
 	$message = possibly_foolish_untaint($message);
+	if (! length $message) {
+		$message = "no message given";
+	}
 
-	my @cmdline = ("hg", "-q", "-R", "$config{srcdir}", "commit", 
-	               "-m", "$message", "-u", "$user");
+	my @cmdline = ("hg", "-q", "-R", $config{srcdir}, "commit", 
+	               "-m", $message, "-u", $user);
 	if (system(@cmdline) != 0) {
 		warn "'@cmdline' failed: $!";
 	}
diff --git a/debian/changelog b/debian/changelog
index dda5aa78b..dda6ccf58 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,8 +15,9 @@ ikiwiki (1.48) UNRELEASED; urgency=low
   * Renamed %oldpagemtime to a more accurately named %pagemtime and fix it to
     actually store pages' mtimes.
   * Add "mtime" sort parameter to inline plugin.
+  * Fix mercurial backend to deal with empty commit messages.
 
- -- Joey Hess <joeyh@debian.org>  Fri, 23 Mar 2007 16:16:39 -0400
+ -- Joey Hess <joeyh@debian.org>  Sat, 24 Mar 2007 11:14:10 -0400
 
 ikiwiki (1.47) unstable; urgency=low
 
diff --git a/doc/bugs/Http_error_500_when_using_mercurial_backend.mdwn b/doc/bugs/Http_error_500_when_using_mercurial_backend.mdwn
index 5015b6290..db49f1e4a 100644
--- a/doc/bugs/Http_error_500_when_using_mercurial_backend.mdwn
+++ b/doc/bugs/Http_error_500_when_using_mercurial_backend.mdwn
@@ -19,4 +19,10 @@ Here is a quick patch, partialy copying the svn backend.
     +		$message="web commit by Anonymous".(length $message ? ": $message" : "");
      	}
      
-     	$message = possibly_foolish_untaint($message);
\ No newline at end of file
+     	$message = possibly_foolish_untaint($message);
+
+> The svn backend puts the user info in the message because that's the only
+> way to store the user info, unlike with mercurial. The svn plugin also
+> removes that info when getting the RecentChanges info. Since mercurial
+> does not do that, it seemed better to me to test for an empty message and
+> set it to a dummy commit string, which I've [[done]]. --[[Joey]]
-- 
2.39.5