Support changelog message
authorJoel Stanley <joel.stanley@adelaide.edu.au>
Mon, 3 Nov 2008 11:51:26 +0000 (11:51 +0000)
committerBernie Innocenti <bernie@codewiz.org>
Sun, 30 Nov 2008 18:15:47 +0000 (19:15 +0100)
The user can modify the git commit message through an input box on
the edit page.  The original behavour is preserved by defualting the
input box to the original commit mesage.

This crosses off item 3 from http://codewiz.org/wiki/GeekiGeekiToDo.

Signed-off-by: Joel Stanley <joel.stanley@adelaide.edu.au>
geekigeeki.py
post_edit_hook.sh

index 64333eaf0605d79abdc674eb9a5042fed05e5050..794350389c8def020777bfe47efa8733a001a0f4 100755 (executable)
@@ -246,9 +246,9 @@ def handle_edit(pagename):
     pg = Page(pagename)
     if 'save' in form:
         if form['file'].value:
-            pg.save(form['file'].file.read())
+            pg.save(form['file'].file.read(), form['changelog'].value)
         else:
-            pg.save(form['savetext'].value.replace('\r\n', '\n'))
+            pg.save(form['savetext'].value.replace('\r\n', '\n'), form['changelog'].value)
         pg.format()
     elif 'cancel' in form:
         pg.msg_text = 'Editing canceled'
@@ -704,8 +704,9 @@ class Page:
             <input type="submit" name="preview" value="Preview" />
             <input type="reset" value="Reset" />
             <input type="submit" name="cancel" value="Cancel" />
-            <br />
-            </form></div>"""
+            <br />"""
+       print "Changelog: <input type=\"input\" name=\"changelog\" value=\"Edit page %s\"/>" % self.page_name
+       print"</form></div>"
         print "<p>" + Page('EditingTips').link_to() + "</p>"
         if preview:
             print "<div class='preview'>"
@@ -743,7 +744,7 @@ class Page:
                 if er.errno != errno.ENOENT: raise er
         os.rename(tmp_filename, name)
 
-    def save(self, newdata):
+    def save(self, newdata, changelog):
         if not self.can_write():
             self.msg_text = 'Write access denied by ACLs'
             self.msg_type = 'error'
@@ -756,7 +757,8 @@ class Page:
             cmd = ( post_edit_hook
                 + " '" + data_dir + '/' + self.page_name
                 + "' '" + remote_user()
-                + "' '" + remote_host() + "'"
+                + "' '" + remote_host()
+               + "' '" + changelog + "'"
             )
             out = os.popen(cmd)
             output = out.read()
index fca8e24a856da03ee5014e89c47802e765a5f5c9..2c06f19b1474abdbd2b98e637ee4d372024b46ad 100755 (executable)
@@ -4,7 +4,7 @@
 set -e
 exec 2>&1
 
-if [ $# -ne 3 ]; then
+if [ $# -ne 4 ]; then
        echo "Usage $0 <path-to-commit> <remote-user> <remote-host>"
        exit 1
 fi
@@ -17,4 +17,4 @@ git-add $file # In case it's a new page
 
 GIT_COMMITTER_NAME='GeekiGeeki' \
 GIT_COMMITTER_EMAIL='webmaster@codewiz.org' \
-git-commit -a -m "Edit page $file" --author="$2 <$2@$3>"
+git commit -a -m "$4" --author="$2 <$2@$3>"