monotone-commits-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-commits-diffs] net.venge.monotone: 4b15dc3e93cb730e8c7d2eb155


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone: 4b15dc3e93cb730e8c7d2eb155deb95d3346be71
Date: Fri, 18 Feb 2011 20:55:15 +0100 (CET)

revision:            4b15dc3e93cb730e8c7d2eb155deb95d3346be71
date:                2011-02-18T18:22:06
author:              Richard Levitte <address@hidden>
branch:              net.venge.monotone
changelog:
Move yet another monotone hook script from contrib to extra.  This time,
it's the ciabot notifier.

* contrib/ciabot_monotone_hookversion.py: Renamed to ...
* extra/mtn-hooks/monotone-ciabot.py: ... this.  Add a command on the
  variable needed by the lua hook to know where this script is.  Version
  updated to 1.0.
* contrib/ciabot_monotone_hookversion.lua: Renamed to ...
* extra/mtn-hooks/monotone-ciabot.lua: ... this.  Changed the message to
  mention the correct new python script name.

* test/extra/ciabot/__driver__.lua: New test driver.
* test/extra/ciabot/ciabot.conf: New file.  This is the ciabot
  configuration file we use for this test.
* test/extra/ciabot/scripts/run-monotone-ciabot: New script that runs
  monotone-ciabot.py and redirects its output to a well known file.
* test/extra/ciabot/monotone-ciabot.expected: New file.  This is the
  output we expect from monotone-ciabot.py.

manifest:
format_version "1"

new_manifest [29e8d68d99ec47dcb11f6d806a69107c5fdc2f33]

old_revision [688027774810652c94014433661601a5182e253b]

rename "contrib/ciabot_monotone_hookversion.lua"
    to "extra/mtn-hooks/monotone-ciabot.lua"

rename "contrib/ciabot_monotone_hookversion.py"
    to "extra/mtn-hooks/monotone-ciabot.py"

add_dir "test/extra/ciabot"

add_dir "test/extra/ciabot/scripts"

add_file "test/extra/ciabot/__driver__.lua"
 content [557ea25238e1e71804affaf8b05ddad9d9db1150]

add_file "test/extra/ciabot/ciabot.conf"
 content [1c6d2fd5cf620165f9dbeab9e7c740755234e0d6]

add_file "test/extra/ciabot/monotone-ciabot.expected"
 content [4d42ce557d78c5db72b8ae26e8a33278359832b2]

add_file "test/extra/ciabot/scripts/run-monotone-ciabot"
 content [8a130b05df865ac293e8bd78433d6a59f8953a97]

patch "extra/mtn-hooks/monotone-ciabot.lua"
 from [5d3f67c5f8bd79c0ac81e245861e1e44ec4d0a5b]
   to [2c740631a022b622ddc3f0944d6a5f46e6efbd56]

patch "extra/mtn-hooks/monotone-ciabot.py"
 from [f4173182b915944867217f4263e9eee812d2f85b]
   to [cdbe8ebfec575ae31b8dd62ce3ee8108edc19ab4]

  set "test/extra/ciabot/scripts/run-monotone-ciabot"
 attr "mtn:execute"
value "true"
============================================================
--- contrib/ciabot_monotone_hookversion.py	f4173182b915944867217f4263e9eee812d2f85b
+++ extra/mtn-hooks/monotone-ciabot.py	cdbe8ebfec575ae31b8dd62ce3ee8108edc19ab4
@@ -20,7 +20,9 @@
 #      configuration directory (whatever is returned by get_confdir()).
 #      That configuration file follows basic-io syntax, the comments in
 #      the config class is the best documentation for now.
-#   -- include ciabot_monotone_hookversion.lua in the server's monotonerc
+#   -- include monotone-ciabot.lua in the server's monotonerc
+#   -- add a variable 'ciabot_python_script in the server's monotonerc,
+#      that points to this script.
 
 import sys
 import re
@@ -207,7 +209,7 @@ def send_change_for(rid, branch, author,
     message_tmpl = """<message>
     <generator>
         <name>Monotone CIA Bot client python script</name>
-        <version>0.9</version>
+        <version>1.0</version>
     </generator>
     <source>
         <project>%(project)s</project>
============================================================
--- contrib/ciabot_monotone_hookversion.lua	5d3f67c5f8bd79c0ac81e245861e1e44ec4d0a5b
+++ extra/mtn-hooks/monotone-ciabot.lua	2c740631a022b622ddc3f0944d6a5f46e6efbd56
@@ -20,7 +20,7 @@ do
 				  -- Configure with the path to the
 				  -- corresponding python script
 				  if not ciabot_python_script then
-				     print "Please configure by defining 'ciabot_python_script' with the path to the python script ciabot_monotone_hookversion.py"
+				     print "Please configure by defining 'ciabot_python_script' with the path to the python script monotone_ciabot.py"
 				     return "continue",nil
 				  end
 				  
============================================================
--- /dev/null	
+++ test/extra/ciabot/__driver__.lua	557ea25238e1e71804affaf8b05ddad9d9db1150
@@ -0,0 +1,52 @@
+skip_if(not existsonpath("python"))
+
+includecommon("netsync.lua")
+
+mtn_setup()
+netsync.setup()
+append("netsync.lua", "\n\
+\n\
+includedirpattern(get_confdir() .. \"/hooks.d\",\"*.conf\")\n\
+includedirpattern(get_confdir() .. \"/hooks.d\",\"*.lua\")\n\
+")
+
+mkdir("hooks.d")
+mkdir("scripts")
+check(copy(srcdir.."/../extra/mtn-hooks/monotone-ciabot.lua",
+	   "hooks.d/monotone-ciabot.lua"))
+check(copy(srcdir.."/../extra/mtn-hooks/monotone-ciabot.py",
+	   "scripts/monotone-ciabot.py"))
+
+-- To make life easier, we run monotone-ciabot.py via the script
+-- run-monotone-ciabot, which makes sure the output ends up in a
+-- known file.
+check(get("scripts/run-monotone-ciabot"))
+
+-- Get+write the ciabot configuration
+check(get("ciabot.conf"))
+writefile("hooks.d/monotone-ciabot.conf",
+	  "ciabot_python_script = \"" .. test.root .. "/scripts/run-monotone-ciabot\"\n")
+
+-- A file with expected result
+check(get("monotone-ciabot.expected"))
+
+-- Serve test2.db
+srv = netsync.start(2)
+
+-- Add some revisions to push
+addfile("test1", "foo")
+addfile("test2", "bar")
+commit()
+writefile("test2", "foobar")
+commit()
+
+-- Do the transfer
+srv:push("testbranch",1)
+
+srv:stop()
+
+check(exists("monotone-ciabot.err"))
+check(fsize("monotone-ciabot.err") == 0)
+check(exists("monotone-ciabot.out"))
+check(samefile("monotone-ciabot.out",
+	       "monotone-ciabot.expected"))
============================================================
--- /dev/null	
+++ test/extra/ciabot/ciabot.conf	1c6d2fd5cf620165f9dbeab9e7c740755234e0d6
@@ -0,0 +1,5 @@
+delivery "debug"
+url "http://test.net/commit/%(revision)s"
+
+pattern "testbranch"
+projectid "test"
============================================================
--- /dev/null	
+++ test/extra/ciabot/monotone-ciabot.expected	4d42ce557d78c5db72b8ae26e8a33278359832b2
@@ -0,0 +1,19 @@
+<message>
+    <generator>
+        <name>Monotone CIA Bot client python script</name>
+        <version>1.0</version>
+    </generator>
+    <source>
+        <project>test</project>
+        <branch>testbranch</branch>
+    </source>
+    <body>
+        <commit>
+            <revision>425f7d00baffb1f43a12b60f106b2293d5dddd7c</revision>
+            <author>address@hidden</author>
+            <files><file action="">test2</file></files>
+            <log>blah-blah</log>
+            <url>http://test.net/commit/425f7d00baffb1f43a12b60f106b2293d5dddd7c</url>
+        </commit>
+    </body>
+</message>
============================================================
--- /dev/null	
+++ test/extra/ciabot/scripts/run-monotone-ciabot	8a130b05df865ac293e8bd78433d6a59f8953a97
@@ -0,0 +1,5 @@
+#! /bin/sh
+
+"`dirname $0`"/monotone-ciabot.py "$@" \
+    > monotone-ciabot.out \
+    2> monotone-ciabot.err

reply via email to

[Prev in Thread] Current Thread [Next in Thread]