-
Notifications
You must be signed in to change notification settings - Fork 181
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
Add warning on publish if no branch was found. #795
Add warning on publish if no branch was found. #795
Conversation
90c3081
to
c64af17
Compare
I've just amended my commit with an improvement to speed and readability by extracting the list of branches for the current commit out of the loop. |
results.commit_hash in commits] | ||
|
||
# Print a warning message if we couldn't find the branch of a commit | ||
if not len(branches_for_commit): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
len()
is useless here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured this was more explicit that way, it's almost a question of code style. If you think it's cleaner, I'll remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
len() is not recommended
When the history has been modified (either with draft changesets in hg, or with commit rebasing in git), it is possible that no corresponding branch be found when publishing. There is no real way of automatically fixing the issue, so we at least have to log a warning.
c64af17
to
865f0cc
Compare
If you want to add general tests for logging, that's of course welcome. Otherwise the change here looks ok, modulo the style comment. |
Thanks, merged, not going to hold it for a style issue. |
When the history has been modified (either with draft changesets in hg, or with commit rebasing in git), it is possible that no corresponding branch be found when publishing. There is no real way of automatically fixing the issue, so we at least have to log a warning.
However, it does not seem like there are tests for logs except the console tests for indentation, and I feel like this change warrants one.
Do you have a preferred method of going about this?