From d36a3553e23b3798b8978864f73faf059d1d3ee0 Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Jul 10 2018 07:38:27 +0000 Subject: [PATCH 1/3] Re-style the compare commits page This restyles the compare commits page, removing the tabbed interface, and general style updates. Signed-off-by: Ryan Lerch --- diff --git a/pagure/templates/repo_comparecommits.html b/pagure/templates/repo_comparecommits.html index d8d835b..16764a3 100644 --- a/pagure/templates/repo_comparecommits.html +++ b/pagure/templates/repo_comparecommits.html @@ -17,123 +17,117 @@ {% endblock %} {% block repo %} -

Diff - (tree)

-
{{ commit1 }} .. {{ commit2 }}
- - - -
-
- - - -
- -
-
- {% for commit in diff_commits %} - - {% if pull_request and pull_request.status and pull_request.project_from.is_fork %} - {% set commit_link = url_for( - 'ui_ns.view_commit', - repo=pull_request.project_from.name, - username=pull_request.project_from.user.user, - namespace=repo.namespace, - commitid=commit.oid.hex)%} - {% set tree_link = url_for( - 'ui_ns.view_tree', username=pull_request.project_from.user.user, namespace=repo.namespace, - repo=repo.name, identifier=commit.hex) %} - {% elif pull_request and pull_request.remote %} - {% set commit_link = None %} - {% else %} - {% set commit_link = url_for('ui_ns.view_commit', - repo=repo.name, - username=username, - namespace=repo.namespace, - commitid=commit.oid.hex) %} - {% set tree_link = url_for( - 'ui_ns.view_tree', username=username, namespace=repo.namespace, - repo=repo.name, identifier=commit.hex) %} - {% endif %} -
-
-
- {% if commit_link %} - - {% endif %} - {{ commit.message.strip().split('\n')[0] }} - {% if commit_link %} - - {% endif %} -
- {{commit.author|author2user_commits( - link=url_for('ui_ns.view_commits', - repo=repo.name, - branchname=branchname, - username=username, - namespace=repo.namespace, - author=commit.author.email), - cssclass="notblue")|safe}} - • - {{ commit.commit_time|humanize }}   -
-
- +
+
+ {% block overviewtabs %}{{ super() }}{% endblock %} +
+
+

+
+
+ Commit Diff +
+
+
+ {{diff.stats.files_changed}} file{{'s' if diff.stats.files_changed > 1 }} changed
+
+
+ +{{diff.stats.insertions}} + -{{diff.stats.deletions}} +
+
+
+ {{ commit1 }} + .. + {{ commit2 }} +
+

+
+ {% for commit in diff_commits %} + {% if pull_request and pull_request.status and pull_request.project_from.is_fork %} + {% set commit_link = url_for( + 'ui_ns.view_commit', + repo=pull_request.project_from.name, + username=pull_request.project_from.user.user, + namespace=repo.namespace, + commitid=commit.oid.hex)%} + {% set tree_link = url_for( + 'ui_ns.view_tree', username=pull_request.project_from.user.user, namespace=repo.namespace, + repo=repo.name, identifier=commit.hex) %} + {% elif pull_request and pull_request.remote %} + {% set commit_link = None %} + {% else %} + {% set commit_link = url_for('ui_ns.view_commit', + repo=repo.name, + username=username, + namespace=repo.namespace, + commitid=commit.oid.hex) %} + {% set tree_link = url_for( + 'ui_ns.view_tree', username=username, namespace=repo.namespace, + repo=repo.name, identifier=commit.hex) %} + {% endif %} + {% if not loop.last and loop.index == 2 %} + + {% endif %} + {% if loop.first or loop.last%} +
+ {% else %} + + {% endfor %} +
+
+
+
+ + {{repo_renderdiff(diff=diff, + diff_commits=diff_commits, + pull_request=None, + repo=repo, + username=username, + namespace=namespace)}} + +
+
+
- -
- - {{repo_renderdiff(diff=diff, - diff_commits=diff_commits, - pull_request=None, - repo=repo, - username=username, - namespace=namespace)}} - -
-
-
{% endblock %} @@ -141,9 +135,12 @@ {{ super() }} diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index bce65c5..19d22d9 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -460,7 +460,7 @@ def compare_commits(repo, commit1, commit2, username=None, namespace=None): return flask.render_template( 'repo_comparecommits.html', - select='logs', + select='commits', origin='compare_commits', repo=repo, username=username, diff --git a/tests/test_pagure_flask_ui_repo.py b/tests/test_pagure_flask_ui_repo.py index 8ab08cd..69413f1 100644 --- a/tests/test_pagure_flask_ui_repo.py +++ b/tests/test_pagure_flask_ui_repo.py @@ -2049,14 +2049,11 @@ class PagureFlaskRepotests(tests.Modeltests): % (c2.oid.hex, c1.oid.hex), output_text) self.assertIn( - '
%s .. %s
' - % (c2.oid.hex, c1.oid.hex), + ' %s\n ..\n %s\n' % + (c2.oid.hex, c1.oid.hex), output_text) - self.assertIn( - 'Commits \n ' + - '' + - '\n 2\n ', + self.assertNotIn( + 'id="show_hidden_commits"', output_text) self.assertIn( '- ' + @@ -2069,14 +2066,11 @@ class PagureFlaskRepotests(tests.Modeltests): 'Diff from %s to %s - test\n - Pagure' % (c1.oid.hex, c2.oid.hex), output_text) - self.assertIn( - 'Commits \n ' + - '' + - '\n 2\n ', + self.assertNotIn( + 'id="show_hidden_commits"', output_text) self.assertIn( - '
%s .. %s
' % + ' %s\n ..\n %s\n' % (c1.oid.hex, c2.oid.hex), output_text) self.assertIn( @@ -2092,7 +2086,7 @@ class PagureFlaskRepotests(tests.Modeltests): 'Diff from %s to %s - test\n - Pagure' % (c1.oid.hex, c3.oid.hex), output_text) self.assertIn( - '
%s .. %s
' % + ' %s\n ..\n %s\n' % (c1.oid.hex, c3.oid.hex), output_text) self.assertIn( @@ -2103,10 +2097,7 @@ class PagureFlaskRepotests(tests.Modeltests): '+ Row 0'), 2) self.assertIn( - 'Commits \n ' + - '' + - '\n 3\n ', + '1 more commits...', output_text) self.assertIn( 'title="View file as of 4829cf">Šource', @@ -2125,7 +2116,7 @@ class PagureFlaskRepotests(tests.Modeltests): 'Diff from %s to %s - test\n - Pagure' % (c3.oid.hex, c1.oid.hex), output_text) self.assertIn( - '
%s .. %s
' % + ' %s\n ..\n %s\n' % (c3.oid.hex, c1.oid.hex), output_text) self.assertIn( @@ -2135,10 +2126,7 @@ class PagureFlaskRepotests(tests.Modeltests): '- ' + 'Row 0', output_text) self.assertIn( - 'Commits \n ' + - '' + - '\n 3\n ', + '1 more commits...', output_text) self.assertIn( 'title="View file as of 000000">Šource', From ee7650a189e9e7bf51f7fd6a2f21346111913b0a Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Jul 10 2018 07:38:27 +0000 Subject: [PATCH 2/3] style the new pull request page Fixes #3379 Signed-off-by: Ryan Lerch --- diff --git a/pagure/templates/repo_new_pull_request.html b/pagure/templates/repo_new_pull_request.html index d92da05..f466870 100644 --- a/pagure/templates/repo_new_pull_request.html +++ b/pagure/templates/repo_new_pull_request.html @@ -26,21 +26,36 @@ {% block repo %} -{% if form and (g.repo_committer or remote_git) %} -

Create pull request

-{% else %} -

Diff - (tree)

- - {% if origin == 'compare_commits' %} -
{{ commit1 }} .. {{ commit2 }}
- {% endif %} -{% endif%} +

+
+
+ {% if form and (g.repo_committer or remote_git) %} + Create Pull Request + {% else %} + Diff + {% endif%} +
+
+
+ {% if diff %} + {{diff_commits | length}} commit{{'s' if diff_commits | length > 1 }}, + {{diff.stats.files_changed}} file{{'s' if diff.stats.files_changed > 1 }} changed + {% else %} + no changes + {% endif %} +
+
+
+ {% if diff %} + +{{diff.stats.insertions}} + -{{diff.stats.deletions}} + {% else %} + +0 + -0 + {% endif %} +
+
+

@@ -68,79 +83,142 @@ {% endif %}
Pull from - {% - if remote_git -%}{{ remote_git }}{%- - else -%} - {{ repo.fullname }} {%- - endif -%} + + {%- if remote_git -%} + {{ remote_git }} + {%- else -%} + {%- if repo.is_fork -%} +   + {%- else -%} +   + {%- endif -%} + {%- if repo.namespace -%} + {{repo.namespace}}/ + {%- endif -%} + {%- if repo.is_fork -%} + {{ repo.user.user }}/ + {%- endif -%} + {{repo.name}} + {%- endif -%} + + + + {{ branch_from }} + + + to + + + {%- if parent.is_fork -%} +   + {%- else -%} +   + {%- endif -%} + {%- if parent.namespace -%} + {{parent.namespace}}/ + {%- endif -%} + {%- if parent.is_fork -%} + {{ parent.user.user }}/ + {%- endif -%} + {{parent.name}} - - - + - into - - - {#{ parent.fullname }#} - -   - +
{% if contributing %}
{{ contributing | markdown | noJS | safe}}
{% endif %} - {{ render_bootstrap_field(form.title) }} -
- - - Preview - - {{ form.initial_comment(class_="form-control")|safe }} -
- - {% if form.initial_comment.errors %} - - - {% for error in form.initial_comment.errors %} - {{ error }}  - {% endfor %} - - - {% endif %} -
- -
-

- - {{ form.csrf_token }} - - Cancel - -

+ + +
+ {{ form.title(class_="form-control", placeholder="Pull Request Title", required="required")|safe }} + {% if form.title.errors %} + + + {% for error in form.title.errors %} + {{ error }}  + {% endfor %} + + + {% endif %} + +
+
+
+
+
+
+ +
+
+
+
+ + {% if form.initial_comment.errors %} + + + {% for error in form.initial_comment.errors %} + {{ error }}  + {% endfor %} + + + {% endif %} +
+
+
+ +
+ {{ form.csrf_token }} +
+ + {% endif %} @@ -165,7 +243,7 @@ -
+
@@ -236,7 +314,7 @@
-{# modal to change the target repo #} +{# modal to change the target repo
-
+
#} {% endblock %} {% block jscripts %} @@ -300,42 +378,26 @@ function showTab(){ $(document).ready(function() { - var branchselect = $('#branch_select').selectize({ - create: false, - sortField: 'text', - allowEmptyOption: false, - onChange: function(value) { - if (value != ""){ - var sel = $('#branch_select'); - var final_url = "{{ url_for('ui_ns.new_request_pull', username=username, - namespace=repo.namespace, repo=repo.name, - branch_from=branch_from, branch_to='--', project_to=project_to) }}"; - final_url = final_url.replace('--', sel.val()); - window.location.href = final_url; - } - } + $('.branch_from_item').click(function(e){ + var final_url = "{{ url_for('ui_ns.new_request_pull', username=username, + namespace=repo.namespace, repo=repo.name, + branch_from='--', branch_to=branch_to, project_to=project_to) }}"; + final_url = final_url.replace('--', $(this).attr("data-value")); + window.location.href = final_url; }); - var branchselect = $('#branch_from_select').selectize({ - create: false, - sortField: 'text', - allowEmptyOption: false, - onChange: function(value) { - if (value != ""){ - var sel = $('#branch_from_select'); - var final_url = "{{ url_for('ui_ns.new_request_pull', username=username, - namespace=repo.namespace, repo=repo.name, - branch_from='--', branch_to=branch_to, project_to=project_to) }}"; - final_url = final_url.replace('--', sel.val()); - console.log(final_url); - //return false; - window.location.href = final_url; - } - } + $('.branch_to_item').click(function(e){ + var final_url = "{{ url_for('ui_ns.new_request_pull', username=username, + namespace=repo.namespace, repo=repo.name, + branch_from=branch_from, branch_to='--', project_to=project_to) }}"; + final_url = final_url.replace('--', $(this).attr("data-value")); + window.location.href = final_url; }); + {% if form %} - $('#target_modal').on('shown.bs.modal', function (e) { + $('#family-toggle').click( function (e) { + $('#family-spinner').show(); var _url = '{{ url_for( 'internal_ns.get_project_family', repo=repo.name, @@ -349,25 +411,64 @@ $(document).ready(function() { csrf_token: "{{ g.confirmationform.csrf_token.current_token }}", }, success: function(res) { + $('#family-spinner').hide(); var _text = '' for (el in res.family) { - var _t = '
' - + ' ' - + ' ' - + '
'; + + ''; _t = _t.replace('---', res.family[el]); _text += _t; } - var _el = $('#family_list'); + var _el = $('#family-list'); _el.html(_text); }, }); }); + + $( "#preview" ).hide(); + + $( "#previewinmarkdown" ).click( + function(event, ui) { + var _text = $( "#initial_comment" ).val(); + var _url = "{{ url_for('ui_ns.markdown_preview', + repo=repo.name, + user=repo.user.user if repo.is_fork, + namespace=repo.namespace) | safe}}"; + $.ajax({ + url: _url , + type: 'POST', + data: { + content: _text, + csrf_token: "{{ g.confirmationform.csrf_token.current_token }}", + }, + dataType: 'html', + success: function(res) { + var preview = emojione.toImage(res); + $( "#preview" ).html(preview); + $( "#previewinmarkdown" ).toggleClass("active"); + $( "#editinmarkdown" ).toggleClass("active"); + $( "#initial_comment" ).hide(); + $( "#preview" ).show(); + }, + error: function(error) { + alert('Unable to generate preview!'+error); + console.log(error); + } + }); + return false; + } + ); + + $( "#editinmarkdown" ).click( + function(event, ui) { + $( "#editinmarkdown" ).toggleClass("active"); + $( "#previewinmarkdown" ).toggleClass("active"); + $( "#initial_comment" ).show(); + $( "#preview" ).hide(); + } + ); {% endif %} }); diff --git a/tests/test_pagure_flask_ui_fork.py b/tests/test_pagure_flask_ui_fork.py index a235e68..be59e7f 100644 --- a/tests/test_pagure_flask_ui_fork.py +++ b/tests/test_pagure_flask_ui_fork.py @@ -2009,7 +2009,7 @@ index 0000000..2a552bb 'Create new Pull Request for master - test\n - ' 'Pagure', output_text) self.assertIn( - '', + '\n', output_text) csrf_token = self.get_csrf(output=output) @@ -2094,7 +2094,7 @@ index 0000000..2a552bb 'This project enforces the ' 'Signed-off-by statement on all commits', output_text) self.assertNotIn( - '', + '\n', output_text) self.assertNotIn( 'This repo enforces that ' @@ -2137,7 +2137,7 @@ index 0000000..2a552bb 'This project enforces the ' 'Signed-off-by statement on all commits', output_text) self.assertIn( - '', + '\n', output_text) csrf_token = self.get_csrf(output=output) @@ -2165,7 +2165,7 @@ index 0000000..2a552bb 'This repo enforces that ' 'all commits are signed off by their author.', output_text) self.assertIn( - '', + '\n', output_text) @patch('pagure.lib.notify.send_email') @@ -2194,7 +2194,7 @@ index 0000000..2a552bb 'Create new Pull Request for master - test\n - ' 'Pagure', output_text) self.assertIn( - '', + '\n', output_text) csrf_token = self.get_csrf(output=output) @@ -2361,7 +2361,7 @@ index 0000000..2a552bb 'Create new Pull Request for master - fork/ralph/test\n - ' 'Pagure', output_text) self.assertIn( - '', + '\n', output_text) csrf_token = self.get_csrf(output=output) @@ -2456,7 +2456,7 @@ index 0000000..2a552bb 'Create new Pull Request for master - fork/ralph/test\n - ' 'Pagure', output_text) self.assertIn( - '', + '\n', output_text) csrf_token = self.get_csrf(output=output) diff --git a/tests/test_pagure_flask_ui_remote_pr.py b/tests/test_pagure_flask_ui_remote_pr.py index a96ccb9..688f945 100644 --- a/tests/test_pagure_flask_ui_remote_pr.py +++ b/tests/test_pagure_flask_ui_remote_pr.py @@ -216,7 +216,7 @@ class PagureRemotePRtests(tests.Modeltests): output = self.app.post('/test/diff/remote', data=data) self.assertEqual(output.status_code, 200) output_text = output.get_data(as_text=True) - self.assertIn('

Create pull request

', output_text) + self.assertIn('Create Pull Request\n
\n', output_text) self.assertIn( '
', output_text) self.assertIn( @@ -349,7 +349,7 @@ class PagureRemotePRtests(tests.Modeltests): output = self.app.post('/test/diff/remote', data=data) self.assertEqual(output.status_code, 200) output_text = output.get_data(as_text=True) - self.assertIn('

Create pull request

', output_text) + self.assertIn('Create Pull Request\n
\n', output_text) self.assertIn( '
', output_text) self.assertNotIn( From 92c2a8c2ee50900f6328ea7a6d5daa11f0ddc53e Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Jul 10 2018 07:38:27 +0000 Subject: [PATCH 3/3] change the diff rendering macro This macro is used to render the diffs in new PR, view PR and compare commits. This also adds the ability to collapse diffs in these views Fixes #3268 Signed-off-by: Ryan Lerch --- diff --git a/pagure/templates/_repo_renderdiff.html b/pagure/templates/_repo_renderdiff.html index 5b9e13c..a3997a6 100644 --- a/pagure/templates/_repo_renderdiff.html +++ b/pagure/templates/_repo_renderdiff.html @@ -32,20 +32,22 @@
-
+
-
+
{% set linesadded = patch.line_stats[1] %} {% set linesremoved = patch.line_stats[2] %} {% macro lineschanged(added, removed) -%} - {%if added%} - +{{linesadded}} - {%endif%} - {%if removed%} - -{{linesremoved}} - {%endif%} +
+ {%if added%} + +{{linesadded}} + {%endif%} + {%if removed%} + -{{linesremoved}} + {%endif%} +
{%endmacro%} {% macro viewfilelink(filepath, identifier=False)%} @@ -53,7 +55,7 @@ {% if not identifier %} {% set identifier = pull_request.branch_from %} {% endif %} - {{ filepath | unicode }} {% elif not pull_request %} - - checkout the pull-request locally - to review it entirely. -
{% endif %} {% endmacro %} + {% macro viewfilelinkbutton(filepath, disabled=False, identifier=False) %} + {% if pull_request and not pull_request.remote %} + {% if not identifier %} + {% set identifier = pull_request.branch_from %} + {% endif %} + + + + {% elif not pull_request %} + + + + {% elif pull_request and pull_request.remote %} + {% endif %} + {% endmacro %} + + {% macro changedlabel(thelabel, thecolor)%} +
+ {{thelabel}} +
+ {% endmacro %} + + {% macro diffcollapsebtn()%} + + + + {% endmacro %} + {% if patch | hasattr('new_file_path') %} {%- if patch.new_file_path == patch.old_file_path -%} {%- if patch.status == 'D' -%} {% set patchtype = "removed"%} -
- {{ viewfilelink(patch.new_file_path) }} {{ lineschanged(False, True) }} +
+ {{ viewfilelink(patch.new_file_path) }} +
+
+ {{ changedlabel("file removed", "danger")}} + {{ lineschanged(False, True) }} + {{ viewfilelinkbutton(patch.new_file_path, disabled=True) }} + {{ diffcollapsebtn() }}
-
file removed
{%-elif patch.status == 'A' -%} {% set patchtype = "added"%} -
- {{ viewfilelink(patch.new_file_path) }} {{ lineschanged(True, False) }} +
+ {{ viewfilelink(patch.new_file_path) }} +
+
+ {{ changedlabel("file added", "success")}} + {{ lineschanged(True, False) }} + {{ viewfilelinkbutton(patch.new_file_path) }} + {{ diffcollapsebtn() }}
-
file added
{%-elif patch.status == 'M' -%} {% set patchtype = "changed"%} -
- {{ viewfilelink(patch.new_file_path) }} {{ lineschanged(True, True) }} +
+ {{ viewfilelink(patch.new_file_path) }} +
+
+ {{ changedlabel("file modified", "secondary")}} + {{ lineschanged(True, True) }} + {{ viewfilelinkbutton(patch.new_file_path) }} + {{ diffcollapsebtn() }}
-
file changed
{%-endif-%} {%- else -%} {% set patchtype = "moved"%} - {{lineschanged(True, True)}} -
- {{patch.old_file_path}}
- {{viewfilelink(patch.new_file_path)}} +
+ {{ viewfilelink(patch.new_file_path) }}{{patch.old_file_path}} +
+
+ {{ changedlabel("file renamed", "info")}} + {% if linesadded != 0 and linesremoved != 0%} + {{ lineschanged(True, True) }} + {% endif %} + {{ viewfilelinkbutton(patch.new_file_path) }} + {{ diffcollapsebtn() }}
-
file moved
{%- endif -%} {%- elif patch | hasattr('delta') -%} {%- if patch.delta.new_file.path == patch.delta.old_file.path -%} {%- if patch.delta.new_file.mode == 0 and patch.delta.old_file.mode in [33188, 33261] -%} {% set patchtype = "removed"%} -
- {{ viewfilelink(patch.delta.new_file.path) }} +
+ {{ viewfilelink(patch.delta.new_file.path) }} +
+
+ {{ changedlabel("file removed", "danger")}} {{ lineschanged(False, True) }} + {{ viewfilelinkbutton(patch.delta.new_file.path, disabled=True) }} + {{ diffcollapsebtn() }}
-
file removed
- {%-elif patch.delta.new_file.mode in [33188, 33261] and patch.delta.old_file.mode == 0 -%} {% set patchtype = "added"%} -
- {{ viewfilelink(patch.delta.new_file.path) }} +
+ {{ viewfilelink(patch.delta.new_file.path) }} +
+
+ {{ changedlabel("file added", "success")}} {{ lineschanged(True, False) }} + {{ viewfilelinkbutton(patch.delta.new_file.path) }} + {{ diffcollapsebtn() }}
-
file added
- {%-elif patch.delta.new_file.mode in [33188, 33261] and patch.delta.old_file.mode in [33188, 33261] -%} {% set patchtype = "changed"%} -
- {{ viewfilelink(patch.delta.new_file.path)}} +
+ {{ viewfilelink(patch.delta.new_file.path) }} +
+
+ {{ changedlabel("file modified", "secondary")}} {{ lineschanged(True, True) }} + {{ viewfilelinkbutton(patch.delta.new_file.path) }} + {{ diffcollapsebtn() }}
-
file changed
{%-endif-%} {%- else -%} {% set patchtype = "moved"%} - {{ lineschanged(True, True) }} -
- {{patch.delta.old_file.path}}
- {{ viewfilelink(patch.delta.new_file.path) }} +
+ {{ viewfilelink(patch.delta.new_file.path) }}{{patch.delta.old_file.path}} +
+
+ {{ changedlabel("file renamed", "info")}} + {% if linesadded != 0 and linesremoved != 0%} + {{ lineschanged(True, True) }} + {% endif %} + {{ viewfilelinkbutton(patch.delta.new_file.path) }} + {{ diffcollapsebtn() }}
-
file moved
{%- endif -%} {%- endif -%} -
+
{% if patchtype == "moved" and linesadded == 0 and linesremoved == 0%} -
-
file was moved with no change to the file
+
+
file was moved with no change to the file
{% elif patchtype == "added" and linesadded == 0 %} -
+
empty file added
{% else %} {% if patchtype == "added" and linesadded > 1000 %} -
-
+
+
The added file is too large to be shown here, see it at: {{ viewfilelink(patch_new_file_path) }}
- {% elif patchtype == "removed" %} -
-
+ {% elif patchtype == "removed" and linesadded > 1000 %} +
+
The removed file is too large to be shown here, see it at: {{ viewfilelink(patch_new_file_path, patch_old_id) }}
{% else %} +
{% autoescape false %} {{ patch | patch_to_diff | html_diff(linenos=None) | format_loc( filename=patch_new_file_path, @@ -190,6 +266,7 @@ prequest=pull_request, index=loop.index, tree_id=diff_commits[0].tree.id)}} +
{% endautoescape %} {% endif %} {% endif %} diff --git a/pagure/ui/fork.py b/pagure/ui/fork.py index 2629790..5cd6be6 100644 --- a/pagure/ui/fork.py +++ b/pagure/ui/fork.py @@ -1361,6 +1361,9 @@ def new_request_pull( flask.g.branches = sorted(orig_repo.listall_branches()) + if diff: + diff.find_similar() + return flask.render_template( 'repo_new_pull_request.html', select='requests', diff --git a/tests/test_pagure_flask_ui_fork.py b/tests/test_pagure_flask_ui_fork.py index be59e7f..9e58f12 100644 --- a/tests/test_pagure_flask_ui_fork.py +++ b/tests/test_pagure_flask_ui_fork.py @@ -289,9 +289,9 @@ class PagureFlaskForktests(tests.Modeltests): '', output_text) self.assertIn( - '+3', output_text) + '+3', output_text) self.assertIn( - '-1', + '-1', output_text) @patch('pagure.lib.notify.send_email') diff --git a/tests/test_pagure_flask_ui_remote_pr.py b/tests/test_pagure_flask_ui_remote_pr.py index 688f945..aae5428 100644 --- a/tests/test_pagure_flask_ui_remote_pr.py +++ b/tests/test_pagure_flask_ui_remote_pr.py @@ -218,11 +218,11 @@ class PagureRemotePRtests(tests.Modeltests): output_text = output.get_data(as_text=True) self.assertIn('Create Pull Request\n
\n', output_text) self.assertIn( - '
', output_text) + '
\n', output_text) self.assertIn( - '
', output_text) + '
\n', output_text) self.assertNotIn( - '
', output_text) + '
\n', output_text) # Not saved yet self.session = pagure.lib.create_session(self.dbpath) @@ -245,25 +245,12 @@ class PagureRemotePRtests(tests.Modeltests): '#1', output_text) self.assertIn( - '
', output_text) + '
\n', output_text) self.assertIn( - '
', output_text) + '
\n', output_text) self.assertNotIn( - '
', output_text) + '
\n', output_text) - # Show the filename in the diff view - self.assertIn( - '''
- .gitignore -
- this is a remote pull-request, so we cannot provide you''', - output_text) - self.assertIn( - '''
- sources -
- this is a remote pull-request, so we cannot provide you''', - output_text) # Show the filename in the Changes summary self.assertIn( '', output_text) + '
\n', output_text) self.assertNotIn( - '
', output_text) + '
\n', output_text) # Not saved yet self.session = pagure.lib.create_session(self.dbpath) @@ -376,17 +363,10 @@ class PagureRemotePRtests(tests.Modeltests): 'PR#1: Remote PR title - test\n - Pagure', output_text) self.assertIn( - '