[damned-lies] Fixed commit log URL to depend on branch name
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Fixed commit log URL to depend on branch name
- Date: Sun, 7 Oct 2018 20:12:12 +0000 (UTC)
commit 50710648609518c03c8cd1406063fffecde78487
Author: Claude Paroz <claude 2xlibre net>
Date: Sun Oct 7 22:11:22 2018 +0200
Fixed commit log URL to depend on branch name
Refs #106.
stats/models.py | 2 +-
stats/tests/tests.py | 17 +++++++++++++++--
2 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index 35818df0..823f1ff3 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -304,7 +304,7 @@ class Branch(models.Model):
def get_vcs_web_log_url(self):
""" Link to browsable commit log """
if self.module.vcs_type == 'git':
- return utils.url_join(self.module.vcs_web, 'commits', 'master')
+ return utils.url_join(self.module.vcs_web, 'commits', self.name)
else:
# Not implemented for other VCS
return ""
diff --git a/stats/tests/tests.py b/stats/tests/tests.py
index 4ff3ce14..b0dd2c37 100644
--- a/stats/tests/tests.py
+++ b/stats/tests/tests.py
@@ -97,8 +97,21 @@ class ModuleTestCase(TestCase):
self.assertContains(response, "Sorry, no known locations to report bugs for this module.")
def test_branch_methods(self):
- self.assertTrue(self.branch.is_head())
- self.assertEqual(self.branch.get_vcs_web_url(), "https://gitlab.gnome.org/GNOME/gnome-hello/")
+ branch = Branch(module=self.mod, name='master')
+ self.assertTrue(branch.is_head())
+ self.assertEqual(
+ branch.get_vcs_web_url(),
+ "https://gitlab.gnome.org/GNOME/gnome-hello/"
+ )
+ self.assertEqual(
+ branch.get_vcs_web_log_url(),
+ 'https://gitlab.gnome.org/GNOME/gnome-hello/commits/master'
+ )
+ branch.name = 'gnome-3-30'
+ self.assertEqual(
+ branch.get_vcs_web_log_url(),
+ 'https://gitlab.gnome.org/GNOME/gnome-hello/commits/gnome-3-30'
+ )
def test_branch_domains(self):
"""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]