Show More
@@ -1,175 +1,187 b'' | |||||
1 |
# This code allows override the integrations templates. |
|
1 | # This code allows override the integrations templates. | |
2 | # file of rcextensions |
|
2 | # Put this into the __init__.py file of rcextensions to override the templates | |
3 |
|
3 | |||
4 |
|
4 | |||
5 |
|
5 | # EMAIL Integration | ||
6 | from rhodecode.integrations import email |
|
6 | from rhodecode.integrations import email | |
7 | email.REPO_PUSH_TEMPLATE_HTML = email.Template(''' |
|
7 | email.REPO_PUSH_TEMPLATE_HTML = email.Template(''' | |
8 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
|
8 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
9 | <html xmlns="http://www.w3.org/1999/xhtml"> |
|
9 | <html xmlns="http://www.w3.org/1999/xhtml"> | |
10 | <head> |
|
10 | <head> | |
11 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|
11 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
12 | <meta name="viewport" content="width=device-width, initial-scale=1.0"/> |
|
12 | <meta name="viewport" content="width=device-width, initial-scale=1.0"/> | |
13 | <title>${subject}</title> |
|
13 | <title>${subject}</title> | |
14 | <style type="text/css"> |
|
14 | <style type="text/css"> | |
15 | /* Based on The MailChimp Reset INLINE: Yes. */ |
|
15 | /* Based on The MailChimp Reset INLINE: Yes. */ | |
16 | #outlook a {padding:0;} /* Force Outlook to provide a "view in browser" menu link. */ |
|
16 | #outlook a {padding:0;} /* Force Outlook to provide a "view in browser" menu link. */ | |
17 | body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;} |
|
17 | body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;} | |
18 | /* Prevent Webkit and Windows Mobile platforms from changing default font sizes.*/ |
|
18 | /* Prevent Webkit and Windows Mobile platforms from changing default font sizes.*/ | |
19 | .ExternalClass {width:100%;} /* Force Hotmail to display emails at full width */ |
|
19 | .ExternalClass {width:100%;} /* Force Hotmail to display emails at full width */ | |
20 | .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} |
|
20 | .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} | |
21 | /* Forces Hotmail to display normal line spacing. More on that: http://www.emailonacid.com/forum/viewthread/43/ */ |
|
21 | /* Forces Hotmail to display normal line spacing. More on that: http://www.emailonacid.com/forum/viewthread/43/ */ | |
22 | #backgroundTable {margin:0; padding:0; line-height: 100% !important;} |
|
22 | #backgroundTable {margin:0; padding:0; line-height: 100% !important;} | |
23 | /* End reset */ |
|
23 | /* End reset */ | |
24 |
|
24 | |||
25 | /* defaults for images*/ |
|
25 | /* defaults for images*/ | |
26 | img {outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;} |
|
26 | img {outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;} | |
27 | a img {border:none;} |
|
27 | a img {border:none;} | |
28 | .image_fix {display:block;} |
|
28 | .image_fix {display:block;} | |
29 |
|
29 | |||
30 | body {line-height:1.2em;} |
|
30 | body {line-height:1.2em;} | |
31 | p {margin: 0 0 20px;} |
|
31 | p {margin: 0 0 20px;} | |
32 | h1, h2, h3, h4, h5, h6 {color:#323232!important;} |
|
32 | h1, h2, h3, h4, h5, h6 {color:#323232!important;} | |
33 | a {color:#427cc9;text-decoration:none;outline:none;cursor:pointer;} |
|
33 | a {color:#427cc9;text-decoration:none;outline:none;cursor:pointer;} | |
34 | a:focus {outline:none;} |
|
34 | a:focus {outline:none;} | |
35 | a:hover {color: #305b91;} |
|
35 | a:hover {color: #305b91;} | |
36 | h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {color:#427cc9!important;text-decoration:none!important;} |
|
36 | h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {color:#427cc9!important;text-decoration:none!important;} | |
37 | h1 a:active, h2 a:active, h3 a:active, h4 a:active, h5 a:active, h6 a:active {color: #305b91!important;} |
|
37 | h1 a:active, h2 a:active, h3 a:active, h4 a:active, h5 a:active, h6 a:active {color: #305b91!important;} | |
38 | h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited {color: #305b91!important;} |
|
38 | h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited {color: #305b91!important;} | |
39 | table {font-size:13px;border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;} |
|
39 | table {font-size:13px;border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;} | |
40 | table td {padding:.65em 1em .65em 0;border-collapse:collapse;vertical-align:top;text-align:left;} |
|
40 | table td {padding:.65em 1em .65em 0;border-collapse:collapse;vertical-align:top;text-align:left;} | |
41 | input {display:inline;border-radius:2px;border-style:solid;border: 1px solid #dbd9da;padding:.5em;} |
|
41 | input {display:inline;border-radius:2px;border-style:solid;border: 1px solid #dbd9da;padding:.5em;} | |
42 | input:focus {outline: 1px solid #979797} |
|
42 | input:focus {outline: 1px solid #979797} | |
43 | @media only screen and (-webkit-min-device-pixel-ratio: 2) { |
|
43 | @media only screen and (-webkit-min-device-pixel-ratio: 2) { | |
44 | /* Put your iPhone 4g styles in here */ |
|
44 | /* Put your iPhone 4g styles in here */ | |
45 | } |
|
45 | } | |
46 |
|
46 | |||
47 | /* Android targeting */ |
|
47 | /* Android targeting */ | |
48 | @media only screen and (-webkit-device-pixel-ratio:.75){ |
|
48 | @media only screen and (-webkit-device-pixel-ratio:.75){ | |
49 | /* Put CSS for low density (ldpi) Android layouts in here */ |
|
49 | /* Put CSS for low density (ldpi) Android layouts in here */ | |
50 | } |
|
50 | } | |
51 | @media only screen and (-webkit-device-pixel-ratio:1){ |
|
51 | @media only screen and (-webkit-device-pixel-ratio:1){ | |
52 | /* Put CSS for medium density (mdpi) Android layouts in here */ |
|
52 | /* Put CSS for medium density (mdpi) Android layouts in here */ | |
53 | } |
|
53 | } | |
54 | @media only screen and (-webkit-device-pixel-ratio:1.5){ |
|
54 | @media only screen and (-webkit-device-pixel-ratio:1.5){ | |
55 | /* Put CSS for high density (hdpi) Android layouts in here */ |
|
55 | /* Put CSS for high density (hdpi) Android layouts in here */ | |
56 | } |
|
56 | } | |
57 | /* end Android targeting */ |
|
57 | /* end Android targeting */ | |
58 |
|
58 | |||
59 | </style> |
|
59 | </style> | |
60 |
|
60 | |||
61 | <!-- Targeting Windows Mobile --> |
|
61 | <!-- Targeting Windows Mobile --> | |
62 | <!--[if IEMobile 7]> |
|
62 | <!--[if IEMobile 7]> | |
63 | <style type="text/css"> |
|
63 | <style type="text/css"> | |
64 |
|
64 | |||
65 | </style> |
|
65 | </style> | |
66 | <![endif]--> |
|
66 | <![endif]--> | |
67 |
|
67 | |||
68 | <!--[if gte mso 9]> |
|
68 | <!--[if gte mso 9]> | |
69 | <style> |
|
69 | <style> | |
70 | /* Target Outlook 2007 and 2010 */ |
|
70 | /* Target Outlook 2007 and 2010 */ | |
71 | </style> |
|
71 | </style> | |
72 | <![endif]--> |
|
72 | <![endif]--> | |
73 | </head> |
|
73 | </head> | |
74 | <body> |
|
74 | <body> | |
75 | <!-- Wrapper/Container Table: Use a wrapper table to control the width and the background color consistently of your email. Use this approach instead of setting attributes on the body tag. --> |
|
75 | <!-- Wrapper/Container Table: Use a wrapper table to control the width and the background color consistently of your email. Use this approach instead of setting attributes on the body tag. --> | |
76 | <table cellpadding="0" cellspacing="0" border="0" id="backgroundTable" align="left" style="margin:1%;width:97%;padding:0;font-family:sans-serif;font-weight:100;border:1px solid #dbd9da"> |
|
76 | <table cellpadding="0" cellspacing="0" border="0" id="backgroundTable" align="left" style="margin:1%;width:97%;padding:0;font-family:sans-serif;font-weight:100;border:1px solid #dbd9da"> | |
77 | <tr> |
|
77 | <tr> | |
78 | <td valign="top" style="padding:0;"> |
|
78 | <td valign="top" style="padding:0;"> | |
79 | <table cellpadding="0" cellspacing="0" border="0" align="left" width="100%"> |
|
79 | <table cellpadding="0" cellspacing="0" border="0" align="left" width="100%"> | |
80 | <tr><td style="width:100%;padding:7px;background-color:#202020" valign="top"> |
|
80 | <tr><td style="width:100%;padding:7px;background-color:#202020" valign="top"> | |
81 | <a style="color:#eeeeee;text-decoration:none;" href="${instance_url}"> |
|
81 | <a style="color:#eeeeee;text-decoration:none;" href="${instance_url}"> | |
82 | ${'RhodeCode'} |
|
82 | ${'RhodeCode'} | |
83 | </a> |
|
83 | </a> | |
84 | </td></tr> |
|
84 | </td></tr> | |
85 | <tr> |
|
85 | <tr> | |
86 | <td style="padding:15px;" valign="top"> |
|
86 | <td style="padding:15px;" valign="top"> | |
87 | % if data['push']['commits']: |
|
87 | % if data['push']['commits']: | |
88 | % for commit in data['push']['commits']: |
|
88 | % for commit in data['push']['commits']: | |
89 | <a href="${commit['url']}">${commit['short_id']}</a> by ${commit['author']} at ${commit['date']} <br/> |
|
89 | <a href="${commit['url']}">${commit['short_id']}</a> by ${commit['author']} at ${commit['date']} <br/> | |
90 | ${commit['message_html']} <br/> |
|
90 | ${commit['message_html']} <br/> | |
91 | <br/> |
|
91 | <br/> | |
92 | % endfor |
|
92 | % endfor | |
93 | % else: |
|
93 | % else: | |
94 | No commit data |
|
94 | No commit data | |
95 | % endif |
|
95 | % endif | |
96 | </td> |
|
96 | </td> | |
97 | </tr> |
|
97 | </tr> | |
98 | </table> |
|
98 | </table> | |
99 | </td> |
|
99 | </td> | |
100 | </tr> |
|
100 | </tr> | |
101 | </table> |
|
101 | </table> | |
102 | <!-- End of wrapper table --> |
|
102 | <!-- End of wrapper table --> | |
103 | <p><a style="margin-top:15px;margin-left:1%;font-family:sans-serif;font-weight:100;font-size:11px;color:#666666;text-decoration:none;" href="${instance_url}"> |
|
103 | <p><a style="margin-top:15px;margin-left:1%;font-family:sans-serif;font-weight:100;font-size:11px;color:#666666;text-decoration:none;" href="${instance_url}"> | |
104 | ${'This is a notification from RhodeCode. %(instance_url)s' % {'instance_url': instance_url}} |
|
104 | ${'This is a notification from RhodeCode. %(instance_url)s' % {'instance_url': instance_url}} | |
105 | </a></p> |
|
105 | </a></p> | |
106 | </body> |
|
106 | </body> | |
107 | </html> |
|
107 | </html> | |
108 | ''') |
|
108 | ''') | |
109 |
|
109 | |||
110 |
|
110 | |||
111 | # JIRA (EE ONLY) |
|
111 | # JIRA Integration (EE ONLY) | |
|
112 | # available variables: | |||
|
113 | # url, short_id ,author | |||
|
114 | # branch, commit_message | |||
|
115 | # commit (dict data for commit) | |||
112 | from rc_integrations import jira_tracker |
|
116 | from rc_integrations import jira_tracker | |
113 |
|
117 | |||
114 | jira_tracker.COMMENT_TEMPLATE_PULL_REQUEST = jira_tracker.Template(''' |
|
118 | # used for references issues without transition, e.g `This ticket references PROJ-123` | |
115 | ${action} by ${author} (status: ${status}). \n |
|
|||
116 | pull-request: ${url} |
|
|||
117 | ''') |
|
|||
118 |
|
||||
119 |
|
||||
120 | jira_tracker.COMMENT_TEMPLATE_COMMIT = jira_tracker.Template(''' |
|
119 | jira_tracker.COMMENT_TEMPLATE_COMMIT = jira_tracker.Template(''' | |
121 | Commit `${short_id}` by ${author} on `${branch}` branch references this issue. \n |
|
120 | Commit `${short_id}` by ${author} on `${branch}` branch references this issue. \n | |
122 | ${url}\n |
|
121 | ${url}\n | |
123 |
|
122 | |||
124 | ## MODIFICATION add custom COMMIT message to the comment |
|
123 | ## MODIFICATION add custom COMMIT message to the comment | |
125 | ${commit['message']} |
|
124 | ${commit['message']} | |
126 | ''') |
|
125 | ''') | |
127 |
|
126 | |||
128 |
|
127 | # used when there's a transition, e.g referenced issues status goes from | ||
|
128 | # open to resolved this is used in correlation with something like `closes PROJ-123` | |||
129 | jira_tracker.COMMENT_TEMPLATE_COMMIT_WITH_STATUS = jira_tracker.Template(''' |
|
129 | jira_tracker.COMMENT_TEMPLATE_COMMIT_WITH_STATUS = jira_tracker.Template(''' | |
130 | Commit `${short_id}` by ${author} on `${branch}` branch changed this issue. \n |
|
130 | Commit `${short_id}` by ${author} on `${branch}` branch changed this issue. \n | |
131 | '{url}\n |
|
131 | '{url}\n | |
132 |
|
132 | |||
133 | ## MODIFICATION add custom COMMIT message to the comment |
|
133 | ## MODIFICATION add custom COMMIT message to the comment | |
134 | ${commit['message']} |
|
134 | ${commit['message']} | |
135 | ''') |
|
135 | ''') | |
136 |
|
136 | |||
|
137 | jira_tracker.COMMENT_TEMPLATE_PULL_REQUEST = jira_tracker.Template(''' | |||
|
138 | ${action} by ${author} (status: ${status}). \n | |||
|
139 | pull-request: ${url} | |||
|
140 | ''') | |||
|
141 | ||||
137 |
|
142 | |||
138 | # REDMINE (EE ONLY) |
|
143 | # REDMINE (EE ONLY) | |
|
144 | # available variables: | |||
|
145 | # url, short_id ,author | |||
|
146 | # branch, commit_message | |||
|
147 | # commit (dict data for commit) | |||
139 | from rc_integrations import redmine_tracker |
|
148 | from rc_integrations import redmine_tracker | |
140 |
|
149 | |||
|
150 | # used for references issues without transition, e.g `This ticket references #123` | |||
141 | redmine_tracker.COMMENT_TEMPLATE_COMMIT = redmine_tracker.Template(''' |
|
151 | redmine_tracker.COMMENT_TEMPLATE_COMMIT = redmine_tracker.Template(''' | |
142 | Commit `${short_id}` by ${author} on `${branch}` branch references this issue. \n |
|
152 | Commit `${short_id}` by ${author} on `${branch}` branch references this issue. \n | |
143 | commit: ${url}\n |
|
153 | commit: ${url}\n | |
144 |
|
154 | |||
145 | ## MODIFICATION add custom COMMIT message to the comment |
|
155 | ## MODIFICATION add custom COMMIT message to the comment | |
146 | message: |
|
156 | message: | |
147 | ``` |
|
157 | ``` | |
148 | ${commit['message']} |
|
158 | ${commit['message']} | |
149 | ``` |
|
159 | ``` | |
150 |
|
160 | |||
151 | ''') |
|
161 | ''') | |
152 |
|
162 | |||
|
163 | # used when there's a transition, e.g referenced issues status goes from | |||
|
164 | # open to resolved this is used in correlation with something like `closes #123` | |||
153 | redmine_tracker.COMMENT_TEMPLATE_COMMIT_WITH_STATUS = redmine_tracker.Template(''' |
|
165 | redmine_tracker.COMMENT_TEMPLATE_COMMIT_WITH_STATUS = redmine_tracker.Template(''' | |
154 | Commit `${short_id}` by ${author} on `${branch}` branch changed this issue. \n |
|
166 | Commit `${short_id}` by ${author} on `${branch}` branch changed this issue. \n | |
155 | commit: ${url}\n |
|
167 | commit: ${url}\n | |
156 |
|
168 | |||
157 | ## MODIFICATION add custom COMMIT message to the comment |
|
169 | ## MODIFICATION add custom COMMIT message to the comment | |
158 | message: |
|
170 | message: | |
159 | ``` |
|
171 | ``` | |
160 | ${commit['message']} |
|
172 | ${commit['message']} | |
161 | ``` |
|
173 | ``` | |
162 |
|
174 | |||
163 | ''') |
|
175 | ''') | |
164 |
|
176 | |||
165 | redmine_tracker.COMMENT_TEMPLATE_PULL_REQUEST = redmine_tracker.Template(''' |
|
177 | redmine_tracker.COMMENT_TEMPLATE_PULL_REQUEST = redmine_tracker.Template(''' | |
166 | ${action} by ${author} (status: ${status}). \n' |
|
178 | ${action} by ${author} (status: ${status}). \n' | |
167 | ${url}\n |
|
179 | ${url}\n | |
168 |
|
180 | |||
169 | ## MODIFICATION add custom COMMIT message to the comment |
|
181 | ## MODIFICATION add custom COMMIT message to the comment | |
170 | message: |
|
182 | message: | |
171 | ``` |
|
183 | ``` | |
172 | ${commit['message']} |
|
184 | ${commit['message']} | |
173 | ``` |
|
185 | ``` | |
174 |
|
186 | |||
175 | ''') |
|
187 | ''') |
@@ -1,90 +1,91 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | # Copyright (C) 2016-2018 RhodeCode GmbH |
|
2 | # Copyright (C) 2016-2018 RhodeCode GmbH | |
3 | # |
|
3 | # | |
4 | # This program is free software: you can redistribute it and/or modify |
|
4 | # This program is free software: you can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License, version 3 |
|
5 | # it under the terms of the GNU Affero General Public License, version 3 | |
6 | # (only), as published by the Free Software Foundation. |
|
6 | # (only), as published by the Free Software Foundation. | |
7 | # |
|
7 | # | |
8 | # This program is distributed in the hope that it will be useful, |
|
8 | # This program is distributed in the hope that it will be useful, | |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. |
|
11 | # GNU General Public License for more details. | |
12 | # |
|
12 | # | |
13 | # You should have received a copy of the GNU Affero General Public License |
|
13 | # You should have received a copy of the GNU Affero General Public License | |
14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | # |
|
15 | # | |
16 | # This program is dual-licensed. If you wish to learn more about the |
|
16 | # This program is dual-licensed. If you wish to learn more about the | |
17 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
17 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
18 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
18 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
19 |
|
19 | |||
20 | """ |
|
20 | """ | |
21 | us in hooks:: |
|
21 | us in hooks:: | |
22 |
|
22 | |||
23 | from .helpers import extract_pre_commits |
|
23 | from .helpers import extract_pre_commits | |
24 | # returns list of dicts with key-val fetched from extra fields |
|
24 | # returns list of dicts with key-val fetched from extra fields | |
25 | commit_list = extract_pre_commits.run(**kwargs) |
|
25 | commit_list = extract_pre_commits.run(**kwargs) | |
26 |
|
26 | |||
27 | """ |
|
27 | """ | |
28 | import re |
|
28 | import re | |
29 | import collections |
|
29 | import collections | |
30 | import json |
|
30 | import json | |
31 |
|
31 | |||
32 |
|
32 | |||
33 | def get_hg_commits(repo, refs): |
|
33 | def get_hg_commits(repo, refs): | |
34 | commits = [] |
|
34 | commits = [] | |
35 | return commits |
|
35 | return commits | |
36 |
|
36 | |||
37 |
|
37 | |||
38 | def get_git_commits(repo, refs): |
|
38 | def get_git_commits(repo, refs): | |
39 | commits = [] |
|
39 | commits = [] | |
40 |
|
40 | |||
41 | for data in refs: |
|
41 | for data in refs: | |
42 | # we should now extract commit data |
|
42 | # we should now extract commit data | |
43 | old_rev = data['old_rev'] |
|
43 | old_rev = data['old_rev'] | |
44 | new_rev = data['new_rev'] |
|
44 | new_rev = data['new_rev'] | |
45 |
|
45 | |||
46 | if '00000000' in old_rev: |
|
46 | if '00000000' in old_rev: | |
47 | # new branch, we don't need to extract nothing |
|
47 | # new branch, we don't need to extract nothing | |
48 | return commits |
|
48 | return commits | |
49 |
|
49 | |||
50 | git_env = dict(data['git_env']) |
|
50 | git_env = dict(data['git_env']) | |
|
51 | # https://github.com/git/git/blob/master/Documentation/pretty-formats.txt | |||
51 | cmd = [ |
|
52 | cmd = [ | |
52 | 'log', |
|
53 | 'log', | |
53 |
'--pretty=format:{"commit_id": "%H", "author": "%aN <%aE>", "date": "%ad", "message": "% |
|
54 | '--pretty=format:{"commit_id": "%H", "author": "%aN <%aE>", "date": "%ad", "message": "%s"}', | |
54 | '{}...{}'.format(old_rev, new_rev) |
|
55 | '{}...{}'.format(old_rev, new_rev) | |
55 | ] |
|
56 | ] | |
56 |
|
57 | |||
57 | stdout, stderr = repo.run_git_command(cmd, extra_env=git_env) |
|
58 | stdout, stderr = repo.run_git_command(cmd, extra_env=git_env) | |
58 | for line in stdout.splitlines(): |
|
59 | for line in stdout.splitlines(): | |
59 | try: |
|
60 | try: | |
60 | data = json.loads(line) |
|
61 | data = json.loads(line) | |
61 | commits.append(data) |
|
62 | commits.append(data) | |
62 | except Exception: |
|
63 | except Exception: | |
63 | print('Failed to load data from GIT line') |
|
64 | print('Failed to load data from GIT line') | |
64 |
|
65 | |||
65 | return commits |
|
66 | return commits | |
66 |
|
67 | |||
67 |
|
68 | |||
68 | def run(*args, **kwargs): |
|
69 | def run(*args, **kwargs): | |
69 | from rhodecode.model.db import Repository |
|
70 | from rhodecode.model.db import Repository | |
70 |
|
71 | |||
71 | vcs_type = kwargs['scm'] |
|
72 | vcs_type = kwargs['scm'] | |
72 | # use temp name then the main one propagated |
|
73 | # use temp name then the main one propagated | |
73 | repo_name = kwargs.pop('REPOSITORY', None) or kwargs['repository'] |
|
74 | repo_name = kwargs.pop('REPOSITORY', None) or kwargs['repository'] | |
74 |
|
75 | |||
75 | repo = Repository.get_by_repo_name(repo_name) |
|
76 | repo = Repository.get_by_repo_name(repo_name) | |
76 | vcs_repo = repo.scm_instance(cache=False) |
|
77 | vcs_repo = repo.scm_instance(cache=False) | |
77 |
|
78 | |||
78 | commits = [] |
|
79 | commits = [] | |
79 |
|
80 | |||
80 | if vcs_type == 'git': |
|
81 | if vcs_type == 'git': | |
81 | for rev_data in kwargs['commit_ids']: |
|
82 | for rev_data in kwargs['commit_ids']: | |
82 | new_environ = dict((k, v) for k, v in rev_data['git_env']) |
|
83 | new_environ = dict((k, v) for k, v in rev_data['git_env']) | |
83 | commits = get_git_commits(vcs_repo, kwargs['commit_ids']) |
|
84 | commits = get_git_commits(vcs_repo, kwargs['commit_ids']) | |
84 |
|
85 | |||
85 | if vcs_type == 'hg': |
|
86 | if vcs_type == 'hg': | |
86 | for rev_data in kwargs['commit_ids']: |
|
87 | for rev_data in kwargs['commit_ids']: | |
87 | new_environ = dict((k, v) for k, v in rev_data['hg_env']) |
|
88 | new_environ = dict((k, v) for k, v in rev_data['hg_env']) | |
88 | commits = get_hg_commits(vcs_repo, kwargs['commit_ids']) |
|
89 | commits = get_hg_commits(vcs_repo, kwargs['commit_ids']) | |
89 |
|
90 | |||
90 | return commits |
|
91 | return commits |
General Comments 0
You need to be logged in to leave comments.
Login now