Clone remote repository.
- Add clone action and associated menuitem
- Put "Clone" menuitem in ProjectChooser menu
- Move "Open Project" menuitem into ProjectChooser menu
- Use dialog to get remote uri and local target (partially validated)
- Persist default remote and local projects folder entries
- Show spinner while cloning is ongoing, do not block UI
- If cloning fails show error dialog giving opportunity to amend and retry
- On success, open the new project folder but do not make it active (similar to "Open Project" action)
@danirabbit Thanks for the detailed review! I'll get working on your comments. Regarding the dialog, I was trying to reduce the amount of typing required to specify the remote URL especially if you are cloning an elementary repository. I too usually copy paste the URL from github because I use the terminal command git clone .. anyway. I was trying to make the UI easier by only having to type the name of the project for the default situation but if it confuses then maybe I should just have one entry for the URL? I'll rethink the dialog.
@danirabbit I've addressed most of your comments now. I've left moving the "Clone" button else where for a separate PR to be merged into this one if considered superior. I think it should be possible to handle SSH cloning but I'll leave that until the UI is right. What do you think about having dropdowns for choosing common remote hosts etc?
@jeremypw I'm not a fan of the dropdown idea tbh. It feels like trying to be too clever and seems more restrictive and then I have to delete parts of my copied string from the web interface and figure out where the pieces go. It sounds painful to me :/
I think it would be clearer and easier to just have one entry for repository URL instead of trying to split it up into three entries. That seems to against the way code hosts present the URLs for cloning and makes it 3 steps to enter the remote URL instead of one paste step
@danirabbit I think we are imagining different workflows. By the time one has navigated to a webpage and copied the URL it is probably just as quick to type git clone into a terminal and paste the URL there. I am trying to ease my own workflow which is mostly cloning projects from the same host/users (usually https://github.com/elementary/) so I am trying to remove the need to copy-paste from the web browser or type long URLs. Ideally it should be possible to get a list of available projects to clone from a given host/user but I am not sure how to do that atm.
However, if you prefer I can just use an entry where you can paste or type an entire URL instead at least for now. If there are feature requests for something else then it can be enhanced later.
I agree that for downloading random projects from random places splitting the source URL entry into host, user and name does not help.
Gotta go now - will continue tomorrow ...
GNOME Builder has something like that:
You can see suggested GNOME projects to clone on the start page. But also there is a clone repository page:
@stsdc Thanks - this is something to work towards. Probably we'll just produce the simplest minimal functionality in this PR and then we can iterate. Be interesting to know whether the suggested repos are generated live or whether they are hard-coded.
Removed from potential branches for v8.0.0 as I do not want to hold that up too much and this needs some design thought. I'll try to produce v8.1 next month.
I am trying to ease my own workflow which is mostly cloning projects from the same host/users
@jeremypw I hear what you're saying and that makes sense. What do you think about if we saved that host/org portion of the URL after the first time someone clones a branch? I think that might be a good compromise between assuming that folks are primarily cloning elementary repos and also trying to save time when you're cloning lots of repos from the same org.
So for example:
- We start with a single empty url entry
- someone clones for example "https://github.com/elementary/files.git"
- The next time they open the clone dialog, the url entry is now pre-filled with "https://github.com/elementary/"
@danirabbit I've added cloning error handling and persisting the remote and projects folder entries.
@danirabbit Thanks for the thorough review. Hopefully most of the essential issues are fixed now. The "cloning in progress" page is minimal but can be improved before the next release hopefully. I am still unsure whether it is correct to focus the "Cancel" button rather than the URI entry on opening. I have reinstated the "activates-default" behaviour although there is a small risk of starting to clone into the wrong folder if the intention is to clone into a non-default location.
There doesn't seem to be a way of cancelling an ongoing cloning process afaict.
I have a PR demonstrating use of Ggit.RemoveCallbacks to give more detailed info during cloning here #1608, but needs design work and I don't want to hold this PR.