-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix #9932 #11024
Fix #9932 #11024
Conversation
#Or temp was not fully deleted | ||
#Remove METADATA as well and reinit rather | ||
if isdir(metadata_dir) | ||
rm(metadata_dir, recursive=true) |
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.
Missing an end here, and please use 4-space indent. I like the comments though.
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.
Actually - how did that compile?! Fixing now.
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.
it didn't compile, at least not on travis
Good idea. |
@@ -54,12 +64,17 @@ function init(meta::AbstractString=DEFAULT_META, branch::AbstractString=META_BRA | |||
close(io) | |||
end | |||
end | |||
#Copy TEMP to METADATA and remove TEMP | |||
Base.cp(temp_dir, metadata_dir) | |||
rm(temp_dir, recursive=true) |
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.
any reason not to do mv
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.
None, other than I forgot it existed!
Crap. I clearly am not good with git yet >_< Sorry about the nonsense! |
Might be a bug with the Julia plugin for whatever editor you're using. |
I fixed it manually and cleaned it all up, really sorry about the crap >_< |
No worries, git can be really frustrating as you first get used to doing more complicated things with it. I think lines 62 and 63 are still under-indented. Would be nice if we had an auto-formatter. |
As you commented that I fixed it. Seeing as that is my 2nd biggest issue (not knowing how to rebase properly would be no.1 - time to make sure I can do that right) where can I look how to do that? Can it be done as a github plugin? |
You got 65-67, but not 62-63, from what I can see. I do wonder how much infrastructure the github web editor has in common with atom, whether you can make atom settings for smart indenting apply within the web editor... |
Something a little like https://github.com/google/yapf or clang-format that we could just run automatically and not have to think about it would be ideal, but I don't know if anyone has come up with anything standalone for Julia that isn't just leveraging existing text editors' plugin infrastructure. |
I may try and do something similar to YAPF! I think I edited and committed those lines now 4 times with atom only actually saving them after I closed atom. I was quite annoyed. Does Julia have a more comprehensive guideline for Julia code other than the one in It should probably be done in Julia, then it could be a package which could also emit an executable once the work there is completed. Any name that would be preferred? I should have a chance to get to starting this tonight. Will ask for comments once I get to a working state. |
I don't think we do have a coherent code style guideline beyond CONTRIBUTING.md. Take a look at what the different editor plugins do, maybe bug the authors of them and/or solicit julia-users for some thoughts (and name suggestions). https://github.com/jakebolewski/JuliaParser.jl will probably also be very useful to verify that a formatter only changes appearance and not meaning. |
Oh dear. Back to the subject of this PR, it looks like it's failing the pkg test on Travis (and I can reproduce that with a local checkout of this branch). Need to get to the bottom of that... are you working from a source build of Julia? |
I am working on a source build of Julia yes. Internet is being painfully slow right now unfortunately. Found the issue. Hidden folders are not copied so the .git folder is never copied over. I think I am going to leave this as is and will have to open up a second PR modifying mv and cp to include a hidden option. I will have to make new tests for that won't I? |
Interesting. Yes, tests for new functionality are always good. @peter1000 was just recently working on recursive cp, but I don't know whether the tests included any hidden subfolders. |
If you want I can look into the |
Seems if I do julia> cp("Docile.jl", "test")
|
though we are using |
seems to work too
"test2" has the not sure what happens if there are wrong permissions or files are currently open by an other application: just a thought |
Hmmm. Think I am going to do a make clean and start from there again. Sorry for bugging you @peter1000. I am quite confused as to how the error is being thrown. Built it on windows with everything copying right now. Same error as before though:
|
hi Mike43110, no problem. I'm on linux and can't help you with Windows. What I could do is copy you commit and try it out here - just not sure how to test this if it works. If you shortly instruct me I can do that for you. |
Don't worry, I was sorely mistaken it seems! Thanks for the offer though! Lesson learned: even if it seems unrelated, run the test suite anyway! I will fix this. My internet has bombed out multiple times just testing this, making this fix quite important for me! (Wonderful South Africa) |
All green at last. Thanks guys for putting up with me, I checked practically everything I could before stumbling onto the issue that But in the end, green ticks at last and now a failed init which happens oh so often won't be as much of a pain anymore! |
#Move TEMP to METADATA | ||
Base.mv(joinpath(temp_dir,"METADATA"), metadata_dir) | ||
Base.mv(joinpath(temp_dir,"REQUIRE"), joinpath(metadata_dir,"REQUIRE")) | ||
Base.mv(joinpath(temp_dir,"META_BRANCH"), joinpath(metadata_dir,"META_BRANCH")) |
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 think REQUIRE
and META_BRANCH
should be moved to joinpath(dir, ...)
instead of metadata_dir
?
@StefanKarpinski can you take a look at this?
Thanks for the comments @tkelman, those files were in the incorrect positions. I fixed them and added tests to check their positions. |
Looks like I will need to test this on Ubuntu again instead of Windows. Had a small error in the test. Windows should have failed as well. |
All is green again. I am a little concerned that windows passed initially as it shouldn't have. Is there a bug with |
We don't run the pkg tests on appveyor right now. |
Would be good to squash so we don't introduce a commit that is known to fail tests in the history of master, for the sake of future use of I think this could be merged after squashing, but would really like to get @StefanKarpinski's buy-in on anything Pkg-related. |
Aah! That clears up that piece of confusion thanks. Understand that you want his input first completely. While he is here: |
metadata_dir = joinpath(dir, "METADATA") | ||
#Check if TEMP dir exists from previous failed init | ||
if isdir(temp_dir) |
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.
Just a thought, why not use base.mktempdir() and then you won't need to do this test.
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.
it's also best not to call rm
when you can avoid it, since the user would be most unhappy to lose a working directory they happened to call TEMP
.
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 will remove that and use Base.mktempdir()
There is a potential for a failed init()
to cause the subsequent tests to fail because of an unclean directory - Pkg.status()
reported the TEMP
folder which would cause the test @test isempty(Pkg.installed())
to fail.
Though if I clone directly to the tmpdir instead of to the package location initially there won't be any issues!
current commit is just to have a place to fallback to. Ok! Internet working right so I could test and it all passes locally at the latest commit. Will check if it goes green then will rebase. |
Added Tests for REQUIRE and META_BRANCH existence
Let me run the pkg test on this locally just to make sure there isn't anything strange with
Not within the same PR, but it is a little unfortunate that nothing has come of that yet despite being bumped a few weeks ago. As a separate PR, moving towards doing more things over https (probably just by default, for security's sake) would be a good direction I think. |
pkg test works okay on windows at mikewl@5709b35 |
I wonder if doing it in a minimally invasive way won't be good (for #7005).
This can be used to change the url to https without needing to alter the I tested this on Would this be fine for an initial change? It just allows the desired url to be selected. I need to find a proxy to test it through still. |
I think a regex might be a more efficient way of doing that string operation, but opening an initial proof-of-concept pr in that direction sounds like a good idea to me. Could comment on #7005 after opening to solicit feedback from people who know more about these things than I do. |
I did a regex initially then I realised that urls like "git://.../httpsServer.jl" may get affected. Using the array split ensures only the initial value is altered. Though I have minimal regex experience! I am busy working on that and the formatter anyway. Worst case the PR gets rejected with a request to go in a different direction! Thanks for the assistance though, very much appreciated. |
@Mike43110 The regex character |
Bump @StefanKarpinski can you take a look? |
I'm going to merge this, since it seems like a step in the right direction and getting reviewers for PR's has apparently become extremely difficult lately. If we find any unforeseen consequences or problems with this we can always revert it. |
Sorry for the lack of review. This seems like a good approach and I'm sure we'll hear about it if it's broken. |
@StefanKarpinski If you could also please review the documentation additions that you suggested (because of my surprise issues with coming from C/C++), I'd appreciate it! ;-) #11081 -> #11099 |
@ScottPJones, it's generally better to bump the relevant issues with |
And general-purpose documentation improvements can usually be reviewed by a much larger number of people than specific details about Pkg, or compiler internals, or linear algebra, what have you, which tend to have different sets of informal "code owners." |
Base.mv(joinpath(temp_dir,"METADATA"), metadata_dir) | ||
Base.mv(joinpath(temp_dir,"REQUIRE"), joinpath(dir,"REQUIRE")) | ||
Base.mv(joinpath(temp_dir,"META_BRANCH"), joinpath(dir,"META_BRANCH")) | ||
rm(temp_dir) |
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.
why is this not rm(temp_dir, recursive=true)
?
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.
don't think it has to be since there shouldn't be anything left in it at this point, but maybe more defensive that way
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.
Arg sorry for the noise, it is moving the directories not copying them.
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.
@jakebolewski If the directory is not empty it then will error.
I had it the other way initially but thought that if some other change comes around which isn't accounted for in this then it will error.
I am not too sure whether this is a good thing though. It means if somebody adds an extra item to Pkg.init()
it needs to be explicitly handled whereas if I had moved temp_dir
to dir
instead of each item individually that wouldn't have been a problem.
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.
It's better for that not to be a silent error, but it seems like this is kind of an unfortunately brittle arrangement.
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.
It wouldn't be silent, would it? I'd think make test-pkg
would show the error pretty quickly. If dir
already happens to exist then I don't think it would work to move temp_dir
to dir
. I don't think we have a force
kwarg for mv
.
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.
Right, the current behavior is better since it would fail if this directory weren't empty, so I guess we're ok.
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.
Without using -force
which isn't available there is the option of removing the specific version directory completely though that also seems like it could have unintended consequences as well.
julia could add the kwarg:
If that is wanted I could do it. |
Yes please, @peter1000! |
Ok probably tomorrow with docs and test case. |
|
According to my reading: the current implementation of see related issue I opend: #11145 |
based on a comment by @tkelman JuliaLang#11024 (comment) I would like to add some tests for hidden folders
This fixes #9932 by first creating a TEMP directory to clone into. Once the clone is complete the contents of TEMP are copied into METADATA.
I am not sure if the comments are excessive. Will prune if necessary.