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

Replace Version.get_vcs_slug() and Version.remote_slug with Version.commit_name #1650

Merged
merged 2 commits into from
Sep 14, 2015

Conversation

gregmuellegger
Copy link
Contributor

The two places were solving the same problem but with different results. That is undesired and resulted in invalid behaviour. The commit_name property unifies those now and has tests to make sure it works the way intended.

The problem with this on-first-sight-easy problem is that we currently do store different things in "identifier", "slug", "verbose_name" fields depending if its a branch or tag, if it's a special version (like stable, latest) etc. The cleanest solution would be to refactor the Version model to expose those information more easily and store branch_name, tag_name, explicitly.

One problem of this manifested in #1637

…ommit_name

The two places were solving the same problem but with different results. That
is undesired and resulted in invalid behaviour. The commit_name property
unifies those now and has tests to make sure it works the way intended.

The problem with this on-first-sight-easy problem is that we currently do
store different things in "identifier", "slug", "verbose_name" fields
depending if its a branch or tag, if it's a special version (like
stable, latest) etc. The cleanest solution would be to refactor the Version
model to expose those information more easily and store branch_name, tag_name,
explicitly.

# If we came that far it's not a special version nor a branch or tag.
# Therefore just return the identifier to make a safe guess.
return self.identifier
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for being thorough and explicit, this is a lot more clear

@agjohnson
Copy link
Contributor

This looks good, without testing this I'm not sure if the issue I raised is valid. Feel free to merge otherwise.

We could really stand to audit Project and Version models for needless overlap like this in the future sometime, as there is most certainly a lot of this.

gregmuellegger added a commit that referenced this pull request Sep 14, 2015
Replace Version.get_vcs_slug() and Version.remote_slug with Version.commit_name
@gregmuellegger gregmuellegger merged commit cce853b into master Sep 14, 2015
@gregmuellegger gregmuellegger deleted the refactor-commit-name branch September 17, 2015 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants