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