David Caro has uploaded a new change for review.

Change subject: Added hook to pass bug to modified status
......................................................................

Added hook to pass bug to modified status

Change-Id: I03a2e42dd8f6d1062ef0bcaf2ec1ace36967c2c0
Signed-off-by: David Caro <[email protected]>
---
A hooks/bz/patchset-created.bz.2.set_POST
1 file changed, 44 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/gerrit-admin refs/changes/16/15916/1

diff --git a/hooks/bz/patchset-created.bz.2.set_POST 
b/hooks/bz/patchset-created.bz.2.set_POST
new file mode 100755
index 0000000..8815d93
--- /dev/null
+++ b/hooks/bz/patchset-created.bz.2.set_POST
@@ -0,0 +1,44 @@
+#!/bin/bash
+###############################################################################
+# Moves the bugs in the commit message to POST state
+###############################################################################
+source bz.sh
+source gerrit.sh
+source conf.sh
+
+set_POST()
+{
+    local bug_id="${1?}"
+    local commit="${2?}"
+    ## Get the bug url and it's flags
+    bz.login -b "$bug_id" "$bz_user" "$bz_password"
+    ## Update the tracker on the bz bug
+    local message="$(conf.t_get message)"
+    if ! res=$(bz.update_status "$bug_id" "POST" "$commit"); then
+        message+="\n* Set POST #$bug_id: FAILED, $res"
+        echo "Failed to update the status of bug #$bug_id for gerrit id 
#${change_url//*\/} to POST"
+        echo "  $res"
+    else
+        message+="\n* Set POST #$bug_id: OK${res:+, $res}"
+        echo "Status updated on bug #$bug_id for gerrit id #${change_url//*\/} 
to POST"
+    fi
+    conf.t_put message "$message"
+    return 0
+}
+
+###############################################################################
+## MAIN
+## Parse the parameters
+gerrit.parse_params "$@"
+
+## Parse the configuration
+conf.load
+
+bz_user="${BZ_USER?No BZ_USER in the config file}"
+bz_password="${BZ_PASS?No BZ_PASS in the config file}"
+
+bug_ids=($(bz.get_bug_id $commit))
+for bug_id in "${bug_ids[@]}"; do
+    set_POST "$bug_id" "$commit"
+done
+exit 0


-- 
To view, visit http://gerrit.ovirt.org/15916
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I03a2e42dd8f6d1062ef0bcaf2ec1ace36967c2c0
Gerrit-PatchSet: 1
Gerrit-Project: gerrit-admin
Gerrit-Branch: master
Gerrit-Owner: David Caro <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to