figured out how to get commits contained in a pack thanks to cbreak on
[gwvp-mini.git] / bin / gwvpminicmdtool.php
1 <?php
2
3 $WEB_ROOT_FS = realpath(dirname(__FILE__));
4 $BASE_URL = "/";\r
5
6 global $WEB_ROOT_FS, $BASE_URL, $IS_WEB_REQUEST, $data_directory, $db_type, $db_name, $db_username, $db_password, $IS_WEB_REQUEST, $cmd_line_tool;
7 $IS_WEB_REQUEST = false;\r
8
9 if(file_exists("../www/config.php")) require_once("../www/config.php");
10 else if(file_exists("/etc/gwvpmini/config.php")) require_once("/etc/gwvpmini/config.php");
11 else $noconfig = true;
12
13 if(file_exists("../gwvpmini/gwvpmini.php")) require_once("../gwvpmini/gwvpmini.php");
14 else if(file_exists("/usr/share/gwvpmini/lib/gwvpmini/gwvpmini.php")) require_once("/usr/share/gwvpmini/lib/gwvpmini/gwvpmini.php");
15
16 if(isset($argv["1"])) {
17         switch($argv["1"]) {
18                 case "update":
19                         gwvpcmdtool_UpdateHook();
20                         break;
21                 case "pre-receive":
22                         gwvpcmdtool_PreReceive();
23                         break;
24                 default:
25                         gwvpcmdtool_Usage();
26         }
27 } else gwvpcmdtool_Usage();
28 return;
29
30
31
32 function gwvpcmdtool_Usage()
33 {
34         global $argv;
35         
36         echo "Usage: ".$argv[0]."\n";
37         echo "\tupdatehook <user> <ref> <firstupdate> <lastupdate>\n";
38 }
39
40 function gwvpcmdtool_UpdateHook()
41 {
42         global $argv;
43         echo "got ".$argv[2].", ".$argv[3].", ".$argv[4]."\n";
44 }
45
46 function gwvpcmdtool_PreReceive()
47 {
48         global $argv;
49
50         echo "got from prereceive ".$argv[2].", ".$argv[3].", ".$argv[4]."\n";\r
51         
52         passthru("git rev-list --reverse ".$argv[3]." --not --all ");
53 }
54 ?>