Skip to content
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

Additional source control functionality #1785

Merged
merged 35 commits into from
Aug 8, 2024

Conversation

austincondiff
Copy link
Collaborator

@austincondiff austincondiff commented Jul 1, 2024

Description

We are improving upon existing source control functionality by doing the following...

  • Added push functionality and sheet.
  • Added pull functionality and sheet.
  • Added manual fetch functionality and fetching sheet.
  • Reorganized source control files in project
    • Renamed Features/Git to Features/SourceControl
    • Moved sheet views into it from the Source Control Navigator
    • Moved models out of Client
  • Moved the sync view above commit form in source control changes navigator.
  • Refreshing remotes cache after adding a remote.
  • Moved push and pull state variables into the source control manager.
  • Added a confirm branch switch sheet.
  • Stashing changes if changes exist when attempting to pull or switch branches.
  • Setting remote for push and pull after adding a remote.
  • Added warning alerts if uncommitted changes are not present
  • It is now possible to switch to a remote branch and create a new branch from a remote branch.
  • Disabling rename branch for remote branches.

Testing

Note to reviewers... Please pull down and test this in addition to reviewing the code. Once you have this pulled down...

In a terminal run...

mkdir test.git
cd test.git
git init --bare

Then add the remote in CodeEdit by

  1. going to the Source Control Navigator
  2. If not already click Initiate to start a git repo
  3. go to the Repositories tab
  4. Right click Remotes and click Add existing remote...
  5. Give the remote a name like "test" (the first remote will be "origin") and enter the path to test.git
  6. You can now make changes, commit, and push via the Changes tab in the Source Control Navigator
  7. You can set up additional projects by repeating steps 1-5 so you can make changes elsewhere and test pull functionality.
  8. You can create additional remotes as well to test managing a project with multiple remotes, pushing and pulling from them, etc.

Checklist

  • Add push logic
  • Add pull logic
  • Add push sheet
  • Add pull sheet
  • Add centralized sheets view
  • Rename Features/Git to Features/SourceControl
  • Move sheet views into Features/SourceControl
  • Add "Source Control" menu
  • Add remote from push and pull sheets
  • Set new remote in push or pull sheet after one is added
  • Stash changes if attempting to pull or switch branches and changes exist
  • Add fetch to the menu and display fetching sheet while fetching
  • Add confirm branch switch sheet
  • Add warning alerts if uncommitted changes are not present

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Screenshots

image image image image image image

Todos discovered

  • Reload source editor contents when file is changed externally
  • Handle source control errors better and show necessary errors to user
  • Handle rebase and merge conflict flow in UI
  • Display loading indicator when pushing or pulling Be able to cancel push or pull while in progress
  • Display loading indicator when pulling from stash sheet
  • Write tests for source control features

@austincondiff austincondiff changed the title Added Source Control Push and Pull functionality Added source control push and pull functionality Jul 1, 2024
@austincondiff
Copy link
Collaborator Author

austincondiff commented Jul 2, 2024

I am struggling to get the "Source Control" menu working here, specifically trying to gain access to the focused windows SourceControlManager. The commands view can't find it so we are not showing those items as a result. Anyone know why? I tried placing .focusedObject(sourceControlManager) at the end of WorkspaceView but that wasn't working.

Edit: Fixed, thanks Khan!

@austincondiff austincondiff marked this pull request as ready for review July 2, 2024 22:15
Copy link
Member

@FastestMolasses FastestMolasses left a comment

Choose a reason for hiding this comment

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

LGTM, just small changes

FastestMolasses
FastestMolasses previously approved these changes Jul 3, 2024
@matthijseikelenboom
Copy link
Contributor

Looks good, but no tests are present

@austincondiff
Copy link
Collaborator Author

@matthijseikelenboom We need a separate issue to add tests to not just what I did in this PR but everything source control related.

@tom-ludwig
Copy link
Member

Great work! One thing that's bothering me is that I don't see the push button until I commit all my changes. Once everything is committed, the button appears.

  1. No new commits
Screenshot 2024-07-05 at 1 25 07 PM
  1. One new commit
Screenshot 2024-07-05 at 1 25 20 PM
  1. Two new commits
Screenshot 2024-07-05 at 1 25 29 PM

Copy link
Member

@tom-ludwig tom-ludwig left a comment

Choose a reason for hiding this comment

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

Amazing work! Source control in CE is really shaping up. I just have a few small comments 😁

@austincondiff
Copy link
Collaborator Author

Great work! One thing that's bothering me is that I don't see the push button until I commit all my changes. Once everything is committed, the button appears.

  1. No new commits
Screenshot 2024-07-05 at 1 25 07 PM 2. One new commit Screenshot 2024-07-05 at 1 25 20 PM 3. Two new commits Screenshot 2024-07-05 at 1 25 29 PM

@activcoding The sync bar now shows even if you have changes.

@austincondiff austincondiff changed the title Added source control push and pull functionality Improved overall source control functionality Jul 10, 2024
@austincondiff austincondiff added enhancement New feature or request source control labels Jul 10, 2024
@austincondiff austincondiff self-assigned this Jul 10, 2024
@austincondiff austincondiff added this to the v0.2.0 milestone Jul 10, 2024
Copy link
Collaborator

@thecoolwinter thecoolwinter left a comment

Choose a reason for hiding this comment

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

Should this state be possible? This is an empty git repository with no remotes. I think it shouldn't show the no upstream branch if there's no tracking remote.

Screenshot 2024-07-11 at 5 17 53 PM

Not quite done with the full review, I'll finish it when I have some time.

Copy link
Collaborator

@thecoolwinter thecoolwinter left a comment

Choose a reason for hiding this comment

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

Continuing my last review.

It looks like theres a way to make the default selected branch in this menu be incorrect. This was after making a new branch, switching to it, and pressing the push button. It should default to the selected branch but it seems the operationBranch wasn't updated correctly from the repository outline view.

Screenshot 2024-07-11 at 10 06 32 PM

Also, I seem to be able to break the push mechanism on my machine:

Screen.Recording.2024-07-11.at.10.14.16.PM.mov

For more details:

  • I created a branch, switched to it, pushed it to the remote, and switched back w/o closing the window
  • After switching back, the push mechanism was broken.

Last thing: Could you provide more details on how you tested pulling changes? I can't figure how you did it with a local git repository.

…ator. Refereshing remotes cache after adding a remote. Moved push and pull state variables into the source control manager. Stashing changes if changes exist when attempting a pull. Setting remote for push and pull after adding a remote. Renamed scm variables to sourceControlManager for clarity.
…for changes and if there are changes we prompt the user to stash changes before switching branches.
…ch from a remote branch. We are now disabling rename branch for remote branches.
@thecoolwinter thecoolwinter merged commit a231637 into CodeEditApp:main Aug 8, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request source control
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants