Skip to content

Conversation

@Pythonen
Copy link
Member

@Pythonen Pythonen commented Apr 15, 2022

Description

Added branch checkout modal which shows after cloning from the welcome view

Related Issue

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • I documented my code
  • Review requested

Screenshots

Näyttökuva 2022-4-15 kello 13 03 46

Pythonen added 25 commits March 23, 2022 14:08
Basics of cloning repository implemented. Pressing clone on welcome
view now opens simple window with url input with clone and close buttons

For now it clones the repositories in to your home dir. Error handling
for now is nada and should be implemented in later commits
Now you can select the folder to which you want to clone the repository.
This defaults to home folder.

Also added check that the repository isn't empty when trying to clone.
Now after we press `clone` button, we firstly clone the specified
repository to given folder. After cloning, we open folder picker for
the user to pick folder to open the editor in. However this could be better if
we straight up open the editor in the cloned folder, rather than giving user an option
to choose the folder in between.
Added error handling for git related errors e.g. when trying to clone
non existent repository
Changed GitClone to be module as discussed in
CodeEditApp#232 (comment)
Switched the git clone view folder picking to use NSSavePanel
instead of NSOpenPanel.

NSSavePanel gives us kind of the same flow as Xcode has, as it's also using
NSSavePanel to prompt the target folder for cloning.

The view now consist of two separate modals that pop open, and it may
seem cumbersome, but it now has kind of the same functionality as Xcode.
Also fix current implementation to use the new ShellClient
Repositioning buttons, input and text. Also added app icon to the view
Changed git clone view to be sheet instead of normal window. This
is better for UX as you can't click anywhere else than the clone view
until you either cancel or clone the repository
Naive Xcode-like check for the url implemented. For now if the url
does not start with certain string, the clone button is disabled, just
like in Xcode.

Also added check for when user decides to press cancel on folder selection
CodeEditApp#232 (comment)
If you have 'valid' git url in your clipboard when opening the clone
view, it now automatically pastes it to the textfield
Fixed indentation in WelcomeView and moved the logic of cloning
repository into it's own private function
Added modal to checkout to other branches after cloning the repository
@Pythonen
Copy link
Member Author

Pythonen commented Apr 15, 2022

Had to move some variables from GitCloneView to WelcomeView to share them with the modal.
E.g.

    @State var showCheckoutBranch = false
    @State private var repoPath = "~/"

Is this big no no as the number of WelcomeView 's state vars increases?

@Pythonen Pythonen marked this pull request as ready for review April 15, 2022 10:18
@Pythonen Pythonen changed the title Git clone Branch checkout after cloning Apr 15, 2022
@Angelk90
Copy link
Contributor

@Pythonen : I tested it, some considerations:

  • I tried with a repository that has several branches, at the moment it only shows me one branch, the first one.
    Test with: Repository

Schermata 2022-04-15 alle 13 05 28

  • When I clone a report, the window where it asks me where to save in which path, remains open all the time, with the mouse waiting as seen in the video.
    The behavior that I expect to close, I think this thing has to be discussed with @MarcoCarnevali.
Registrazione.schermo.2022-04-15.alle.13.00.28.mov
  • What happens if I press the Cancel button?

  • If the repository I cloned to only one branch it makes sense to show the checkout?

@austincondiff
Copy link
Collaborator

How are you seeing this dialog. I wasn't seeing it in my tests.

@Angelk90
Copy link
Contributor

Angelk90 commented Apr 16, 2022

@austincondiff : Can you make the video of when you try to clone a report?

Senza.nome.mov

@austincondiff
Copy link
Collaborator

Disregard my comment. I stand corrected. This dialogue is not shown if there is only a single branch available. Just make sure that is the case with yours.

@nanashili
Copy link
Contributor

@Pythonen how you planning to handle private repos?

@austincondiff
Copy link
Collaborator

Resolve conflicts and we can merge if there are no other outstanding items.

@Pythonen
Copy link
Member Author

Pythonen commented Apr 16, 2022

Resolve conflicts and we can merge if there are no other outstanding items.

Sure, just have to change the functionality to make sure it won't ask for checkout if there's only one branch present

@Pythonen how you planning to handle private repos?

For now just relying on the GitClient's functionalities, as it just uses shell

@lukepistrol lukepistrol marked this pull request as draft April 16, 2022 18:14
@lukepistrol lukepistrol added the WIP This is work-in-progress label Apr 16, 2022
@lukepistrol lukepistrol changed the title Branch checkout after cloning [WIP] Branch checkout after cloning Apr 16, 2022
@Pythonen Pythonen marked this pull request as ready for review April 17, 2022 18:02
Copy link

@esthicodes esthicodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it important to do branch checkout after cloning

Copy link
Contributor

@nanashili nanashili left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@austincondiff All looks good to me.

@nanashili
Copy link
Contributor

@Pythonen is this still a WIP?

@Pythonen
Copy link
Member Author

@Pythonen is this still a WIP?

If you don't see it as a mandatory to convert it to Observable, then no. 👍

@austincondiff
Copy link
Collaborator

If it is not WIP, remove WIP from the title so reviewers know to review it. 🙂

@Pythonen Pythonen changed the title [WIP] Branch checkout after cloning Branch checkout after cloning Apr 18, 2022
@austincondiff austincondiff self-requested a review April 18, 2022 17:12
Copy link
Collaborator

@austincondiff austincondiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

@austincondiff austincondiff merged commit 8d6f31e into CodeEditApp:main Apr 18, 2022
@austincondiff
Copy link
Collaborator

@allcontributors add @Pythonen for code

@allcontributors
Copy link
Contributor

@austincondiff

I've put up a pull request to add @Pythonen! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WIP This is work-in-progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants