From 3fb285242ef3ff9b8eb9ffcaa8f36ae069f53155 Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Jan 21 2016 03:31:45 +0000 Subject: [PATCH 1/4] added more information to the commit list page now shows the project and branch name at the top of the content area, so the user knows what branch they are looking at for sure. also, provides a alert box at the top if the branch being browsed has commits ahead of the main branch / upstream project. the alert box also has a collapsed area that shows just the commits that are different from the upstream / main branch. --- diff --git a/pagure/templates/repo_info.html b/pagure/templates/repo_info.html index 203d14f..1358c0d 100644 --- a/pagure/templates/repo_info.html +++ b/pagure/templates/repo_info.html @@ -33,29 +33,81 @@ git push -u origin master {% else %} {% if origin == 'view_commits' %} +

Commits {{number_of_commits}}

+
+ Displaying {{number_of_commits}} commits in + {% + if repo.is_fork %} {% + else %} {% + endif %}{{ repo.fullname }} + + + {{branchname}} + +
- {% if diff_commits and authenticated and repo.settings.get('pull_requests', True) %} - - + This branch contains {{ + diff_commits|count }} commits not in {% + if repo.is_fork %}the upstream project + + + {{ repo.name }} + {% + else %}the main branch{% + endif %} + + + {{head}} + + + {% if diff_commits and authenticated and (repo.is_fork or repo.settings.get('pull_requests', True)) %} +
+ {% if repo_admin %}Request pull{% else %}Compare{% endif %} - - {% elif authenticated and repo.settings.get('pull_requests', True) %} +
+ {#{% elif authenticated and repo.settings.get('pull_requests', True) %} Open a remote pull-request - +
#} {% endif %} + + + + {%endif%} -
+
{% for commit in last_commits %} - + {% if diff_commits and commit.oid.hex in diff_commits %} -
+
{% endif %} @@ -255,6 +307,8 @@ git push -u origin master $(document).ready(function() { $(".extra_gits").hide(); }); + + $(function() { $( "#more_gits" ).click( function() { @@ -271,4 +325,15 @@ $(function() { ); }); + +{% if origin == 'view_commits' %} + +{% endif %} + {% endblock %} diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index bd5b290..576e84c 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -306,6 +306,7 @@ def view_commits(repo, branchname=None, username=None): total_page = int(ceil(n_commits / float(limit))) diff_commits = [] + diff_commits_full = [] if repo.is_fork: parentname = os.path.join( APP.config['GIT_FOLDER'], repo.parent.path) @@ -343,6 +344,7 @@ def view_commits(repo, branchname=None, username=None): if commit.oid.hex in compare_commits: break diff_commits.append(commit.oid.hex) + diff_commits_full.append(commit) return flask.render_template( 'repo_info.html', @@ -356,6 +358,8 @@ def view_commits(repo, branchname=None, username=None): branchname=branchname, last_commits=last_commits, diff_commits=diff_commits, + diff_commits_full=diff_commits_full, + number_of_commits=n_commits, page=page, total_page=total_page, repo_admin=is_repo_admin(repo), From 7bc3d66df722fc5bd944ad12149be21e2e82eacf Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Jan 21 2016 03:35:26 +0000 Subject: [PATCH 2/4] fixing tests for the commits list changes --- diff --git a/tests/test_pagure_flask_ui_no_master_branch.py b/tests/test_pagure_flask_ui_no_master_branch.py index ee7d194..bbbc943 100644 --- a/tests/test_pagure_flask_ui_no_master_branch.py +++ b/tests/test_pagure_flask_ui_no_master_branch.py @@ -186,7 +186,7 @@ class PagureFlaskNoMasterBranchtests(tests.Modeltests): output = self.app.get('/test/commits') self.assertEqual(output.status_code, 200) self.assertIn( - '
\n
', output.data) + '
\n
', output.data) self.assertNotIn( '
', output.data) @@ -198,7 +198,7 @@ class PagureFlaskNoMasterBranchtests(tests.Modeltests): self.assertIn('Add sources file for testing', output.data) self.assertIn('Add .gitignore file for testing', output.data) self.assertNotIn( - '
\n
', output.data) + '
\n
', output.data) self.assertEqual( output.data.count('class="list-group-item p-l-3"'), 2) diff --git a/tests/test_pagure_flask_ui_repo.py b/tests/test_pagure_flask_ui_repo.py index 9dd8154..f5e2f59 100644 --- a/tests/test_pagure_flask_ui_repo.py +++ b/tests/test_pagure_flask_ui_repo.py @@ -500,6 +500,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertEqual(output.status_code, 404) tests.create_projects(self.session) + tests.create_projects_git(tests.HERE, bare=True) output = self.app.get('/test/forks') self.assertEqual(output.status_code, 200) diff --git a/tests/test_pagure_flask_ui_slash_branch_name.py b/tests/test_pagure_flask_ui_slash_branch_name.py index d01050e..db80da6 100644 --- a/tests/test_pagure_flask_ui_slash_branch_name.py +++ b/tests/test_pagure_flask_ui_slash_branch_name.py @@ -193,7 +193,10 @@ class PagureFlaskSlashInBranchtests(tests.Modeltests): self.assertIn('Logs - test - Pagure', output.data) self.assertIn('Add sources file for testing', output.data) self.assertIn('Add .gitignore file for testing', output.data) - self.assertEqual(output.data.count('2 commits
in', + output.data) @patch('pagure.lib.notify.send_email') def test_view_file(self, send_email): From 9fb701204d6e126545c42eff49a21d330d43509d Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 21 2016 08:33:54 +0000 Subject: [PATCH 3/4] Remove tests since we dropped the graph for now --- diff --git a/tests/test_pagure_flask_ui_slash_branch_name.py b/tests/test_pagure_flask_ui_slash_branch_name.py index db80da6..2467395 100644 --- a/tests/test_pagure_flask_ui_slash_branch_name.py +++ b/tests/test_pagure_flask_ui_slash_branch_name.py @@ -194,9 +194,6 @@ class PagureFlaskSlashInBranchtests(tests.Modeltests): self.assertIn('Add sources file for testing', output.data) self.assertIn('Add .gitignore file for testing', output.data) self.assertEqual(output.data.count('2 commits in', - output.data) @patch('pagure.lib.notify.send_email') def test_view_file(self, send_email): From bc937bf7ebe81a1540eda8a2a879fe1fce5adac3 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 21 2016 08:37:39 +0000 Subject: [PATCH 4/4] Quick reformatting --- diff --git a/pagure/templates/repo_info.html b/pagure/templates/repo_info.html index 1358c0d..7c11c98 100644 --- a/pagure/templates/repo_info.html +++ b/pagure/templates/repo_info.html @@ -81,7 +81,8 @@ git push -u origin master @@ -278,7 +294,9 @@ git push -u origin master