"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "app/src/ui/branches/branches-container.tsx" between
desktop-release-2.7.2-linux1.tar.gz and desktop-release-2.8.0-linux1.tar.gz

About: GitHub Desktop (Linux) is an open source Electron-based GitHub app. It is written in TypeScript and uses React. A fork of GitHub Desktop to support various Linux distributions. Release candidate.

branches-container.tsx  (desktop-release-2.7.2-linux1):branches-container.tsx  (desktop-release-2.8.0-linux1)
skipping to change at line 28 skipping to change at line 28
import { Row } from '../lib/row' import { Row } from '../lib/row'
import { Octicon, OcticonSymbol } from '../octicons' import { Octicon, OcticonSymbol } from '../octicons'
import { Button } from '../lib/button' import { Button } from '../lib/button'
import { BranchList } from './branch-list' import { BranchList } from './branch-list'
import { PullRequestList } from './pull-request-list' import { PullRequestList } from './pull-request-list'
import { IBranchListItem } from './group-branches' import { IBranchListItem } from './group-branches'
import { renderDefaultBranch } from './branch-renderer' import { renderDefaultBranch } from './branch-renderer'
import { IMatches } from '../../lib/fuzzy-find' import { IMatches } from '../../lib/fuzzy-find'
import { startTimer } from '../lib/timing' import { startTimer } from '../lib/timing'
import { dragAndDropManager } from '../../lib/drag-and-drop-manager'
interface IBranchesContainerProps { interface IBranchesContainerProps {
readonly dispatcher: Dispatcher readonly dispatcher: Dispatcher
readonly repository: Repository readonly repository: Repository
readonly selectedTab: BranchesTab readonly selectedTab: BranchesTab
readonly allBranches: ReadonlyArray<Branch> readonly allBranches: ReadonlyArray<Branch>
readonly defaultBranch: Branch | null readonly defaultBranch: Branch | null
readonly currentBranch: Branch | null readonly currentBranch: Branch | null
readonly recentBranches: ReadonlyArray<Branch> readonly recentBranches: ReadonlyArray<Branch>
readonly pullRequests: ReadonlyArray<PullRequest> readonly pullRequests: ReadonlyArray<PullRequest>
skipping to change at line 198 skipping to change at line 199
allBranches={this.props.allBranches} allBranches={this.props.allBranches}
recentBranches={this.props.recentBranches} recentBranches={this.props.recentBranches}
onItemClick={this.onBranchItemClick} onItemClick={this.onBranchItemClick}
filterText={this.state.branchFilterText} filterText={this.state.branchFilterText}
onFilterTextChanged={this.onBranchFilterTextChanged} onFilterTextChanged={this.onBranchFilterTextChanged}
selectedBranch={this.state.selectedBranch} selectedBranch={this.state.selectedBranch}
onSelectionChanged={this.onBranchSelectionChanged} onSelectionChanged={this.onBranchSelectionChanged}
canCreateNewBranch={true} canCreateNewBranch={true}
onCreateNewBranch={this.onCreateBranchWithName} onCreateNewBranch={this.onCreateBranchWithName}
renderBranch={this.renderBranch} renderBranch={this.renderBranch}
hideFilterRow={
this.props.isCherryPickInProgress &&
dragAndDropManager.isDragInProgress
}
renderPreList={this.renderPreList}
/> />
) )
case BranchesTab.PullRequests: { case BranchesTab.PullRequests: {
return this.renderPullRequests() return this.renderPullRequests()
} }
default: default:
return assertNever(tab, `Unknown Branches tab: ${tab}`) return assertNever(tab, `Unknown Branches tab: ${tab}`)
} }
} }
private renderPreList = () => {
if (
!this.props.isCherryPickInProgress ||
!dragAndDropManager.isDragInProgress
) {
return null
}
const label = __DARWIN__ ? 'New Branch' : 'New branch'
return (
<div
className="branches-list-item new-branch-drop"
onMouseEnter={this.onMouseEnterNewBranchDrop}
onMouseLeave={this.onMouseLeaveNewBranchDrop}
onMouseUp={this.onMouseUpNewBranchDrop}
>
<Octicon className="icon" symbol={OcticonSymbol.plus} />
<div className="name" title={label}>
{label}
</div>
</div>
)
}
private onMouseUpNewBranchDrop = () => {
if (!this.props.isCherryPickInProgress) {
return
}
this.props.dispatcher.setCherryPickCreateBranchFlowStep(
this.props.repository,
''
)
}
private onMouseEnterNewBranchDrop = () => {
// This is just used for displaying on windows drag ghost.
// Thus, it doesn't have to be an actual branch name.
this.props.onDragEnterBranch('a new branch')
}
private onMouseLeaveNewBranchDrop = () => {
this.props.onDragLeaveBranch()
}
private renderPullRequests() { private renderPullRequests() {
const repository = this.props.repository const repository = this.props.repository
if (!isRepositoryWithGitHubRepository(repository)) { if (!isRepositoryWithGitHubRepository(repository)) {
return null return null
} }
const isOnDefaultBranch = const isOnDefaultBranch =
this.props.defaultBranch && this.props.defaultBranch &&
this.props.currentBranch && this.props.currentBranch &&
this.props.defaultBranch.name === this.props.currentBranch.name this.props.defaultBranch.name === this.props.currentBranch.name
skipping to change at line 308 skipping to change at line 360
return return
} }
this.props.dispatcher.showPopup({ this.props.dispatcher.showPopup({
type: PopupType.RenameBranch, type: PopupType.RenameBranch,
repository: this.props.repository, repository: this.props.repository,
branch: branch, branch: branch,
}) })
} }
private onDeleteBranch = (branchName: string) => { private onDeleteBranch = async (branchName: string) => {
const branch = this.getBranchWithName(branchName) const branch = this.getBranchWithName(branchName)
if (branch === undefined) { if (branch === undefined) {
return return
} }
if (branch.type === BranchType.Remote) { if (branch.type === BranchType.Remote) {
this.props.dispatcher.showPopup({ this.props.dispatcher.showPopup({
type: PopupType.DeleteRemoteBranch, type: PopupType.DeleteRemoteBranch,
repository: this.props.repository, repository: this.props.repository,
branch, branch,
}) })
return return
} }
const aheadBehind = await this.props.dispatcher.getBranchAheadBehind(
this.props.repository,
branch
)
this.props.dispatcher.showPopup({ this.props.dispatcher.showPopup({
type: PopupType.DeleteBranch, type: PopupType.DeleteBranch,
repository: this.props.repository, repository: this.props.repository,
branch, branch,
existsOnRemote: branch.upstreamRemoteName !== null, existsOnRemote: aheadBehind !== null,
}) })
} }
/** /**
* Method is to handle when something is dragged and dropped onto a branch * Method is to handle when something is dragged and dropped onto a branch
* in the branch dropdown. * in the branch dropdown.
* *
* Currently this is being implemented with cherry picking. But, this could be * Currently this is being implemented with cherry picking. But, this could be
* expanded if we ever dropped something else on a branch; in which case, * expanded if we ever dropped something else on a branch; in which case,
* we would likely have to check the app state to see what action is being * we would likely have to check the app state to see what action is being
 End of changes. 6 change blocks. 
2 lines changed or deleted 58 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)