-
-
Notifications
You must be signed in to change notification settings - Fork 113
Clone remote repository. #1548
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
Clone remote repository. #1548
Conversation
@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 |
Set input purpose Co-authored-by: Danielle Foré <[email protected]>
SPDX header Co-authored-by: Danielle Foré <[email protected]>
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 two things and then I think it's good to get in for more testing
src/Services/GitManager.vala
Outdated
@@ -112,5 +112,38 @@ namespace Scratch.Services { | |||
|
|||
return build_path; | |||
} | |||
|
|||
//TODO Make this a real async function that does not block the main loop. |
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 this needs to be done before this is ready to merge. Otherwise Gala thinks Code has crashed while it's cloning
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.
Done but Gala still thinks Code has crashed because the underlying Ggit function is still synchronous and there is no obvious way of interrupting it. Once it has started it dominates the cpu. I'll try to find a solution as this affects other apps too.
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.
Looks like we need to use a real GLib.Thread. Async functions run in the same thread as the main loop so can block the UI.
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.
Now using a GLib.Thread to wrap the Ggit.clone (). Seems to work (as judged by spinner operating smoothly during cloning)
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.
Somewhere along the way we seem to have lost "activates default" on entries
// - Can contain only letters ( a-zA-Z ), digits ( 0-9 ), underscores ( _ ), dots ( . ), or dashes ( - ). | ||
// - Must not contain consecutive special characters. | ||
// - Cannot end in . git or . atom . | ||
private const string CLONE_REPOSITORY = N_("Clone Button"); |
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.
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.
Sorry, left over from testing...
public bool cloning_in_progress { | ||
set { | ||
if (value) { | ||
clone_button.label = _(CLONING); | ||
spinner.start (); | ||
|
||
} else { | ||
clone_button.label = _(CLONE_REPOSITORY); | ||
spinner.stop (); | ||
} | ||
|
||
revealer.reveal_child = value; | ||
} | ||
|
||
get { | ||
return revealer.reveal_child; | ||
} | ||
} |
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 definitely not right. You could add another page with a spinner, but keeping everything sensitive and changing the button label is definitely not 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.
OK, the spinner at this point is a proof of principle that the cloning thread was not blocking the UI. I wasn't sure how to show it in practise. I'll show another page as you suggest.
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.
Now implemented simple separate page
clone_button = new Gtk.Button.with_label (_(CLONE_REPOSITORY)); | ||
clone_button.show (); | ||
add_action_widget (clone_button, Gtk.ResponseType.APPLY); |
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 should probably be
clone_button = new Gtk.Button.with_label (_(CLONE_REPOSITORY)); | |
clone_button.show (); | |
add_action_widget (clone_button, Gtk.ResponseType.APPLY); | |
clone_button = add_button (_(CLONE_REPOSITORY), Gtk.ResponseType.APPLY); |
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.
Included in my commit
@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. |
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.
Let's go 🚀
Uh oh!
There was an error while loading. Please reload this page.