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
sources: get svn revision with --show-item flag #1648
Conversation
Currently, svn last changed revision is extracted from `svn info` text output. The same information can be retrieved directly from the command `svn info --show-item last-changed-revision` without the need to parse text. Adding also the flag `--no-newline` to avoid the need to strip newline character from the output. Since there is not need to parse text anymore, this also remove the dependency from the current locale and then fixes https://bugs.launchpad.net/snapcraft/+bug/1724674
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.
So much better ^_^
Thanks!
😄 |
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.
Nice simplification!
Can we by any chance unit test this? The fact that the test pass unchanged concerns me slightly...
commit = subprocess.check_output( | ||
['svn', 'info', | ||
'--show-item', 'last-changed-revision', | ||
'--no-newline', |
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.
MUCH better code, as we don't parse magical tokens! THANKS!
Why is the --no-newline
parameter needed?
Maybe it's better (as simpler) without 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.
@facundobatista since we are already using str.strip
, --no-newline
should not be necessary, however I decided to keep it to make it more explicit.
On vie, nov 3, 2017 at 7:06 AM, Christian Dywan ***@***.***> wrote:
@kalikiana commented on this pull request.
Nice simplification!
Can we by any chance unit test this? The fact that the test pass
unchanged concerns me slightly...
The unit tests for all things vcs are not mocked commands
… |
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.
How very true... even though they are unit tests. I keep getting this mixed up.
In that case nevermind my comment. This is good.
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.
This is excellent indeed, thank you @clobrano 👍
@ElOpio found the solution, I just implemented it, but thank you :) |
@kalikiana can you make sure this works manually as well? |
Verifying the tests pass: I couldn't actually find a real world case that is affected. I thought at first |
Not with a real snap, but running the test in a VM with es_AR locale |
Currently, svn last changed revision is extracted from `svn info` text output. The same information can be retrieved directly from the command `svn info --show-item last-changed-revision` without the need to parse text. Adding also the flag `--no-newline` to avoid the need to strip newline character from the output. Since there is not need to parse text anymore, this also remove the dependency from the current locale. LP: #1724674
Currently, svn last changed revision is extracted from
svn info
text output. The same information can be retrieved directly from
the command
svn info --show-item last-changed-revision
without the need to parse text.
Adding also the flag
--no-newline
to avoid the need to stripnewline character from the output.
Since there is not need to parse text anymore, this also remove
the dependency from the current locale and then
fixes https://bugs.launchpad.net/snapcraft/+bug/1724674
./runtests.sh static
?./runtests.sh unit
?