##// END OF EJS Templates
whitespace cleanup
marcink -
r3338:cfc0fef6 beta
parent child Browse files
Show More
@@ -1,82 +1,82 b''
1 .. _troubleshooting:
1 .. _troubleshooting:
2
2
3
3
4 ===============
4 ===============
5 Troubleshooting
5 Troubleshooting
6 ===============
6 ===============
7
7
8 :Q: **Missing static files?**
8 :Q: **Missing static files?**
9 :A: Make sure either to set the `static_files = true` in the .ini file or
9 :A: Make sure either to set the `static_files = true` in the .ini file or
10 double check the root path for your http setup. It should point to
10 double check the root path for your http setup. It should point to
11 for example:
11 for example:
12 /home/my-virtual-python/lib/python2.6/site-packages/rhodecode/public
12 /home/my-virtual-python/lib/python2.6/site-packages/rhodecode/public
13
13
14 |
14 |
15
15
16 :Q: **Can't install celery/rabbitmq?**
16 :Q: **Can't install celery/rabbitmq?**
17 :A: Don't worry RhodeCode works without them too. No extra setup is required.
17 :A: Don't worry RhodeCode works without them too. No extra setup is required.
18 Try out great celery docs for further help.
18 Try out great celery docs for further help.
19
19
20 |
20 |
21
21
22 :Q: **Long lasting push timeouts?**
22 :Q: **Long lasting push timeouts?**
23 :A: Make sure you set a longer timeouts in your proxy/fcgi settings, timeouts
23 :A: Make sure you set a longer timeouts in your proxy/fcgi settings, timeouts
24 are caused by https server and not RhodeCode.
24 are caused by https server and not RhodeCode.
25
25
26 |
26 |
27
27
28 :Q: **Large pushes timeouts?**
28 :Q: **Large pushes timeouts?**
29 :A: Make sure you set a proper max_body_size for the http server. Very often
29 :A: Make sure you set a proper max_body_size for the http server. Very often
30 Apache, Nginx or other http servers kill the connection due to to large
30 Apache, Nginx or other http servers kill the connection due to to large
31 body.
31 body.
32
32
33 |
33 |
34
34
35 :Q: **Apache doesn't pass basicAuth on pull/push?**
35 :Q: **Apache doesn't pass basicAuth on pull/push?**
36 :A: Make sure you added `WSGIPassAuthorization true`.
36 :A: Make sure you added `WSGIPassAuthorization true`.
37
37
38 |
38 |
39
39
40 :Q: **Git fails on push/pull?**
40 :Q: **Git fails on push/pull?**
41 :A: Make sure you're using an wsgi http server that can handle chunked encoding
41 :A: Make sure you're using an wsgi http server that can handle chunked encoding
42 such as `waitress` or `gunicorn`
42 such as `waitress` or `gunicorn`
43
43
44 |
44 |
45
45
46 :Q: **How i use hooks in RhodeCode?**
46 :Q: **How i use hooks in RhodeCode?**
47 :A: It's easy if they are python hooks just use advanced link in hooks section
47 :A: It's easy if they are python hooks just use advanced link in hooks section
48 in Admin panel, that works only for Mercurial. If you want to use githooks,
48 in Admin panel, that works only for Mercurial. If you want to use githooks,
49 just install proper one in repository eg. create file in
49 just install proper one in repository eg. create file in
50 `/gitrepo/hooks/pre-receive`. You can also use RhodeCode-extensions to
50 `/gitrepo/hooks/pre-receive`. You can also use RhodeCode-extensions to
51 connect to callback hooks, for both Git and Mercurial.
51 connect to callback hooks, for both Git and Mercurial.
52
52
53 |
53 |
54
54
55 :Q: **RhodeCode is slow for me, how can i make it faster?**
55 :Q: **RhodeCode is slow for me, how can i make it faster?**
56 :A: See the :ref:`performance` section
56 :A: See the :ref:`performance` section
57
57
58 |
58 |
59
59
60 :Q: **UnicodeDecodeError on Apache mod_wsgi**
60 :Q: **UnicodeDecodeError on Apache mod_wsgi**
61 :A: Please read: https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/#if-you-get-a-unicodeencodeerror
61 :A: Please read: https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/#if-you-get-a-unicodeencodeerror
62
62
63 |
63 |
64
64
65 :Q: **Requests hanging on Windows**
65 :Q: **Requests hanging on Windows**
66 :A: Please try out with disabled Antivirus software, there are some known problems with Eset Anitivirus. Make sure
66 :A: Please try out with disabled Antivirus software, there are some known problems with Eset Anitivirus. Make sure
67 you have installed latest windows patches (especially KB2789397)
67 you have installed latest windows patches (especially KB2789397)
68
68
69
69
70 For further questions search the `Issues tracker`_, or post a message in the
70 For further questions search the `Issues tracker`_, or post a message in the
71 `google group rhodecode`_
71 `google group rhodecode`_
72
72
73 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
73 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
74 .. _python: http://www.python.org/
74 .. _python: http://www.python.org/
75 .. _mercurial: http://mercurial.selenic.com/
75 .. _mercurial: http://mercurial.selenic.com/
76 .. _celery: http://celeryproject.org/
76 .. _celery: http://celeryproject.org/
77 .. _rabbitmq: http://www.rabbitmq.com/
77 .. _rabbitmq: http://www.rabbitmq.com/
78 .. _python-ldap: http://www.python-ldap.org/
78 .. _python-ldap: http://www.python-ldap.org/
79 .. _mercurial-server: http://www.lshift.net/mercurial-server.html
79 .. _mercurial-server: http://www.lshift.net/mercurial-server.html
80 .. _PublishingRepositories: http://mercurial.selenic.com/wiki/PublishingRepositories
80 .. _PublishingRepositories: http://mercurial.selenic.com/wiki/PublishingRepositories
81 .. _Issues tracker: https://bitbucket.org/marcinkuzminski/rhodecode/issues
81 .. _Issues tracker: https://bitbucket.org/marcinkuzminski/rhodecode/issues
82 .. _google group rhodecode: http://groups.google.com/group/rhodecode
82 .. _google group rhodecode: http://groups.google.com/group/rhodecode
@@ -1,34 +1,34 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.html"/>
2 <%inherit file="/base/base.html"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${_('Add repository')} - ${c.rhodecode_name}
5 ${_('Add repository')} - ${c.rhodecode_name}
6 </%def>
6 </%def>
7
7
8 <%def name="breadcrumbs_links()">
8 <%def name="breadcrumbs_links()">
9 %if c.rhodecode_user.is_admin:
9 %if c.rhodecode_user.is_admin:
10 ${h.link_to(_('Admin'),h.url('admin_home'))}
10 ${h.link_to(_('Admin'),h.url('admin_home'))}
11 &raquo;
11 &raquo;
12 ${h.link_to(_('Repositories'),h.url('repos'))}
12 ${h.link_to(_('Repositories'),h.url('repos'))}
13 %else:
13 %else:
14 ${_('Admin')}
14 ${_('Admin')}
15 &raquo;
15 &raquo;
16 ${_('Repositories')}
16 ${_('Repositories')}
17 %endif
17 %endif
18 &raquo;
18 &raquo;
19 ${_('add new')}
19 ${_('add new')}
20 </%def>
20 </%def>
21
21
22 <%def name="page_nav()">
22 <%def name="page_nav()">
23 ${self.menu('admin')}
23 ${self.menu('admin')}
24 </%def>
24 </%def>
25
25
26 <%def name="main()">
26 <%def name="main()">
27 <div class="box">
27 <div class="box">
28 <!-- box / title -->
28 <!-- box / title -->
29 <div class="title">
29 <div class="title">
30 ${self.breadcrumbs()}
30 ${self.breadcrumbs()}
31 </div>
31 </div>
32 <%include file="repo_add_base.html"/>
32 <%include file="repo_add_base.html"/>
33 </div>
33 </div>
34 </%def>
34 </%def>
@@ -1,196 +1,196 b''
1 <%inherit file="/base/base.html"/>
1 <%inherit file="/base/base.html"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${c.repo_name} ${_('New pull request')}
4 ${c.repo_name} ${_('New pull request')}
5 </%def>
5 </%def>
6
6
7 <%def name="breadcrumbs_links()">
7 <%def name="breadcrumbs_links()">
8 ${h.link_to(_(u'Home'),h.url('/'))}
8 ${h.link_to(_(u'Home'),h.url('/'))}
9 &raquo;
9 &raquo;
10 ${h.link_to(c.repo_name,h.url('changelog_home',repo_name=c.repo_name))}
10 ${h.link_to(c.repo_name,h.url('changelog_home',repo_name=c.repo_name))}
11 &raquo;
11 &raquo;
12 ${_('New pull request')}
12 ${_('New pull request')}
13 </%def>
13 </%def>
14
14
15 <%def name="main()">
15 <%def name="main()">
16
16
17 <div class="box">
17 <div class="box">
18 <!-- box / title -->
18 <!-- box / title -->
19 <div class="title">
19 <div class="title">
20 ${self.breadcrumbs()}
20 ${self.breadcrumbs()}
21 </div>
21 </div>
22 ${h.form(url('pullrequest', repo_name=c.repo_name), method='post', id='pull_request_form')}
22 ${h.form(url('pullrequest', repo_name=c.repo_name), method='post', id='pull_request_form')}
23 <div style="float:left;padding:0px 30px 30px 30px">
23 <div style="float:left;padding:0px 30px 30px 30px">
24 <input type="hidden" name="rev_start" value="${request.GET.get('rev_start')}" />
24 <input type="hidden" name="rev_start" value="${request.GET.get('rev_start')}" />
25 <input type="hidden" name="rev_end" value="${request.GET.get('rev_end')}" />
25 <input type="hidden" name="rev_end" value="${request.GET.get('rev_end')}" />
26
26
27 ##ORG
27 ##ORG
28 <div style="float:left">
28 <div style="float:left">
29 <div>
29 <div>
30 <span style="font-size: 20px">
30 <span style="font-size: 20px">
31 ${h.select('org_repo','',c.org_repos,class_='refs')}:${h.select('org_ref',c.default_org_ref,c.org_refs,class_='refs')}
31 ${h.select('org_repo','',c.org_repos,class_='refs')}:${h.select('org_ref',c.default_org_ref,c.org_refs,class_='refs')}
32 </span>
32 </span>
33 <div style="padding:5px 3px 3px 42px;">${c.rhodecode_db_repo.description}</div>
33 <div style="padding:5px 3px 3px 42px;">${c.rhodecode_db_repo.description}</div>
34 </div>
34 </div>
35 <div style="clear:both;padding-top: 10px"></div>
35 <div style="clear:both;padding-top: 10px"></div>
36 </div>
36 </div>
37 <div style="float:left;font-size:24px;padding:0px 20px">
37 <div style="float:left;font-size:24px;padding:0px 20px">
38 <img height=32 width=32 src="${h.url('/images/arrow_right_64.png')}"/>
38 <img height=32 width=32 src="${h.url('/images/arrow_right_64.png')}"/>
39 </div>
39 </div>
40
40
41 ##OTHER, most Probably the PARENT OF THIS FORK
41 ##OTHER, most Probably the PARENT OF THIS FORK
42 <div style="float:left">
42 <div style="float:left">
43 <div>
43 <div>
44 <span style="font-size: 20px">
44 <span style="font-size: 20px">
45 ${h.select('other_repo',c.default_other_repo,c.other_repos,class_='refs')}:${h.select('other_ref',c.default_other_ref,c.default_other_refs,class_='refs')}
45 ${h.select('other_repo',c.default_other_repo,c.other_repos,class_='refs')}:${h.select('other_ref',c.default_other_ref,c.default_other_refs,class_='refs')}
46 </span>
46 </span>
47 <div id="other_repo_desc" style="padding:5px 3px 3px 42px;"></div>
47 <div id="other_repo_desc" style="padding:5px 3px 3px 42px;"></div>
48 </div>
48 </div>
49 <div style="clear:both;padding-top: 10px"></div>
49 <div style="clear:both;padding-top: 10px"></div>
50 </div>
50 </div>
51 <div style="clear:both;padding-top: 10px"></div>
51 <div style="clear:both;padding-top: 10px"></div>
52 ## overview pulled by ajax
52 ## overview pulled by ajax
53 <div style="float:left" id="pull_request_overview"></div>
53 <div style="float:left" id="pull_request_overview"></div>
54 <div style="float:left;clear:both;padding:10px 10px 10px 0px;display:none">
54 <div style="float:left;clear:both;padding:10px 10px 10px 0px;display:none">
55 <a id="pull_request_overview_url" href="#">${_('Detailed compare view')}</a>
55 <a id="pull_request_overview_url" href="#">${_('Detailed compare view')}</a>
56 </div>
56 </div>
57 </div>
57 </div>
58 <div style="float:left; border-left:1px dashed #eee">
58 <div style="float:left; border-left:1px dashed #eee">
59 <h4>${_('Pull request reviewers')}</h4>
59 <h4>${_('Pull request reviewers')}</h4>
60 <div id="reviewers" style="padding:0px 0px 0px 15px">
60 <div id="reviewers" style="padding:0px 0px 0px 15px">
61 ## members goes here !
61 ## members goes here !
62 <div class="group_members_wrap">
62 <div class="group_members_wrap">
63 <ul id="review_members" class="group_members">
63 <ul id="review_members" class="group_members">
64 %for member in c.review_members:
64 %for member in c.review_members:
65 <li id="reviewer_${member.user_id}">
65 <li id="reviewer_${member.user_id}">
66 <div class="reviewers_member">
66 <div class="reviewers_member">
67 <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(member.email,14)}"/> </div>
67 <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(member.email,14)}"/> </div>
68 <div style="float:left">${member.full_name} (${_('owner')})</div>
68 <div style="float:left">${member.full_name} (${_('owner')})</div>
69 <input type="hidden" value="${member.user_id}" name="review_members" />
69 <input type="hidden" value="${member.user_id}" name="review_members" />
70 <span class="delete_icon action_button" onclick="removeReviewer(${member.user_id})"></span>
70 <span class="delete_icon action_button" onclick="removeReviewer(${member.user_id})"></span>
71 </div>
71 </div>
72 </li>
72 </li>
73 %endfor
73 %endfor
74 </ul>
74 </ul>
75 </div>
75 </div>
76
76
77 <div class='ac'>
77 <div class='ac'>
78 <div class="reviewer_ac">
78 <div class="reviewer_ac">
79 ${h.text('user', class_='yui-ac-input')}
79 ${h.text('user', class_='yui-ac-input')}
80 <span class="help-block">${_('Add reviewer to this pull request.')}</span>
80 <span class="help-block">${_('Add reviewer to this pull request.')}</span>
81 <div id="reviewers_container"></div>
81 <div id="reviewers_container"></div>
82 </div>
82 </div>
83 </div>
83 </div>
84 </div>
84 </div>
85 </div>
85 </div>
86 <h3>${_('Create new pull request')}</h3>
86 <h3>${_('Create new pull request')}</h3>
87
87
88 <div class="form">
88 <div class="form">
89 <!-- fields -->
89 <!-- fields -->
90
90
91 <div class="fields">
91 <div class="fields">
92
92
93 <div class="field">
93 <div class="field">
94 <div class="label">
94 <div class="label">
95 <label for="pullrequest_title">${_('Title')}:</label>
95 <label for="pullrequest_title">${_('Title')}:</label>
96 </div>
96 </div>
97 <div class="input">
97 <div class="input">
98 ${h.text('pullrequest_title',size=30)}
98 ${h.text('pullrequest_title',size=30)}
99 </div>
99 </div>
100 </div>
100 </div>
101
101
102 <div class="field">
102 <div class="field">
103 <div class="label label-textarea">
103 <div class="label label-textarea">
104 <label for="pullrequest_desc">${_('description')}:</label>
104 <label for="pullrequest_desc">${_('description')}:</label>
105 </div>
105 </div>
106 <div class="textarea text-area editor">
106 <div class="textarea text-area editor">
107 ${h.textarea('pullrequest_desc',size=30)}
107 ${h.textarea('pullrequest_desc',size=30)}
108 </div>
108 </div>
109 </div>
109 </div>
110
110
111 <div class="buttons">
111 <div class="buttons">
112 ${h.submit('save',_('Send pull request'),class_="ui-btn large")}
112 ${h.submit('save',_('Send pull request'),class_="ui-btn large")}
113 ${h.reset('reset',_('Reset'),class_="ui-btn large")}
113 ${h.reset('reset',_('Reset'),class_="ui-btn large")}
114 </div>
114 </div>
115 </div>
115 </div>
116 </div>
116 </div>
117 ${h.end_form()}
117 ${h.end_form()}
118
118
119 </div>
119 </div>
120
120
121 <script type="text/javascript">
121 <script type="text/javascript">
122 var _USERS_AC_DATA = ${c.users_array|n};
122 var _USERS_AC_DATA = ${c.users_array|n};
123 var _GROUPS_AC_DATA = ${c.users_groups_array|n};
123 var _GROUPS_AC_DATA = ${c.users_groups_array|n};
124 PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
124 PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
125
125
126 var other_repos_info = ${c.other_repos_info|n};
126 var other_repos_info = ${c.other_repos_info|n};
127
127
128 var loadPreview = function(){
128 var loadPreview = function(){
129 YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display','none');
129 YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display','none');
130 //url template
130 //url template
131 var url = "${h.url('compare_url',
131 var url = "${h.url('compare_url',
132 repo_name='__other_repo__',
132 repo_name='__other_repo__',
133 org_ref_type='__other_ref_type__',
133 org_ref_type='__other_ref_type__',
134 org_ref='__other_ref__',
134 org_ref='__other_ref__',
135 other_repo='__org_repo__',
135 other_repo='__org_repo__',
136 other_ref_type='__org_ref_type__',
136 other_ref_type='__org_ref_type__',
137 other_ref='__org_ref__',
137 other_ref='__org_ref__',
138 as_form=True,
138 as_form=True,
139 rev_start=request.GET.get('rev_start',''),
139 rev_start=request.GET.get('rev_start',''),
140 rev_end=request.GET.get('rev_end',''))}";
140 rev_end=request.GET.get('rev_end',''))}";
141 var org_repo = YUQ('#pull_request_form #org_repo')[0].value;
141 var org_repo = YUQ('#pull_request_form #org_repo')[0].value;
142 var org_ref = YUQ('#pull_request_form #org_ref')[0].value.split(':');
142 var org_ref = YUQ('#pull_request_form #org_ref')[0].value.split(':');
143
143
144 var other_repo = YUQ('#pull_request_form #other_repo')[0].value;
144 var other_repo = YUQ('#pull_request_form #other_repo')[0].value;
145 var other_ref = YUQ('#pull_request_form #other_ref')[0].value.split(':');
145 var other_ref = YUQ('#pull_request_form #other_ref')[0].value.split(':');
146
146
147 var select_refs = YUQ('#pull_request_form select.refs')
147 var select_refs = YUQ('#pull_request_form select.refs')
148 var rev_data = {
148 var rev_data = {
149 'org_repo': org_repo,
149 'org_repo': org_repo,
150 'org_ref': org_ref[1],
150 'org_ref': org_ref[1],
151 'org_ref_type': org_ref[0],
151 'org_ref_type': org_ref[0],
152 'other_repo': other_repo,
152 'other_repo': other_repo,
153 'other_ref': other_ref[1],
153 'other_ref': other_ref[1],
154 'other_ref_type': other_ref[0],
154 'other_ref_type': other_ref[0],
155 }; // gather the org/other ref and repo here
155 }; // gather the org/other ref and repo here
156
156
157 for (k in rev_data){
157 for (k in rev_data){
158 url = url.replace('__'+k+'__',rev_data[k]);
158 url = url.replace('__'+k+'__',rev_data[k]);
159 }
159 }
160
160
161 ypjax(url,'pull_request_overview', function(data){
161 ypjax(url,'pull_request_overview', function(data){
162 var sel_box = YUQ('#pull_request_form #other_repo')[0];
162 var sel_box = YUQ('#pull_request_form #other_repo')[0];
163 var repo_name = sel_box.options[sel_box.selectedIndex].value;
163 var repo_name = sel_box.options[sel_box.selectedIndex].value;
164 YUD.get('pull_request_overview_url').href = url;
164 YUD.get('pull_request_overview_url').href = url;
165 YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display','');
165 YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display','');
166 YUD.get('other_repo_gravatar').src = other_repos_info[repo_name]['gravatar'];
166 YUD.get('other_repo_gravatar').src = other_repos_info[repo_name]['gravatar'];
167 YUD.get('other_repo_desc').innerHTML = other_repos_info[repo_name]['description'];
167 YUD.get('other_repo_desc').innerHTML = other_repos_info[repo_name]['description'];
168 YUD.get('other_ref').innerHTML = other_repos_info[repo_name]['revs'];
168 YUD.get('other_ref').innerHTML = other_repos_info[repo_name]['revs'];
169 // select back the revision that was just compared
169 // select back the revision that was just compared
170 setSelectValue(YUD.get('other_ref'), rev_data['other_ref']);
170 setSelectValue(YUD.get('other_ref'), rev_data['other_ref']);
171 })
171 })
172 }
172 }
173
173
174 ## refresh automatically when something changes (org_repo can't change)
174 ## refresh automatically when something changes (org_repo can't change)
175
175
176 YUE.on('org_ref', 'change', function(e){
176 YUE.on('org_ref', 'change', function(e){
177 loadPreview();
177 loadPreview();
178 });
178 });
179
179
180 YUE.on('other_repo', 'change', function(e){
180 YUE.on('other_repo', 'change', function(e){
181 var repo_name = e.currentTarget.value;
181 var repo_name = e.currentTarget.value;
182 // replace the <select> of changed repo
182 // replace the <select> of changed repo
183 YUD.get('other_ref').innerHTML = other_repos_info[repo_name]['revs'];
183 YUD.get('other_ref').innerHTML = other_repos_info[repo_name]['revs'];
184 loadPreview();
184 loadPreview();
185 });
185 });
186
186
187 YUE.on('other_ref', 'change', function(e){
187 YUE.on('other_ref', 'change', function(e){
188 loadPreview();
188 loadPreview();
189 });
189 });
190
190
191 //lazy load overview after 0.5s
191 //lazy load overview after 0.5s
192 setTimeout(loadPreview, 500)
192 setTimeout(loadPreview, 500)
193
193
194 </script>
194 </script>
195
195
196 </%def>
196 </%def>
@@ -1,469 +1,469 b''
1 from rhodecode.tests import *
1 from rhodecode.tests import *
2 from rhodecode.model.repo import RepoModel
2 from rhodecode.model.repo import RepoModel
3 from rhodecode.model.meta import Session
3 from rhodecode.model.meta import Session
4 from rhodecode.model.db import Repository
4 from rhodecode.model.db import Repository
5 from rhodecode.model.scm import ScmModel
5 from rhodecode.model.scm import ScmModel
6 from rhodecode.lib.vcs.backends.base import EmptyChangeset
6 from rhodecode.lib.vcs.backends.base import EmptyChangeset
7
7
8
8
9 def _fork_repo(fork_name, vcs_type, parent=None):
9 def _fork_repo(fork_name, vcs_type, parent=None):
10 if vcs_type =='hg':
10 if vcs_type =='hg':
11 _REPO = HG_REPO
11 _REPO = HG_REPO
12 elif vcs_type == 'git':
12 elif vcs_type == 'git':
13 _REPO = GIT_REPO
13 _REPO = GIT_REPO
14
14
15 if parent:
15 if parent:
16 _REPO = parent
16 _REPO = parent
17
17
18 form_data = dict(
18 form_data = dict(
19 repo_name=fork_name,
19 repo_name=fork_name,
20 repo_name_full=fork_name,
20 repo_name_full=fork_name,
21 repo_group=None,
21 repo_group=None,
22 repo_type=vcs_type,
22 repo_type=vcs_type,
23 description='',
23 description='',
24 private=False,
24 private=False,
25 copy_permissions=False,
25 copy_permissions=False,
26 landing_rev='tip',
26 landing_rev='tip',
27 update_after_clone=False,
27 update_after_clone=False,
28 fork_parent_id=Repository.get_by_repo_name(_REPO),
28 fork_parent_id=Repository.get_by_repo_name(_REPO),
29 )
29 )
30 repo = RepoModel().create_fork(form_data, cur_user=TEST_USER_ADMIN_LOGIN)
30 repo = RepoModel().create_fork(form_data, cur_user=TEST_USER_ADMIN_LOGIN)
31
31
32 Session().commit()
32 Session().commit()
33 return Repository.get_by_repo_name(fork_name)
33 return Repository.get_by_repo_name(fork_name)
34
34
35
35
36 def _commit_change(repo, filename, content, message, vcs_type, parent=None, newfile=False):
36 def _commit_change(repo, filename, content, message, vcs_type, parent=None, newfile=False):
37 repo = Repository.get_by_repo_name(repo)
37 repo = Repository.get_by_repo_name(repo)
38 _cs = parent
38 _cs = parent
39 if not parent:
39 if not parent:
40 _cs = EmptyChangeset(alias=vcs_type)
40 _cs = EmptyChangeset(alias=vcs_type)
41
41
42 if newfile:
42 if newfile:
43 cs = ScmModel().create_node(
43 cs = ScmModel().create_node(
44 repo=repo.scm_instance, repo_name=repo.repo_name,
44 repo=repo.scm_instance, repo_name=repo.repo_name,
45 cs=_cs, user=TEST_USER_ADMIN_LOGIN,
45 cs=_cs, user=TEST_USER_ADMIN_LOGIN,
46 author=TEST_USER_ADMIN_LOGIN,
46 author=TEST_USER_ADMIN_LOGIN,
47 message=message,
47 message=message,
48 content=content,
48 content=content,
49 f_path=filename
49 f_path=filename
50 )
50 )
51 else:
51 else:
52 cs = ScmModel().commit_change(
52 cs = ScmModel().commit_change(
53 repo=repo.scm_instance, repo_name=repo.repo_name,
53 repo=repo.scm_instance, repo_name=repo.repo_name,
54 cs=parent, user=TEST_USER_ADMIN_LOGIN,
54 cs=parent, user=TEST_USER_ADMIN_LOGIN,
55 author=TEST_USER_ADMIN_LOGIN,
55 author=TEST_USER_ADMIN_LOGIN,
56 message=message,
56 message=message,
57 content=content,
57 content=content,
58 f_path=filename
58 f_path=filename
59 )
59 )
60 return cs
60 return cs
61
61
62
62
63 class TestCompareController(TestController):
63 class TestCompareController(TestController):
64
64
65 def test_compare_forks_on_branch_extra_commits_hg(self):
65 def test_compare_forks_on_branch_extra_commits_hg(self):
66 self.log_user()
66 self.log_user()
67
67
68 repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg',
68 repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg',
69 description='diff-test',
69 description='diff-test',
70 owner=TEST_USER_ADMIN_LOGIN)
70 owner=TEST_USER_ADMIN_LOGIN)
71 r1_id = repo1.repo_id
71 r1_id = repo1.repo_id
72 Session().commit()
72 Session().commit()
73 #commit something !
73 #commit something !
74 cs0 = _commit_change(repo1.repo_name, filename='file1', content='line1\n',
74 cs0 = _commit_change(repo1.repo_name, filename='file1', content='line1\n',
75 message='commit1', vcs_type='hg', parent=None, newfile=True)
75 message='commit1', vcs_type='hg', parent=None, newfile=True)
76
76
77 #fork this repo
77 #fork this repo
78 repo2 = _fork_repo('one-fork', 'hg', parent='one')
78 repo2 = _fork_repo('one-fork', 'hg', parent='one')
79 Session().commit()
79 Session().commit()
80 r2_id = repo2.repo_id
80 r2_id = repo2.repo_id
81
81
82 #add two extra commit into fork
82 #add two extra commit into fork
83 cs1 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\n',
83 cs1 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\n',
84 message='commit2', vcs_type='hg', parent=cs0)
84 message='commit2', vcs_type='hg', parent=cs0)
85
85
86 cs2 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\nline3\n',
86 cs2 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\nline3\n',
87 message='commit3', vcs_type='hg', parent=cs1)
87 message='commit3', vcs_type='hg', parent=cs1)
88
88
89 rev1 = 'default'
89 rev1 = 'default'
90 rev2 = 'default'
90 rev2 = 'default'
91
91
92
92
93 try:
93 try:
94 response = self.app.get(url(controller='compare', action='index',
94 response = self.app.get(url(controller='compare', action='index',
95 repo_name=repo1.repo_name,
95 repo_name=repo1.repo_name,
96 org_ref_type="branch",
96 org_ref_type="branch",
97 org_ref=rev2,
97 org_ref=rev2,
98 other_repo=repo2.repo_name,
98 other_repo=repo2.repo_name,
99 other_ref_type="branch",
99 other_ref_type="branch",
100 other_ref=rev1,
100 other_ref=rev1,
101 ))
101 ))
102
102
103 response.mustcontain('%s@%s -&gt; %s@%s' % (repo1.repo_name, rev2, repo2.repo_name, rev1))
103 response.mustcontain('%s@%s -&gt; %s@%s' % (repo1.repo_name, rev2, repo2.repo_name, rev1))
104 response.mustcontain("""Showing 2 commits""")
104 response.mustcontain("""Showing 2 commits""")
105 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
105 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
106
106
107 response.mustcontain("""<div class="message tooltip" title="commit2" style="white-space:normal">commit2</div>""")
107 response.mustcontain("""<div class="message tooltip" title="commit2" style="white-space:normal">commit2</div>""")
108 response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""")
108 response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""")
109
109
110 response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
110 response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
111 response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
111 response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
112 ## files
112 ## files
113 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s#C--826e8142e6ba">file1</a>""" % (repo1.repo_name, rev2, rev1, repo2.repo_name))
113 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s#C--826e8142e6ba">file1</a>""" % (repo1.repo_name, rev2, rev1, repo2.repo_name))
114 #swap
114 #swap
115 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?as_form=None&amp;other_repo=%s">[swap]</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
115 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?as_form=None&amp;other_repo=%s">[swap]</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
116 finally:
116 finally:
117 RepoModel().delete(r2_id)
117 RepoModel().delete(r2_id)
118 RepoModel().delete(r1_id)
118 RepoModel().delete(r1_id)
119
119
120 def test_compare_forks_on_branch_extra_commits_origin_has_incomming_hg(self):
120 def test_compare_forks_on_branch_extra_commits_origin_has_incomming_hg(self):
121 self.log_user()
121 self.log_user()
122
122
123 repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg',
123 repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg',
124 description='diff-test',
124 description='diff-test',
125 owner=TEST_USER_ADMIN_LOGIN)
125 owner=TEST_USER_ADMIN_LOGIN)
126 r1_id = repo1.repo_id
126 r1_id = repo1.repo_id
127 Session().commit()
127 Session().commit()
128 #commit something !
128 #commit something !
129 cs0 = _commit_change(repo1.repo_name, filename='file1', content='line1\n',
129 cs0 = _commit_change(repo1.repo_name, filename='file1', content='line1\n',
130 message='commit1', vcs_type='hg', parent=None, newfile=True)
130 message='commit1', vcs_type='hg', parent=None, newfile=True)
131
131
132 #fork this repo
132 #fork this repo
133 repo2 = _fork_repo('one-fork', 'hg', parent='one')
133 repo2 = _fork_repo('one-fork', 'hg', parent='one')
134 Session().commit()
134 Session().commit()
135
135
136 #now commit something to origin repo
136 #now commit something to origin repo
137 cs1_prim = _commit_change(repo1.repo_name, filename='file2', content='line1file2\n',
137 cs1_prim = _commit_change(repo1.repo_name, filename='file2', content='line1file2\n',
138 message='commit2', vcs_type='hg', parent=cs0, newfile=True)
138 message='commit2', vcs_type='hg', parent=cs0, newfile=True)
139
139
140 r2_id = repo2.repo_id
140 r2_id = repo2.repo_id
141
141
142 #add two extra commit into fork
142 #add two extra commit into fork
143 cs1 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\n',
143 cs1 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\n',
144 message='commit2', vcs_type='hg', parent=cs0)
144 message='commit2', vcs_type='hg', parent=cs0)
145
145
146 cs2 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\nline3\n',
146 cs2 = _commit_change(repo2.repo_name, filename='file1', content='line1\nline2\nline3\n',
147 message='commit3', vcs_type='hg', parent=cs1)
147 message='commit3', vcs_type='hg', parent=cs1)
148
148
149 rev1 = 'default'
149 rev1 = 'default'
150 rev2 = 'default'
150 rev2 = 'default'
151
151
152 try:
152 try:
153 response = self.app.get(url(controller='compare', action='index',
153 response = self.app.get(url(controller='compare', action='index',
154 repo_name=repo1.repo_name,
154 repo_name=repo1.repo_name,
155 org_ref_type="branch",
155 org_ref_type="branch",
156 org_ref=rev2,
156 org_ref=rev2,
157 other_repo=repo2.repo_name,
157 other_repo=repo2.repo_name,
158 other_ref_type="branch",
158 other_ref_type="branch",
159 other_ref=rev1,
159 other_ref=rev1,
160 ))
160 ))
161 response.mustcontain('%s@%s -&gt; %s@%s' % (repo1.repo_name, rev2, repo2.repo_name, rev1))
161 response.mustcontain('%s@%s -&gt; %s@%s' % (repo1.repo_name, rev2, repo2.repo_name, rev1))
162 response.mustcontain("""Showing 2 commits""")
162 response.mustcontain("""Showing 2 commits""")
163 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
163 response.mustcontain("""1 file changed with 2 insertions and 0 deletions""")
164
164
165 response.mustcontain("""<div class="message tooltip" title="commit2" style="white-space:normal">commit2</div>""")
165 response.mustcontain("""<div class="message tooltip" title="commit2" style="white-space:normal">commit2</div>""")
166 response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""")
166 response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""")
167
167
168 response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
168 response.mustcontain("""<a href="/%s/changeset/%s">r1:%s</a>""" % (repo2.repo_name, cs1.raw_id, cs1.short_id))
169 response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
169 response.mustcontain("""<a href="/%s/changeset/%s">r2:%s</a>""" % (repo2.repo_name, cs2.raw_id, cs2.short_id))
170 ## files
170 ## files
171 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s#C--826e8142e6ba">file1</a>""" % (repo1.repo_name, rev2, rev1, repo2.repo_name))
171 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?other_repo=%s#C--826e8142e6ba">file1</a>""" % (repo1.repo_name, rev2, rev1, repo2.repo_name))
172 #swap
172 #swap
173 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?as_form=None&amp;other_repo=%s">[swap]</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
173 response.mustcontain("""<a href="/%s/compare/branch@%s...branch@%s?as_form=None&amp;other_repo=%s">[swap]</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
174 finally:
174 finally:
175 RepoModel().delete(r2_id)
175 RepoModel().delete(r2_id)
176 RepoModel().delete(r1_id)
176 RepoModel().delete(r1_id)
177
177
178 def test_compare_cherry_pick_changesets_from_bottom(self):
178 def test_compare_cherry_pick_changesets_from_bottom(self):
179 """
179 """
180 repo1:
180 repo1:
181 cs1:
181 cs1:
182 cs2:
182 cs2:
183 repo1-fork- in which we will cherry pick bottom changesets
183 repo1-fork- in which we will cherry pick bottom changesets
184 cs1:
184 cs1:
185 cs2:
185 cs2:
186 cs3: x
186 cs3: x
187 cs4: x
187 cs4: x
188 cs5: x
188 cs5: x
189 cs6:
189 cs6:
190 """
190 """
191 #make repo1, and cs1+cs2
191 #make repo1, and cs1+cs2
192 self.log_user()
192 self.log_user()
193
193
194 repo1 = RepoModel().create_repo(repo_name='repo1', repo_type='hg',
194 repo1 = RepoModel().create_repo(repo_name='repo1', repo_type='hg',
195 description='diff-test',
195 description='diff-test',
196 owner=TEST_USER_ADMIN_LOGIN)
196 owner=TEST_USER_ADMIN_LOGIN)
197 r1_id = repo1.repo_id
197 r1_id = repo1.repo_id
198 Session().commit()
198 Session().commit()
199 #commit something !
199 #commit something !
200 cs1 = _commit_change(repo1.repo_name, filename='file1', content='line1\n',
200 cs1 = _commit_change(repo1.repo_name, filename='file1', content='line1\n',
201 message='commit1', vcs_type='hg', parent=None,
201 message='commit1', vcs_type='hg', parent=None,
202 newfile=True)
202 newfile=True)
203 cs2 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\n',
203 cs2 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\n',
204 message='commit2', vcs_type='hg', parent=cs1)
204 message='commit2', vcs_type='hg', parent=cs1)
205 #fork this repo
205 #fork this repo
206 repo2 = _fork_repo('repo1-fork', 'hg', parent='repo1')
206 repo2 = _fork_repo('repo1-fork', 'hg', parent='repo1')
207 Session().commit()
207 Session().commit()
208 r2_id = repo1.repo_id
208 r2_id = repo1.repo_id
209 #now make cs3-6
209 #now make cs3-6
210 cs3 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\n',
210 cs3 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\n',
211 message='commit3', vcs_type='hg', parent=cs2)
211 message='commit3', vcs_type='hg', parent=cs2)
212 cs4 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\nline4\n',
212 cs4 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\nline4\n',
213 message='commit4', vcs_type='hg', parent=cs3)
213 message='commit4', vcs_type='hg', parent=cs3)
214 cs5 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\nline4\nline5\n',
214 cs5 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\nline4\nline5\n',
215 message='commit5', vcs_type='hg', parent=cs4)
215 message='commit5', vcs_type='hg', parent=cs4)
216 cs6 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\nline4\nline5\nline6\n',
216 cs6 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\nline4\nline5\nline6\n',
217 message='commit6', vcs_type='hg', parent=cs5)
217 message='commit6', vcs_type='hg', parent=cs5)
218
218
219 rev1 = 'tip'
219 rev1 = 'tip'
220 rev2 = 'tip'
220 rev2 = 'tip'
221
221
222 try:
222 try:
223 response = self.app.get(url(controller='compare', action='index',
223 response = self.app.get(url(controller='compare', action='index',
224 repo_name=repo2.repo_name,
224 repo_name=repo2.repo_name,
225 org_ref_type="tag",
225 org_ref_type="tag",
226 org_ref=rev1,
226 org_ref=rev1,
227 other_repo=repo1.repo_name,
227 other_repo=repo1.repo_name,
228 other_ref_type="tag",
228 other_ref_type="tag",
229 other_ref=rev2,
229 other_ref=rev2,
230 rev_start=cs3.raw_id,
230 rev_start=cs3.raw_id,
231 rev_end=cs5.raw_id,
231 rev_end=cs5.raw_id,
232 ))
232 ))
233 response.mustcontain('%s@%s -&gt; %s@%s' % (repo2.repo_name, rev1, repo1.repo_name, rev2))
233 response.mustcontain('%s@%s -&gt; %s@%s' % (repo2.repo_name, rev1, repo1.repo_name, rev2))
234 response.mustcontain("""Showing 3 commits""")
234 response.mustcontain("""Showing 3 commits""")
235 response.mustcontain("""1 file changed with 3 insertions and 0 deletions""")
235 response.mustcontain("""1 file changed with 3 insertions and 0 deletions""")
236
236
237 response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""")
237 response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit3</div>""")
238 response.mustcontain("""<div class="message tooltip" title="commit4" style="white-space:normal">commit4</div>""")
238 response.mustcontain("""<div class="message tooltip" title="commit4" style="white-space:normal">commit4</div>""")
239 response.mustcontain("""<div class="message tooltip" title="commit5" style="white-space:normal">commit5</div>""")
239 response.mustcontain("""<div class="message tooltip" title="commit5" style="white-space:normal">commit5</div>""")
240
240
241 response.mustcontain("""<a href="/%s/changeset/%s">r3:%s</a>""" % (repo2.repo_name, cs3.raw_id, cs3.short_id))
241 response.mustcontain("""<a href="/%s/changeset/%s">r3:%s</a>""" % (repo2.repo_name, cs3.raw_id, cs3.short_id))
242 response.mustcontain("""<a href="/%s/changeset/%s">r4:%s</a>""" % (repo2.repo_name, cs4.raw_id, cs4.short_id))
242 response.mustcontain("""<a href="/%s/changeset/%s">r4:%s</a>""" % (repo2.repo_name, cs4.raw_id, cs4.short_id))
243 response.mustcontain("""<a href="/%s/changeset/%s">r5:%s</a>""" % (repo2.repo_name, cs5.raw_id, cs5.short_id))
243 response.mustcontain("""<a href="/%s/changeset/%s">r5:%s</a>""" % (repo2.repo_name, cs5.raw_id, cs5.short_id))
244 ## files
244 ## files
245 response.mustcontain("""<a href="/%s/compare/tag@%s...tag@%s?other_repo=%s#C--826e8142e6ba">file1</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
245 response.mustcontain("""<a href="/%s/compare/tag@%s...tag@%s?other_repo=%s#C--826e8142e6ba">file1</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
246 #swap
246 #swap
247 response.mustcontain("""<a href="/%s/compare/tag@%s...tag@%s?as_form=None&amp;other_repo=%s">[swap]</a>""" % (repo1.repo_name, rev1, rev2, repo2.repo_name))
247 response.mustcontain("""<a href="/%s/compare/tag@%s...tag@%s?as_form=None&amp;other_repo=%s">[swap]</a>""" % (repo1.repo_name, rev1, rev2, repo2.repo_name))
248 finally:
248 finally:
249 RepoModel().delete(r2_id)
249 RepoModel().delete(r2_id)
250 RepoModel().delete(r1_id)
250 RepoModel().delete(r1_id)
251
251
252 def test_compare_cherry_pick_changesets_from_top(self):
252 def test_compare_cherry_pick_changesets_from_top(self):
253 """
253 """
254 repo1:
254 repo1:
255 cs1:
255 cs1:
256 cs2:
256 cs2:
257 repo1-fork- in which we will cherry pick bottom changesets
257 repo1-fork- in which we will cherry pick bottom changesets
258 cs1:
258 cs1:
259 cs2:
259 cs2:
260 cs3:
260 cs3:
261 cs4: x
261 cs4: x
262 cs5: x
262 cs5: x
263 cs6: x
263 cs6: x
264 """
264 """
265 #make repo1, and cs1+cs2
265 #make repo1, and cs1+cs2
266 self.log_user()
266 self.log_user()
267
267
268 repo1 = RepoModel().create_repo(repo_name='repo1', repo_type='hg',
268 repo1 = RepoModel().create_repo(repo_name='repo1', repo_type='hg',
269 description='diff-test',
269 description='diff-test',
270 owner=TEST_USER_ADMIN_LOGIN)
270 owner=TEST_USER_ADMIN_LOGIN)
271 r1_id = repo1.repo_id
271 r1_id = repo1.repo_id
272 Session().commit()
272 Session().commit()
273 #commit something !
273 #commit something !
274 cs1 = _commit_change(repo1.repo_name, filename='file1', content='line1\n',
274 cs1 = _commit_change(repo1.repo_name, filename='file1', content='line1\n',
275 message='commit1', vcs_type='hg', parent=None,
275 message='commit1', vcs_type='hg', parent=None,
276 newfile=True)
276 newfile=True)
277 cs2 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\n',
277 cs2 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\n',
278 message='commit2', vcs_type='hg', parent=cs1)
278 message='commit2', vcs_type='hg', parent=cs1)
279 #fork this repo
279 #fork this repo
280 repo2 = _fork_repo('repo1-fork', 'hg', parent='repo1')
280 repo2 = _fork_repo('repo1-fork', 'hg', parent='repo1')
281 Session().commit()
281 Session().commit()
282 r2_id = repo1.repo_id
282 r2_id = repo1.repo_id
283 #now make cs3-6
283 #now make cs3-6
284 cs3 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\n',
284 cs3 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\n',
285 message='commit3', vcs_type='hg', parent=cs2)
285 message='commit3', vcs_type='hg', parent=cs2)
286 cs4 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\nline4\n',
286 cs4 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\nline4\n',
287 message='commit4', vcs_type='hg', parent=cs3)
287 message='commit4', vcs_type='hg', parent=cs3)
288 cs5 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\nline4\nline5\n',
288 cs5 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\nline4\nline5\n',
289 message='commit5', vcs_type='hg', parent=cs4)
289 message='commit5', vcs_type='hg', parent=cs4)
290 cs6 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\nline4\nline5\nline6\n',
290 cs6 = _commit_change(repo1.repo_name, filename='file1', content='line1\nline2\nline3\nline4\nline5\nline6\n',
291 message='commit6', vcs_type='hg', parent=cs5)
291 message='commit6', vcs_type='hg', parent=cs5)
292
292
293 rev1 = 'tip'
293 rev1 = 'tip'
294 rev2 = 'tip'
294 rev2 = 'tip'
295
295
296 try:
296 try:
297 response = self.app.get(url(controller='compare', action='index',
297 response = self.app.get(url(controller='compare', action='index',
298 repo_name=repo2.repo_name,
298 repo_name=repo2.repo_name,
299 org_ref_type="tag",
299 org_ref_type="tag",
300 org_ref=rev1,
300 org_ref=rev1,
301 other_repo=repo1.repo_name,
301 other_repo=repo1.repo_name,
302 other_ref_type="tag",
302 other_ref_type="tag",
303 other_ref=rev2,
303 other_ref=rev2,
304 rev_start=cs4.raw_id,
304 rev_start=cs4.raw_id,
305 rev_end=cs6.raw_id,
305 rev_end=cs6.raw_id,
306 ))
306 ))
307
307
308 response.mustcontain('%s@%s -&gt; %s@%s' % (repo2.repo_name, rev1, repo1.repo_name, rev2))
308 response.mustcontain('%s@%s -&gt; %s@%s' % (repo2.repo_name, rev1, repo1.repo_name, rev2))
309 response.mustcontain("""Showing 3 commits""")
309 response.mustcontain("""Showing 3 commits""")
310 response.mustcontain("""1 file changed with 3 insertions and 0 deletions""")
310 response.mustcontain("""1 file changed with 3 insertions and 0 deletions""")
311
311
312 response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit4</div>""")
312 response.mustcontain("""<div class="message tooltip" title="commit3" style="white-space:normal">commit4</div>""")
313 response.mustcontain("""<div class="message tooltip" title="commit4" style="white-space:normal">commit5</div>""")
313 response.mustcontain("""<div class="message tooltip" title="commit4" style="white-space:normal">commit5</div>""")
314 response.mustcontain("""<div class="message tooltip" title="commit5" style="white-space:normal">commit6</div>""")
314 response.mustcontain("""<div class="message tooltip" title="commit5" style="white-space:normal">commit6</div>""")
315
315
316 response.mustcontain("""<a href="/%s/changeset/%s">r4:%s</a>""" % (repo2.repo_name, cs4.raw_id, cs4.short_id))
316 response.mustcontain("""<a href="/%s/changeset/%s">r4:%s</a>""" % (repo2.repo_name, cs4.raw_id, cs4.short_id))
317 response.mustcontain("""<a href="/%s/changeset/%s">r5:%s</a>""" % (repo2.repo_name, cs5.raw_id, cs5.short_id))
317 response.mustcontain("""<a href="/%s/changeset/%s">r5:%s</a>""" % (repo2.repo_name, cs5.raw_id, cs5.short_id))
318 response.mustcontain("""<a href="/%s/changeset/%s">r6:%s</a>""" % (repo2.repo_name, cs6.raw_id, cs6.short_id))
318 response.mustcontain("""<a href="/%s/changeset/%s">r6:%s</a>""" % (repo2.repo_name, cs6.raw_id, cs6.short_id))
319 ## files
319 ## files
320 response.mustcontain("""<a href="/%s/compare/tag@%s...tag@%s?other_repo=%s#C--826e8142e6ba">file1</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
320 response.mustcontain("""<a href="/%s/compare/tag@%s...tag@%s?other_repo=%s#C--826e8142e6ba">file1</a>""" % (repo2.repo_name, rev1, rev2, repo1.repo_name))
321 #swap
321 #swap
322 response.mustcontain("""<a href="/%s/compare/tag@%s...tag@%s?as_form=None&amp;other_repo=%s">[swap]</a>""" % (repo1.repo_name, rev1, rev2, repo2.repo_name))
322 response.mustcontain("""<a href="/%s/compare/tag@%s...tag@%s?as_form=None&amp;other_repo=%s">[swap]</a>""" % (repo1.repo_name, rev1, rev2, repo2.repo_name))
323 finally:
323 finally:
324 RepoModel().delete(r2_id)
324 RepoModel().delete(r2_id)
325 RepoModel().delete(r1_id)
325 RepoModel().delete(r1_id)
326
326
327 def test_compare_cherry_pick_changeset_mixed_branches(self):
327 def test_compare_cherry_pick_changeset_mixed_branches(self):
328 """
328 """
329
329
330 """
330 """
331 pass
331 pass
332 #TODO write this tastecase
332 #TODO write this tastecase
333
333
334 def test_compare_remote_branches_hg(self):
334 def test_compare_remote_branches_hg(self):
335 self.log_user()
335 self.log_user()
336
336
337 _fork_repo(HG_FORK, 'hg')
337 _fork_repo(HG_FORK, 'hg')
338
338
339 rev1 = '56349e29c2af'
339 rev1 = '56349e29c2af'
340 rev2 = '7d4bc8ec6be5'
340 rev2 = '7d4bc8ec6be5'
341
341
342 try:
342 try:
343 response = self.app.get(url(controller='compare', action='index',
343 response = self.app.get(url(controller='compare', action='index',
344 repo_name=HG_REPO,
344 repo_name=HG_REPO,
345 org_ref_type="rev",
345 org_ref_type="rev",
346 org_ref=rev1,
346 org_ref=rev1,
347 other_ref_type="rev",
347 other_ref_type="rev",
348 other_ref=rev2,
348 other_ref=rev2,
349 other_repo=HG_FORK,
349 other_repo=HG_FORK,
350 ))
350 ))
351 response.mustcontain('%s@%s -&gt; %s@%s' % (HG_REPO, rev1, HG_FORK, rev2))
351 response.mustcontain('%s@%s -&gt; %s@%s' % (HG_REPO, rev1, HG_FORK, rev2))
352 ## outgoing changesets between those revisions
352 ## outgoing changesets between those revisions
353
353
354 response.mustcontain("""<a href="/%s/changeset/2dda4e345facb0ccff1a191052dd1606dba6781d">r4:2dda4e345fac</a>""" % (HG_REPO))
354 response.mustcontain("""<a href="/%s/changeset/2dda4e345facb0ccff1a191052dd1606dba6781d">r4:2dda4e345fac</a>""" % (HG_REPO))
355 response.mustcontain("""<a href="/%s/changeset/6fff84722075f1607a30f436523403845f84cd9e">r5:6fff84722075</a>""" % (HG_REPO))
355 response.mustcontain("""<a href="/%s/changeset/6fff84722075f1607a30f436523403845f84cd9e">r5:6fff84722075</a>""" % (HG_REPO))
356 response.mustcontain("""<a href="/%s/changeset/7d4bc8ec6be56c0f10425afb40b6fc315a4c25e7">r6:%s</a>""" % (HG_REPO, rev2))
356 response.mustcontain("""<a href="/%s/changeset/7d4bc8ec6be56c0f10425afb40b6fc315a4c25e7">r6:%s</a>""" % (HG_REPO, rev2))
357
357
358 ## files
358 ## files
359 response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--9c390eb52cd6">vcs/backends/hg.py</a>""" % (HG_REPO, rev1, rev2))
359 response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--9c390eb52cd6">vcs/backends/hg.py</a>""" % (HG_REPO, rev1, rev2))
360 response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--41b41c1f2796">vcs/backends/__init__.py</a>""" % (HG_REPO, rev1, rev2))
360 response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--41b41c1f2796">vcs/backends/__init__.py</a>""" % (HG_REPO, rev1, rev2))
361 response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--2f574d260608">vcs/backends/base.py</a>""" % (HG_REPO, rev1, rev2))
361 response.mustcontain("""<a href="/%s/compare/rev@%s...rev@%s#C--2f574d260608">vcs/backends/base.py</a>""" % (HG_REPO, rev1, rev2))
362 finally:
362 finally:
363 RepoModel().delete(HG_FORK)
363 RepoModel().delete(HG_FORK)
364
364
365 def test_org_repo_new_commits_after_forking_simple_diff(self):
365 def test_org_repo_new_commits_after_forking_simple_diff(self):
366 self.log_user()
366 self.log_user()
367
367
368 repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg',
368 repo1 = RepoModel().create_repo(repo_name='one', repo_type='hg',
369 description='diff-test',
369 description='diff-test',
370 owner=TEST_USER_ADMIN_LOGIN)
370 owner=TEST_USER_ADMIN_LOGIN)
371
371
372 Session().commit()
372 Session().commit()
373 r1_id = repo1.repo_id
373 r1_id = repo1.repo_id
374 r1_name = repo1.repo_name
374 r1_name = repo1.repo_name
375
375
376 #commit something initially !
376 #commit something initially !
377 cs0 = ScmModel().create_node(
377 cs0 = ScmModel().create_node(
378 repo=repo1.scm_instance, repo_name=r1_name,
378 repo=repo1.scm_instance, repo_name=r1_name,
379 cs=EmptyChangeset(alias='hg'), user=TEST_USER_ADMIN_LOGIN,
379 cs=EmptyChangeset(alias='hg'), user=TEST_USER_ADMIN_LOGIN,
380 author=TEST_USER_ADMIN_LOGIN,
380 author=TEST_USER_ADMIN_LOGIN,
381 message='commit1',
381 message='commit1',
382 content='line1',
382 content='line1',
383 f_path='file1'
383 f_path='file1'
384 )
384 )
385 Session().commit()
385 Session().commit()
386 self.assertEqual(repo1.scm_instance.revisions, [cs0.raw_id])
386 self.assertEqual(repo1.scm_instance.revisions, [cs0.raw_id])
387 #fork the repo1
387 #fork the repo1
388 repo2 = RepoModel().create_repo(repo_name='one-fork', repo_type='hg',
388 repo2 = RepoModel().create_repo(repo_name='one-fork', repo_type='hg',
389 description='compare-test',
389 description='compare-test',
390 clone_uri=repo1.repo_full_path,
390 clone_uri=repo1.repo_full_path,
391 owner=TEST_USER_ADMIN_LOGIN, fork_of='one')
391 owner=TEST_USER_ADMIN_LOGIN, fork_of='one')
392 Session().commit()
392 Session().commit()
393 self.assertEqual(repo2.scm_instance.revisions, [cs0.raw_id])
393 self.assertEqual(repo2.scm_instance.revisions, [cs0.raw_id])
394 r2_id = repo2.repo_id
394 r2_id = repo2.repo_id
395 r2_name = repo2.repo_name
395 r2_name = repo2.repo_name
396
396
397 #make 3 new commits in fork
397 #make 3 new commits in fork
398 cs1 = ScmModel().create_node(
398 cs1 = ScmModel().create_node(
399 repo=repo2.scm_instance, repo_name=r2_name,
399 repo=repo2.scm_instance, repo_name=r2_name,
400 cs=repo2.scm_instance[-1], user=TEST_USER_ADMIN_LOGIN,
400 cs=repo2.scm_instance[-1], user=TEST_USER_ADMIN_LOGIN,
401 author=TEST_USER_ADMIN_LOGIN,
401 author=TEST_USER_ADMIN_LOGIN,
402 message='commit1-fork',
402 message='commit1-fork',
403 content='file1-line1-from-fork',
403 content='file1-line1-from-fork',
404 f_path='file1-fork'
404 f_path='file1-fork'
405 )
405 )
406 cs2 = ScmModel().create_node(
406 cs2 = ScmModel().create_node(
407 repo=repo2.scm_instance, repo_name=r2_name,
407 repo=repo2.scm_instance, repo_name=r2_name,
408 cs=cs1, user=TEST_USER_ADMIN_LOGIN,
408 cs=cs1, user=TEST_USER_ADMIN_LOGIN,
409 author=TEST_USER_ADMIN_LOGIN,
409 author=TEST_USER_ADMIN_LOGIN,
410 message='commit2-fork',
410 message='commit2-fork',
411 content='file2-line1-from-fork',
411 content='file2-line1-from-fork',
412 f_path='file2-fork'
412 f_path='file2-fork'
413 )
413 )
414 cs3 = ScmModel().create_node(
414 cs3 = ScmModel().create_node(
415 repo=repo2.scm_instance, repo_name=r2_name,
415 repo=repo2.scm_instance, repo_name=r2_name,
416 cs=cs2, user=TEST_USER_ADMIN_LOGIN,
416 cs=cs2, user=TEST_USER_ADMIN_LOGIN,
417 author=TEST_USER_ADMIN_LOGIN,
417 author=TEST_USER_ADMIN_LOGIN,
418 message='commit3-fork',
418 message='commit3-fork',
419 content='file3-line1-from-fork',
419 content='file3-line1-from-fork',
420 f_path='file3-fork'
420 f_path='file3-fork'
421 )
421 )
422
422
423 #compare !
423 #compare !
424 rev1 = 'default'
424 rev1 = 'default'
425 rev2 = 'default'
425 rev2 = 'default'
426
426
427 try:
427 try:
428 response = self.app.get(url(controller='compare', action='index',
428 response = self.app.get(url(controller='compare', action='index',
429 repo_name=r2_name,
429 repo_name=r2_name,
430 org_ref_type="branch",
430 org_ref_type="branch",
431 org_ref=rev1,
431 org_ref=rev1,
432 other_ref_type="branch",
432 other_ref_type="branch",
433 other_ref=rev2,
433 other_ref=rev2,
434 repo=r1_name,
434 repo=r1_name,
435 ))
435 ))
436 #response.mustcontain('%s@%s -&gt; %s@%s' % (r2_name, rev1, r1_name, rev2))
436 #response.mustcontain('%s@%s -&gt; %s@%s' % (r2_name, rev1, r1_name, rev2))
437
437
438 #add new commit into parent !
438 #add new commit into parent !
439 cs0 = ScmModel().create_node(
439 cs0 = ScmModel().create_node(
440 repo=repo1.scm_instance, repo_name=r1_name,
440 repo=repo1.scm_instance, repo_name=r1_name,
441 cs=EmptyChangeset(alias='hg'), user=TEST_USER_ADMIN_LOGIN,
441 cs=EmptyChangeset(alias='hg'), user=TEST_USER_ADMIN_LOGIN,
442 author=TEST_USER_ADMIN_LOGIN,
442 author=TEST_USER_ADMIN_LOGIN,
443 message='commit2',
443 message='commit2',
444 content='line1',
444 content='line1',
445 f_path='file2'
445 f_path='file2'
446 )
446 )
447 #compare !
447 #compare !
448 rev1 = 'default'
448 rev1 = 'default'
449 rev2 = 'default'
449 rev2 = 'default'
450 response = self.app.get(url(controller='compare', action='index',
450 response = self.app.get(url(controller='compare', action='index',
451 repo_name=r2_name,
451 repo_name=r2_name,
452 org_ref_type="branch",
452 org_ref_type="branch",
453 org_ref=rev1,
453 org_ref=rev1,
454 other_ref_type="branch",
454 other_ref_type="branch",
455 other_ref=rev2,
455 other_ref=rev2,
456 repo=r1_name,
456 repo=r1_name,
457 bundle=False
457 bundle=False
458 ))
458 ))
459
459
460 response.mustcontain('%s@%s -&gt; %s@%s' % (r2_name, rev1, r1_name, rev2))
460 response.mustcontain('%s@%s -&gt; %s@%s' % (r2_name, rev1, r1_name, rev2))
461 response.mustcontain("""file1-line1-from-fork""")
461 response.mustcontain("""file1-line1-from-fork""")
462 response.mustcontain("""file2-line1-from-fork""")
462 response.mustcontain("""file2-line1-from-fork""")
463 response.mustcontain("""file3-line1-from-fork""")
463 response.mustcontain("""file3-line1-from-fork""")
464 self.assertFalse("""<a href="#">file2</a>""" in response.body) # new commit from parent
464 self.assertFalse("""<a href="#">file2</a>""" in response.body) # new commit from parent
465 self.assertFalse("""line1-from-new-parent""" in response.body)
465 self.assertFalse("""line1-from-new-parent""" in response.body)
466 finally:
466 finally:
467 RepoModel().delete(r2_id)
467 RepoModel().delete(r2_id)
468 RepoModel().delete(r1_id)
468 RepoModel().delete(r1_id)
469 Session()
469 Session()
General Comments 0
You need to be logged in to leave comments. Login now