1
+ /*
2
+ * Copyright 2014 gitblit.com.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package com .gitblit .plugin .cookbook ;
17
+
18
+ import org .slf4j .Logger ;
19
+ import org .slf4j .LoggerFactory ;
20
+
21
+ import ro .fortsoft .pf4j .Extension ;
22
+
23
+ import com .gitblit .extensions .PatchsetHook ;
24
+ import com .gitblit .models .TicketModel ;
25
+
26
+ /**
27
+ *
28
+ * Example patchset hook.
29
+ *
30
+ * @author James Moger
31
+ *
32
+ */
33
+ @ Extension
34
+ public class MyPatchsetHook extends PatchsetHook {
35
+
36
+ final Logger log = LoggerFactory .getLogger (getClass ());
37
+
38
+ @ Override
39
+ public void onNewPatchset (TicketModel ticket ) {
40
+ log .info (String .format ("%s new patchset %s ticket-%d patchset %d" ,
41
+ getClass ().getSimpleName (), ticket .repository , ticket .number ,
42
+ ticket .getCurrentPatchset ().number ));
43
+ }
44
+
45
+ @ Override
46
+ public void onUpdatePatchset (TicketModel ticket ) {
47
+ log .info (String .format ("%s update patchset %s ticket-%d patchset %d-%d" ,
48
+ getClass ().getSimpleName (), ticket .repository , ticket .number ,
49
+ ticket .getCurrentPatchset ().number ,
50
+ ticket .getCurrentPatchset ().rev ));
51
+ }
52
+
53
+ @ Override
54
+ public void onMergePatchset (TicketModel ticket ) {
55
+ log .info (String .format ("%s merge patchset %s ticket-%d SHA %s" ,
56
+ getClass ().getSimpleName (), ticket .repository , ticket .number ,
57
+ ticket .mergeSha ));
58
+ }
59
+ }
0 commit comments