Skip to content

[rebase] menu item and dialog to start rebase operation#6961

Merged
niik merged 26 commits intodevelopmentfrom
shiftkey/rebase/menu-item-and-dialog
Mar 11, 2019
Merged

[rebase] menu item and dialog to start rebase operation#6961
niik merged 26 commits intodevelopmentfrom
shiftkey/rebase/menu-item-and-dialog

Conversation

@shiftkey
Copy link
Member

@shiftkey shiftkey commented Feb 27, 2019

Overview

Closes #6551
Closes #7012
Closes #6961

Description

This is the first part of enabling the user to rebase their current branch from within the app in a guided fashion, and I've omitted much of the background computation from #6959 and #6960 so that I can have something baked to help with testing.

screen shot 2019-02-27 at 12 33 30 pm

screen shot 2019-02-27 at 12 33 37 pm

screen shot 2019-02-27 at 12 33 48 pm

The menu item is enabled only for development currently.

Testing:

  • can start a rebase, and dialog closes because no conflicts with success banner shown
  • can start a rebase, and dialog switches to show conflicts if encountered
  • can start a rebase, can address conflicts, and continue rebase until success banner shown
  • address TODO comments

Release notes

Notes:

@shiftkey shiftkey added this to the 1.7.0 milestone Feb 27, 2019
@shiftkey shiftkey force-pushed the shiftkey/rebase/menu-item-and-dialog branch 2 times, most recently from 585b588 to 3684e0e Compare February 27, 2019 20:15
@shiftkey shiftkey changed the title menu item and dialog to start rebase operation [rebase] menu item and dialog to start rebase operation Feb 28, 2019
@shiftkey shiftkey marked this pull request as ready for review February 28, 2019 14:09
@shiftkey shiftkey added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Feb 28, 2019
? 'Rebase Current Branch…'
: 'R&ebase current branch…',
id: 'rebase-branch',
accelerator: 'CmdOrCtrl+Shift+E',
Copy link
Member Author

Choose a reason for hiding this comment

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

I settled on E here because R or B are already assigned to other shortcuts


log.info(`[rebase] starting rebase for ${beforeSha}`)

// TODO: this can happen very quickly for a trivial rebase or an OS with
Copy link
Member Author

Choose a reason for hiding this comment

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

Going to keep this around because I have #6962 to tackle 🔜

return RebaseResult.CompletedWithoutError
}

if (rebaseEncounteredConflictsRe.test(result.stdout)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

I bumped dugite to the latest version to replace this regex inspection with proper error codes for the known rebase problem scenarios: desktop/dugite#306

@tierninho
Copy link
Contributor

Tested the new menu option/shortcut as of 76d48b9 and found no issues.

  • Curious if it makes sense to allow the user to rebase the same two branches twice in a row?

@shiftkey
Copy link
Member Author

shiftkey commented Mar 5, 2019

Curious if it makes sense to allow the user to rebase the same two branches twice in a row?

I don't think it's worth actively trying to block this case unless there's downsides to this. The second rebase would be a clean rebase (because the user resolved any conflicts in the first rebase).

@tierninho
Copy link
Contributor

If a merge conflict is in progress and is currently in manual resolution mode (banner present), then the Rebase current branch menu option should not be enabled as it results in an error message:

install.ts:23 `git rebase sdfsdfsdfsdfsdfsdfsd test-pr-creation` exited with an unexpected code: 1.
.gitignore: needs merge
UnitTestProject3/UnitTestProject3/UnitTest2.cs: needs merge

error: cannot rebase: You have unstaged changes.
error: additionally, your index contains uncommitted changes.
error: Please commit or stash them.

image

(⚠️ Note this is part of a wider problem that might want to be addressed elsewhere as multiple menu options are selectable in this state, and doing so can leads to other errors).

@shiftkey
Copy link
Member Author

shiftkey commented Mar 5, 2019

(⚠️ Note this is part of a wider problem that might want to be addressed elsewhere as multiple menu options are selectable in this state, and doing so can leads to other errors).

👍 you can currently try merging a branch while also dealing with merge conflicts. I'll spin this out to an issue to track tomorrow.

@shiftkey
Copy link
Member Author

shiftkey commented Mar 6, 2019

I've opened #7017 to audit the menu items and figure out which should be enabled when dealing with conflicts.

@shiftkey shiftkey added the time-sensitive Pull Requests where reviews need to happen in a timely manner label Mar 6, 2019
@shiftkey
Copy link
Member Author

shiftkey commented Mar 6, 2019

Marking this as time-sensitive because it's key to all rebase functionality in 1.7.0

@shiftkey shiftkey force-pushed the shiftkey/rebase/menu-item-and-dialog branch from 25bdc88 to 09628d1 Compare March 7, 2019 13:36
@niik niik self-assigned this Mar 8, 2019
@shiftkey
Copy link
Member Author

shiftkey commented Mar 8, 2019

FYI: I've extracted the feedback from this PR that can also be applied to the Merge Conflicts dialog into #7043 - that can be picked up once this and #7030 are merged.

@shiftkey shiftkey requested a review from niik March 8, 2019 17:31
@shiftkey shiftkey removed the time-sensitive Pull Requests where reviews need to happen in a timely manner label Mar 8, 2019
// createUniqueId handles static strings fine, so in the case of receiving
// a JSX element for the title we can just pass in a fixed value rather
// than trying to generate a string from an arbitrary element
const id = typeof this.props.title === 'string' ? this.props.title : '???'
Copy link
Member

Choose a reason for hiding this comment

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

Not gonna hold up this from landing because of this but ??? stands out to me here. I would have preferred if we either left this code as it was, or that we made this constant something like JSX rather than triple question marks. It's entirely stylistic though so I'm gonna go ahead and approve and land this.

onSubmit={this.startRebase}
loading={loading}
disabled={disabled}
dismissable={true}
Copy link
Member

Choose a reason for hiding this comment

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

Again, stylistic, but dismissible is the default value so we could just omit this.

@niik niik merged commit ad2f25f into development Mar 11, 2019
@shiftkey shiftkey deleted the shiftkey/rebase/menu-item-and-dialog branch March 11, 2019 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Rebasing terms and UI "Rebase current branch" dialog and flow

3 participants