##// END OF EJS Templates
git: fix pull request deletion - don't crash on deleting refs to PR heads...
Anton Schur -
r8393:a9bcdc43 stable
parent child Browse files
Show More
@@ -3,6 +3,7 b' List of contributors to Kallithea projec'
3 Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> 2014-2020
3 Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> 2014-2020
4 Mads Kiilerich <mads@kiilerich.com> 2016-2020
4 Mads Kiilerich <mads@kiilerich.com> 2016-2020
5 Asterios Dimitriou <steve@pci.gr> 2016-2017 2020
5 Asterios Dimitriou <steve@pci.gr> 2016-2017 2020
6 Anton Schur <tonich.sh@gmail.com> 2017 2020
6 Private <adamantine.sword@gmail.com> 2019-2020
7 Private <adamantine.sword@gmail.com> 2019-2020
7 David Ignjić <ignjic@gmail.com> 2020
8 David Ignjić <ignjic@gmail.com> 2020
8 Dennis Fink <dennis.fink@c3l.lu> 2020
9 Dennis Fink <dennis.fink@c3l.lu> 2020
@@ -41,7 +42,6 b' List of contributors to Kallithea projec'
41 Søren Løvborg <sorenl@unity3d.com> 2015-2017
42 Søren Løvborg <sorenl@unity3d.com> 2015-2017
42 Sam Jaques <sam.jaques@me.com> 2015 2017
43 Sam Jaques <sam.jaques@me.com> 2015 2017
43 Alessandro Molina <alessandro.molina@axant.it> 2017
44 Alessandro Molina <alessandro.molina@axant.it> 2017
44 Anton Schur <tonich.sh@gmail.com> 2017
45 Ching-Chen Mao <mao@lins.fju.edu.tw> 2017
45 Ching-Chen Mao <mao@lins.fju.edu.tw> 2017
46 Eivind Tagseth <eivindt@gmail.com> 2017
46 Eivind Tagseth <eivindt@gmail.com> 2017
47 FUJIWARA Katsunori <foozy@lares.dti.ne.jp> 2017
47 FUJIWARA Katsunori <foozy@lares.dti.ne.jp> 2017
@@ -139,7 +139,7 b' class PullRequestModel(object):'
139 if pull_request.org_repo.scm_instance.alias == 'git':
139 if pull_request.org_repo.scm_instance.alias == 'git':
140 # remove a ref under refs/pull/ so that commits can be garbage-collected
140 # remove a ref under refs/pull/ so that commits can be garbage-collected
141 try:
141 try:
142 del pull_request.org_repo.scm_instance._repo["refs/pull/%d/head" % pull_request.pull_request_id]
142 del pull_request.org_repo.scm_instance._repo[b"refs/pull/%d/head" % pull_request.pull_request_id]
143 except KeyError:
143 except KeyError:
144 pass
144 pass
145
145
@@ -28,6 +28,7 b''
28 <li>Copyright &copy; 2014&ndash;2020, Thomas De Schampheleire</li>
28 <li>Copyright &copy; 2014&ndash;2020, Thomas De Schampheleire</li>
29 <li>Copyright &copy; 2015&ndash;2017, 2019&ndash;2020, Étienne Gilli</li>
29 <li>Copyright &copy; 2015&ndash;2017, 2019&ndash;2020, Étienne Gilli</li>
30 <li>Copyright &copy; 2016&ndash;2017, 2020, Asterios Dimitriou</li>
30 <li>Copyright &copy; 2016&ndash;2017, 2020, Asterios Dimitriou</li>
31 <li>Copyright &copy; 2017, 2020, Anton Schur</li>
31 <li>Copyright &copy; 2019&ndash;2020, Private</li>
32 <li>Copyright &copy; 2019&ndash;2020, Private</li>
32 <li>Copyright &copy; 2020, David Ignjić</li>
33 <li>Copyright &copy; 2020, David Ignjić</li>
33 <li>Copyright &copy; 2020, Dennis Fink</li>
34 <li>Copyright &copy; 2020, Dennis Fink</li>
@@ -63,7 +64,6 b''
63 <li>Copyright &copy; 2015&ndash;2017, Søren Løvborg</li>
64 <li>Copyright &copy; 2015&ndash;2017, Søren Løvborg</li>
64 <li>Copyright &copy; 2015, 2017, Sam Jaques</li>
65 <li>Copyright &copy; 2015, 2017, Sam Jaques</li>
65 <li>Copyright &copy; 2017, Alessandro Molina</li>
66 <li>Copyright &copy; 2017, Alessandro Molina</li>
66 <li>Copyright &copy; 2017, Anton Schur</li>
67 <li>Copyright &copy; 2017, Ching-Chen Mao</li>
67 <li>Copyright &copy; 2017, Ching-Chen Mao</li>
68 <li>Copyright &copy; 2017, Eivind Tagseth</li>
68 <li>Copyright &copy; 2017, Eivind Tagseth</li>
69 <li>Copyright &copy; 2017, FUJIWARA Katsunori</li>
69 <li>Copyright &copy; 2017, FUJIWARA Katsunori</li>
@@ -32,12 +32,25 b' class TestPullrequestsController(base.Te'
32 '_session_csrf_secret_token': self.session_csrf_secret_token(),
32 '_session_csrf_secret_token': self.session_csrf_secret_token(),
33 },
33 },
34 status=302)
34 status=302)
35 # will redirect to URL like http://localhost/vcs_test_hg/pull-request/1/_/stable
36 pull_request_id = int(response.location.split('/')[5])
37
35 response = response.follow()
38 response = response.follow()
36 assert response.status == '200 OK'
39 assert response.status == '200 OK'
37 response.mustcontain('Successfully opened new pull request')
40 response.mustcontain('Successfully opened new pull request')
38 response.mustcontain('No additional changesets found for iterating on this pull request')
41 response.mustcontain('No additional changesets found for iterating on this pull request')
39 response.mustcontain('href="/vcs_test_hg/changeset/4f7e2131323e0749a740c0a56ab68ae9269c562a"')
42 response.mustcontain('href="/vcs_test_hg/changeset/4f7e2131323e0749a740c0a56ab68ae9269c562a"')
40
43
44 response = self.app.post(base.url('pullrequest_delete',
45 repo_name=base.HG_REPO, pull_request_id=pull_request_id),
46 {
47 '_session_csrf_secret_token': self.session_csrf_secret_token(),
48 },
49 status=302)
50 response = response.follow()
51 assert response.status == '200 OK'
52 response.mustcontain('Successfully deleted pull request')
53
41 def test_available(self):
54 def test_available(self):
42 self.log_user()
55 self.log_user()
43 response = self.app.post(base.url(controller='pullrequests', action='create',
56 response = self.app.post(base.url(controller='pullrequests', action='create',
@@ -31,11 +31,25 b' class TestPullrequestsController(base.Te'
31 '_session_csrf_secret_token': self.session_csrf_secret_token(),
31 '_session_csrf_secret_token': self.session_csrf_secret_token(),
32 },
32 },
33 status=302)
33 status=302)
34 # will redirect to URL like http://localhost/vcs_test_git/pull-request/1/_/master
35 pull_request_id = int(response.location.split('/')[5])
36
34 response = response.follow()
37 response = response.follow()
35 assert response.status == '200 OK'
38 assert response.status == '200 OK'
36 response.mustcontain('Successfully opened new pull request')
39 response.mustcontain('Successfully opened new pull request')
37 response.mustcontain('Git pull requests don&#39;t support iterating yet.')
40 response.mustcontain('Git pull requests don&#39;t support iterating yet.')
38
41
42 response = self.app.post(base.url('pullrequest_delete',
43 repo_name=base.GIT_REPO, pull_request_id=pull_request_id),
44 {
45 '_session_csrf_secret_token': self.session_csrf_secret_token(),
46 },
47 status=302)
48 response = response.follow()
49 assert response.status == '200 OK'
50 response.mustcontain('Successfully deleted pull request')
51
52
39 def test_edit_with_invalid_reviewer(self):
53 def test_edit_with_invalid_reviewer(self):
40 invalid_user_id = 99999
54 invalid_user_id = 99999
41 self.log_user()
55 self.log_user()
General Comments 0
You need to be logged in to leave comments. Login now