Show More
@@ -563,6 +563,7 b' def create_repo(' | |||
|
563 | 563 | description=Optional(''), |
|
564 | 564 | private=Optional(False), |
|
565 | 565 | clone_uri=Optional(None), |
|
566 | push_uri=Optional(None), | |
|
566 | 567 | landing_rev=Optional('rev:tip'), |
|
567 | 568 | enable_statistics=Optional(False), |
|
568 | 569 | enable_locking=Optional(False), |
@@ -596,6 +597,8 b' def create_repo(' | |||
|
596 | 597 | :type private: bool |
|
597 | 598 | :param clone_uri: set clone_uri |
|
598 | 599 | :type clone_uri: str |
|
600 | :param push_uri: set push_uri | |
|
601 | :type push_uri: str | |
|
599 | 602 | :param landing_rev: <rev_type>:<rev> |
|
600 | 603 | :type landing_rev: str |
|
601 | 604 | :param enable_locking: |
@@ -639,6 +642,7 b' def create_repo(' | |||
|
639 | 642 | description = Optional.extract(description) |
|
640 | 643 | copy_permissions = Optional.extract(copy_permissions) |
|
641 | 644 | clone_uri = Optional.extract(clone_uri) |
|
645 | push_uri = Optional.extract(push_uri) | |
|
642 | 646 | landing_commit_ref = Optional.extract(landing_rev) |
|
643 | 647 | |
|
644 | 648 | defs = SettingsModel().get_default_repo_settings(strip_prefix=True) |
@@ -666,6 +670,7 b' def create_repo(' | |||
|
666 | 670 | repo_description=description, |
|
667 | 671 | repo_landing_commit_ref=landing_commit_ref, |
|
668 | 672 | repo_clone_uri=clone_uri, |
|
673 | repo_push_uri=push_uri, | |
|
669 | 674 | repo_private=private, |
|
670 | 675 | repo_copy_permissions=copy_permissions, |
|
671 | 676 | repo_enable_statistics=enable_statistics, |
@@ -684,6 +689,7 b' def create_repo(' | |||
|
684 | 689 | 'repo_description': schema_data['repo_description'], |
|
685 | 690 | 'repo_private': schema_data['repo_private'], |
|
686 | 691 | 'clone_uri': schema_data['repo_clone_uri'], |
|
692 | 'push_uri': schema_data['repo_push_uri'], | |
|
687 | 693 | 'repo_landing_rev': schema_data['repo_landing_commit_ref'], |
|
688 | 694 | 'enable_statistics': schema_data['repo_enable_statistics'], |
|
689 | 695 | 'enable_locking': schema_data['repo_enable_locking'], |
@@ -907,6 +913,7 b' def update_repo(' | |||
|
907 | 913 | repo_owner=updates['user'], |
|
908 | 914 | repo_description=updates['repo_description'], |
|
909 | 915 | repo_clone_uri=updates['clone_uri'], |
|
916 | repo_push_uri=updates['push_uri'], | |
|
910 | 917 | repo_fork_of=updates['fork_id'], |
|
911 | 918 | repo_private=updates['repo_private'], |
|
912 | 919 | repo_landing_commit_ref=updates['repo_landing_rev'], |
@@ -925,6 +932,7 b' def update_repo(' | |||
|
925 | 932 | repo_description=schema_data['repo_description'], |
|
926 | 933 | repo_private=schema_data['repo_private'], |
|
927 | 934 | clone_uri=schema_data['repo_clone_uri'], |
|
935 | push_uri=schema_data['repo_push_uri'], | |
|
928 | 936 | repo_landing_rev=schema_data['repo_landing_commit_ref'], |
|
929 | 937 | repo_enable_statistics=schema_data['repo_enable_statistics'], |
|
930 | 938 | repo_enable_locking=schema_data['repo_enable_locking'], |
@@ -373,6 +373,9 b' def includeme(config):' | |||
|
373 | 373 | config.add_route( |
|
374 | 374 | name='edit_repo_remote_pull', |
|
375 | 375 | pattern='/{repo_name:.*?[^/]}/settings/remote/pull', repo_route=True) |
|
376 | config.add_route( | |
|
377 | name='edit_repo_remote_push', | |
|
378 | pattern='/{repo_name:.*?[^/]}/settings/remote/push', repo_route=True) | |
|
376 | 379 | |
|
377 | 380 | # Statistics |
|
378 | 381 | config.add_route( |
@@ -138,15 +138,19 b' class RepoSettingsView(RepoAppView):' | |||
|
138 | 138 | repo_description=schema_data['repo_description'], |
|
139 | 139 | repo_private=schema_data['repo_private'], |
|
140 | 140 | clone_uri=schema_data['repo_clone_uri'], |
|
141 | push_uri=schema_data['repo_push_uri'], | |
|
141 | 142 | repo_landing_rev=schema_data['repo_landing_commit_ref'], |
|
142 | 143 | repo_enable_statistics=schema_data['repo_enable_statistics'], |
|
143 | 144 | repo_enable_locking=schema_data['repo_enable_locking'], |
|
144 | 145 | repo_enable_downloads=schema_data['repo_enable_downloads'], |
|
145 | 146 | ) |
|
146 |
# detect if C |
|
|
147 | # detect if SYNC URI changed, if we get OLD means we keep old values | |
|
147 | 148 | if schema_data['repo_clone_uri_change'] == 'OLD': |
|
148 | 149 | validated_updates['clone_uri'] = self.db_repo.clone_uri |
|
149 | 150 | |
|
151 | if schema_data['repo_push_uri_change'] == 'OLD': | |
|
152 | validated_updates['push_uri'] = self.db_repo.push_uri | |
|
153 | ||
|
150 | 154 | # use the new full name for redirect |
|
151 | 155 | new_repo_name = schema_data['repo_group']['repo_name_with_group'] |
|
152 | 156 |
@@ -35,8 +35,6 b' log = logging.getLogger(__name__)' | |||
|
35 | 35 | class RepoSettingsRemoteView(RepoAppView): |
|
36 | 36 | def load_default_context(self): |
|
37 | 37 | c = self._get_local_tmpl_context() |
|
38 | ||
|
39 | ||
|
40 | 38 | return c |
|
41 | 39 | |
|
42 | 40 | @LoginRequired() |
@@ -304,6 +304,7 b' class RepoModel(BaseModel):' | |||
|
304 | 304 | {'k': 'repo_enable_locking', 'strip': True}, |
|
305 | 305 | {'k': 'repo_landing_rev', 'strip': True}, |
|
306 | 306 | {'k': 'clone_uri', 'strip': False}, |
|
307 | {'k': 'push_uri', 'strip': False}, | |
|
307 | 308 | {'k': 'repo_private', 'strip': True}, |
|
308 | 309 | {'k': 'repo_enable_statistics', 'strip': True} |
|
309 | 310 | ) |
@@ -319,6 +320,8 b' class RepoModel(BaseModel):' | |||
|
319 | 320 | defaults[item['k']] = val |
|
320 | 321 | if item['k'] == 'clone_uri': |
|
321 | 322 | defaults['clone_uri_hidden'] = repo_info.clone_uri_hidden |
|
323 | if item['k'] == 'push_uri': | |
|
324 | defaults['push_uri_hidden'] = repo_info.push_uri_hidden | |
|
322 | 325 | |
|
323 | 326 | # fill owner |
|
324 | 327 | if repo_info.user: |
@@ -348,6 +351,7 b' class RepoModel(BaseModel):' | |||
|
348 | 351 | (1, 'repo_enable_locking'), |
|
349 | 352 | (1, 'repo_enable_statistics'), |
|
350 | 353 | (0, 'clone_uri'), |
|
354 | (0, 'push_uri'), | |
|
351 | 355 | (0, 'fork_id') |
|
352 | 356 | ] |
|
353 | 357 | for strip, k in update_keys: |
@@ -66,7 +66,7 b' def deferred_landing_ref_validator(node,' | |||
|
66 | 66 | |
|
67 | 67 | |
|
68 | 68 | @colander.deferred |
|
69 |
def deferred_c |
|
|
69 | def deferred_sync_uri_validator(node, kw): | |
|
70 | 70 | repo_type = kw.get('repo_type') |
|
71 | 71 | validator = validators.CloneUriValidator(repo_type) |
|
72 | 72 | return validator |
@@ -323,6 +323,12 b' class RepoSchema(colander.MappingSchema)' | |||
|
323 | 323 | preparers=[preparers.strip_preparer], |
|
324 | 324 | missing='') |
|
325 | 325 | |
|
326 | repo_push_uri = colander.SchemaNode( | |
|
327 | colander.String(), | |
|
328 | validator=colander.All(colander.Length(min=1)), | |
|
329 | preparers=[preparers.strip_preparer], | |
|
330 | missing='') | |
|
331 | ||
|
326 | 332 | repo_fork_of = colander.SchemaNode( |
|
327 | 333 | colander.String(), |
|
328 | 334 | validator=deferred_fork_of_validator, |
@@ -381,7 +387,17 b' class RepoSettingsSchema(RepoSchema):' | |||
|
381 | 387 | repo_clone_uri = colander.SchemaNode( |
|
382 | 388 | colander.String(), |
|
383 | 389 | preparers=[preparers.strip_preparer], |
|
384 |
validator=deferred_c |
|
|
390 | validator=deferred_sync_uri_validator, | |
|
391 | missing='') | |
|
392 | ||
|
393 | repo_push_uri_change = colander.SchemaNode( | |
|
394 | colander.String(), | |
|
395 | missing='NEW') | |
|
396 | ||
|
397 | repo_push_uri = colander.SchemaNode( | |
|
398 | colander.String(), | |
|
399 | preparers=[preparers.strip_preparer], | |
|
400 | validator=deferred_sync_uri_validator, | |
|
385 | 401 | missing='') |
|
386 | 402 | |
|
387 | 403 | def deserialize(self, cstruct): |
@@ -232,6 +232,7 b' function registerRCRoutes() {' | |||
|
232 | 232 | pyroutes.register('repo_edit_toggle_locking', '/%(repo_name)s/settings/toggle_locking', ['repo_name']); |
|
233 | 233 | pyroutes.register('edit_repo_remote', '/%(repo_name)s/settings/remote', ['repo_name']); |
|
234 | 234 | pyroutes.register('edit_repo_remote_pull', '/%(repo_name)s/settings/remote/pull', ['repo_name']); |
|
235 | pyroutes.register('edit_repo_remote_push', '/%(repo_name)s/settings/remote/push', ['repo_name']); | |
|
235 | 236 | pyroutes.register('edit_repo_statistics', '/%(repo_name)s/settings/statistics', ['repo_name']); |
|
236 | 237 | pyroutes.register('edit_repo_statistics_reset', '/%(repo_name)s/settings/statistics/update', ['repo_name']); |
|
237 | 238 | pyroutes.register('edit_repo_issuetracker', '/%(repo_name)s/settings/issue_trackers', ['repo_name']); |
@@ -65,7 +65,7 b'' | |||
|
65 | 65 | </li> |
|
66 | 66 | %if c.rhodecode_db_repo.repo_type != 'svn': |
|
67 | 67 | <li class="${'active' if c.active=='remote' else ''}"> |
|
68 | <a href="${h.route_path('edit_repo_remote', repo_name=c.repo_name)}">${_('Remote')}</a> | |
|
68 | <a href="${h.route_path('edit_repo_remote', repo_name=c.repo_name)}">${_('Remote sync')}</a> | |
|
69 | 69 | </li> |
|
70 | 70 | %endif |
|
71 | 71 | <li class="${'active' if c.active=='statistics' else ''}"> |
@@ -1,16 +1,22 b'' | |||
|
1 | 1 | <div class="panel panel-default"> |
|
2 | 2 | <div class="panel-heading"> |
|
3 |
<h3 class="panel-title">${_('Remote |
|
|
3 | <h3 class="panel-title">${_('Remote Sync')}</h3> | |
|
4 | 4 | </div> |
|
5 | 5 | <div class="panel-body"> |
|
6 | 6 | |
|
7 |
<h4>${_('Manually pull changes from external |
|
|
7 | <h4>${_('Manually pull/push changes from/to external URLs.')}</h4> | |
|
8 | 8 | |
|
9 | %if c.rhodecode_db_repo.clone_uri: | |
|
9 | %if c.rhodecode_db_repo.clone_uri or c.rhodecode_db_repo.push_uri: | |
|
10 | 10 | |
|
11 | ${_('Remote mirror url')}: | |
|
12 | <a href="${c.rhodecode_db_repo.clone_uri}">${c.rhodecode_db_repo.clone_uri_hidden}</a> | |
|
13 | ||
|
11 | <table> | |
|
12 | % if c.rhodecode_db_repo.clone_uri: | |
|
13 | <tr> | |
|
14 | <td><div style="min-width: 80px"><strong>${_('Pull url')}</strong></div></td> | |
|
15 | <td><a href="${c.rhodecode_db_repo.clone_uri}">${c.rhodecode_db_repo.clone_uri_hidden}</a></td> | |
|
16 | </tr> | |
|
17 | <tr> | |
|
18 | <td></td> | |
|
19 | <td> | |
|
14 | 20 | <p> |
|
15 | 21 | ${_('Pull can be automated by such api call. Can be called periodically in crontab etc.')} |
|
16 | 22 | <br/> |
@@ -18,7 +24,11 b'' | |||
|
18 | 24 | ${h.api_call_example(method='pull', args={"repoid": c.rhodecode_db_repo.repo_name})} |
|
19 | 25 | </code> |
|
20 | 26 | </p> |
|
21 | ||
|
27 | </td> | |
|
28 | </tr> | |
|
29 | <tr> | |
|
30 | <td></td> | |
|
31 | <td> | |
|
22 | 32 | ${h.secure_form(h.route_path('edit_repo_remote_pull', repo_name=c.repo_name), request=request)} |
|
23 | 33 | <div class="form"> |
|
24 | 34 | <div class="fields"> |
@@ -26,6 +36,25 b'' | |||
|
26 | 36 | </div> |
|
27 | 37 | </div> |
|
28 | 38 | ${h.end_form()} |
|
39 | </td> | |
|
40 | </tr> | |
|
41 | % endif | |
|
42 | ||
|
43 | % if c.rhodecode_db_repo.push_uri: | |
|
44 | <tr> | |
|
45 | <td><div style="min-width: 80px"><strong>${_('Push url')}</strong></div></td> | |
|
46 | <td><a href="${c.rhodecode_db_repo.push_uri_hidden}">${c.rhodecode_db_repo.push_uri_hidden}</a></td> | |
|
47 | </tr> | |
|
48 | <tr> | |
|
49 | <td></td> | |
|
50 | <td> | |
|
51 | ${_('This feature is available in RhodeCode EE edition only. Contact {sales_email} to obtain a trial license.').format(sales_email='<a href="mailto:sales@rhodecode.com">sales@rhodecode.com</a>')|n} | |
|
52 | </td> | |
|
53 | </tr> | |
|
54 | % endif | |
|
55 | ||
|
56 | </table> | |
|
57 | ||
|
29 | 58 | %else: |
|
30 | 59 | |
|
31 | 60 | ${_('This repository does not have any remote mirror url set.')} |
@@ -46,9 +46,10 b'' | |||
|
46 | 46 | </div> |
|
47 | 47 | |
|
48 | 48 | % if c.rhodecode_db_repo.repo_type != 'svn': |
|
49 | <% sync_link = h.literal(h.link_to('remote sync', h.route_path('edit_repo_remote', repo_name=c.repo_name))) %> | |
|
49 | 50 | <div class="field"> |
|
50 | 51 | <div class="label"> |
|
51 | <label for="clone_uri">${_('Remote uri')}:</label> | |
|
52 | <label for="clone_uri">${_('Remote pull uri')}:</label> | |
|
52 | 53 | </div> |
|
53 | 54 | <div class="input"> |
|
54 | 55 | %if c.rhodecode_db_repo.clone_uri: |
@@ -83,14 +84,56 b'' | |||
|
83 | 84 | ${h.hidden('repo_clone_uri_change', 'NEW')} |
|
84 | 85 | %endif |
|
85 | 86 | <p id="alter_clone_uri_help_block" class="help-block"> |
|
86 | <% pull_link = h.literal(h.link_to('remote sync', h.route_path('edit_repo_remote', repo_name=c.repo_name))) %> | |
|
87 | ${_('http[s] url where from repository was imported, this field can used for doing {pull_link}.').format(pull_link=pull_link)|n} <br/> | |
|
87 | ${_('http[s] url where from repository was imported. This field can used for doing {sync_link}.').format(sync_link=sync_link)|n} <br/> | |
|
88 | ${_('This field is stored encrypted inside Database, a format of http://user:password@server.com/repo_name can be used and will be hidden from display.')} | |
|
89 | </p> | |
|
90 | </div> | |
|
91 | </div> | |
|
92 | <div class="field"> | |
|
93 | <div class="label"> | |
|
94 | <label for="push_uri">${_('Remote push uri')}:</label> | |
|
95 | </div> | |
|
96 | <div class="input"> | |
|
97 | %if c.rhodecode_db_repo.push_uri: | |
|
98 | ## display, if we don't have any errors | |
|
99 | % if not c.form['repo_push_uri'].error: | |
|
100 | <div id="push_uri_hidden" class='text-as-placeholder'> | |
|
101 | <span id="push_uri_hidden_value">${c.rhodecode_db_repo.push_uri_hidden}</span> | |
|
102 | <span class="link" id="edit_push_uri"><i class="icon-edit"></i>${_('edit')}</span> | |
|
103 | </div> | |
|
104 | % endif | |
|
105 | ||
|
106 | ## alter field | |
|
107 | <div id="alter_push_uri" style="${'' if c.form['repo_push_uri'].error else 'display: none'}"> | |
|
108 | ${c.form['repo_push_uri'].render(css_class='medium', oid='push_uri', placeholder=_('enter new value, or leave empty to remove'))|n} | |
|
109 | ${c.form.render_error(request, c.form['repo_push_uri'])|n} | |
|
110 | % if c.form['repo_push_uri'].error: | |
|
111 | ## we got error from form subit, means we modify the url | |
|
112 | ${h.hidden('repo_push_uri_change', 'MOD')} | |
|
113 | % else: | |
|
114 | ${h.hidden('repo_push_uri_change', 'OLD')} | |
|
115 | % endif | |
|
116 | ||
|
117 | % if not c.form['repo_push_uri'].error: | |
|
118 | <span class="link" id="cancel_edit_push_uri">${_('cancel')}</span> | |
|
119 | % endif | |
|
120 | ||
|
121 | </div> | |
|
122 | %else: | |
|
123 | ## not set yet, display form to set it | |
|
124 | ${c.form['repo_push_uri'].render(css_class='medium', oid='push_uri')|n} | |
|
125 | ${c.form.render_error(request, c.form['repo_push_uri'])|n} | |
|
126 | ${h.hidden('repo_push_uri_change', 'NEW')} | |
|
127 | %endif | |
|
128 | <p id="alter_push_uri_help_block" class="help-block"> | |
|
129 | ${_('http[s] url to sync data back. This field can used for doing {sync_link}.').format(sync_link=sync_link)|n} <br/> | |
|
88 | 130 | ${_('This field is stored encrypted inside Database, a format of http://user:password@server.com/repo_name can be used and will be hidden from display.')} |
|
89 | 131 | </p> |
|
90 | 132 | </div> |
|
91 | 133 | </div> |
|
92 | 134 | % else: |
|
93 | 135 | ${h.hidden('repo_clone_uri', '')} |
|
136 | ${h.hidden('repo_push_uri', '')} | |
|
94 | 137 | % endif |
|
95 | 138 | |
|
96 | 139 | <div class="field"> |
@@ -208,15 +251,10 b'' | |||
|
208 | 251 | |
|
209 | 252 | <script> |
|
210 | 253 | $(document).ready(function(){ |
|
211 |
var cloneUrl = function( |
|
|
212 | var alterButton = $('#alter_clone_uri'); | |
|
213 | var editButton = $('#edit_clone_uri'); | |
|
214 | var cancelEditButton = $('#cancel_edit_clone_uri'); | |
|
215 | var hiddenUrl = $('#clone_uri_hidden'); | |
|
216 | var hiddenUrlValue = $('#clone_uri_hidden_value'); | |
|
217 | var input = $('#clone_uri'); | |
|
218 | var helpBlock = $('#alter_clone_uri_help_block'); | |
|
219 | var changedFlag = $('#repo_clone_uri_change'); | |
|
254 | var cloneUrl = function ( | |
|
255 | alterButton, editButton, cancelEditButton, | |
|
256 | hiddenUrl, hiddenUrlValue, input, helpBlock, changedFlag) { | |
|
257 | ||
|
220 | 258 | var originalText = helpBlock.html(); |
|
221 | 259 | var obfuscatedUrl = hiddenUrlValue.html(); |
|
222 | 260 | |
@@ -255,7 +293,32 b'' | |||
|
255 | 293 | |
|
256 | 294 | setInitialState(); |
|
257 | 295 | initEvents(); |
|
258 |
} |
|
|
296 | }; | |
|
297 | ||
|
298 | ||
|
299 | var alterButton = $('#alter_clone_uri'); | |
|
300 | var editButton = $('#edit_clone_uri'); | |
|
301 | var cancelEditButton = $('#cancel_edit_clone_uri'); | |
|
302 | var hiddenUrl = $('#clone_uri_hidden'); | |
|
303 | var hiddenUrlValue = $('#clone_uri_hidden_value'); | |
|
304 | var input = $('#clone_uri'); | |
|
305 | var helpBlock = $('#alter_clone_uri_help_block'); | |
|
306 | var changedFlag = $('#repo_clone_uri_change'); | |
|
307 | cloneUrl( | |
|
308 | alterButton, editButton, cancelEditButton, hiddenUrl, | |
|
309 | hiddenUrlValue, input, helpBlock, changedFlag); | |
|
310 | ||
|
311 | var alterButton = $('#alter_push_uri'); | |
|
312 | var editButton = $('#edit_push_uri'); | |
|
313 | var cancelEditButton = $('#cancel_edit_push_uri'); | |
|
314 | var hiddenUrl = $('#push_uri_hidden'); | |
|
315 | var hiddenUrlValue = $('#push_uri_hidden_value'); | |
|
316 | var input = $('#push_uri'); | |
|
317 | var helpBlock = $('#alter_push_uri_help_block'); | |
|
318 | var changedFlag = $('#repo_push_uri_change'); | |
|
319 | cloneUrl( | |
|
320 | alterButton, editButton, cancelEditButton, hiddenUrl, | |
|
321 | hiddenUrlValue, input, helpBlock, changedFlag); | |
|
259 | 322 | |
|
260 | 323 | selectMyGroup = function(element) { |
|
261 | 324 | $("#repo_group").val($(element).data('personalGroupId')).trigger("change"); |
General Comments 0
You need to be logged in to leave comments.
Login now