Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use verbose_name for stable tag commit name #3142

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions readthedocs/builds/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ def commit_name(self):
# the underlying commits.
if self.identifier.startswith('origin/'):
return self.identifier[len('origin/'):]
if self.type == TAG:
# If this version is a tag, the verbose_name will contain the
# actual name. A tag would contain the hash in indentifier,
# which is not as pretty as the actual tag name.
return self.verbose_name
return self.identifier

# By now we must have handled all special versions.
Expand Down
5 changes: 2 additions & 3 deletions readthedocs/rtd_tests/tests/test_version_commit_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ def test_branch_with_name_stable(self):
def test_stable_version_tag(self):
version = new(Version,
identifier=u'3d92b728b7d7b842259ac2020c2fa389f13aff0d',
slug=STABLE, verbose_name=STABLE, type=TAG)
self.assertEqual(version.commit_name,
u'3d92b728b7d7b842259ac2020c2fa389f13aff0d')
slug=STABLE, verbose_name=u'stable_verbose', type=TAG)
self.assertEqual(version.commit_name, u'stable_verbose')

def test_hg_latest_branch(self):
hg_project = get(Project, repo_type=REPO_TYPE_HG)
Expand Down