mirror of
https://github.com/desktop/desktop
synced 2024-09-19 08:02:22 +00:00
Merge branch 'master' into the-great-webpack-migration
This commit is contained in:
commit
340b489d61
|
@ -3,7 +3,7 @@
|
|||
"productName": "GitHub Desktop",
|
||||
"bundleID": "com.github.GitHubClient",
|
||||
"companyName": "GitHub, Inc.",
|
||||
"version": "1.1.2-beta7",
|
||||
"version": "1.2.1-beta0",
|
||||
"main": "./main.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -327,7 +327,7 @@ export type RepositorySection =
|
|||
| { selectedTab: RepositorySectionTab.Changes }
|
||||
| {
|
||||
selectedTab: RepositorySectionTab.History
|
||||
shouldFocusBranchList?: boolean
|
||||
shouldShowBranchesList?: boolean
|
||||
}
|
||||
|
||||
export interface IRepositoryState {
|
||||
|
|
|
@ -9,6 +9,7 @@ import {
|
|||
PopupType,
|
||||
FoldoutType,
|
||||
SelectionType,
|
||||
CompareActionKind,
|
||||
} from '../lib/app-state'
|
||||
import { Dispatcher } from '../lib/dispatcher'
|
||||
import { AppStore } from '../lib/stores'
|
||||
|
@ -489,17 +490,21 @@ export class App extends React.Component<IAppProps, IAppState> {
|
|||
this.props.dispatcher.showPopup({ type: PopupType.About })
|
||||
}
|
||||
|
||||
private showHistory(shouldFocusBranchList: boolean = false) {
|
||||
private async showHistory(shouldShowBranchesList: boolean = false) {
|
||||
const state = this.state.selectedState
|
||||
if (state == null || state.type !== SelectionType.Repository) {
|
||||
return
|
||||
}
|
||||
|
||||
this.props.dispatcher.closeCurrentFoldout()
|
||||
await this.props.dispatcher.closeCurrentFoldout()
|
||||
|
||||
this.props.dispatcher.changeRepositorySection(state.repository, {
|
||||
await this.props.dispatcher.initializeCompare(state.repository, {
|
||||
kind: CompareActionKind.History,
|
||||
})
|
||||
|
||||
await this.props.dispatcher.changeRepositorySection(state.repository, {
|
||||
selectedTab: RepositorySectionTab.History,
|
||||
shouldFocusBranchList,
|
||||
shouldShowBranchesList,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -1,19 +1,12 @@
|
|||
import * as React from 'react'
|
||||
import * as moment from 'moment'
|
||||
import * as classNames from 'classnames'
|
||||
|
||||
import { Branch } from '../../models/branch'
|
||||
|
||||
import { IMenuItem } from '../../lib/menu-item'
|
||||
import { HighlightText } from '../lib/highlight-text'
|
||||
|
||||
import { showContextualMenu } from '../main-process-proxy'
|
||||
import { Octicon, OcticonSymbol } from '../octicons'
|
||||
import { enableCompareSidebar } from '../../lib/feature-flag'
|
||||
import { HighlightText } from '../lib/highlight-text'
|
||||
|
||||
interface IBranchListItemProps {
|
||||
/** The name of the branch */
|
||||
readonly branch: Branch
|
||||
readonly name: string
|
||||
|
||||
/** Specifies whether this item is currently selected */
|
||||
readonly isCurrentBranch: boolean
|
||||
|
@ -23,84 +16,29 @@ interface IBranchListItemProps {
|
|||
|
||||
/** The characters in the branch name to highlight */
|
||||
readonly matches: ReadonlyArray<number>
|
||||
|
||||
/**
|
||||
* Callback to fire when the user wants to compare to this branch.
|
||||
*
|
||||
* If this is not specified, kebab element will not be rendered.
|
||||
*/
|
||||
readonly onCompareToBranch?: (branch: Branch) => void
|
||||
}
|
||||
|
||||
/** The branch component. */
|
||||
export class BranchListItem extends React.Component<IBranchListItemProps, {}> {
|
||||
private onContextMenu = (event: React.MouseEvent<any>) => {
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
||||
const items: IMenuItem[] = [
|
||||
{
|
||||
label: 'Compare to this branch',
|
||||
action: () => {
|
||||
if (this.props.onCompareToBranch) {
|
||||
this.props.onCompareToBranch(this.props.branch)
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
showContextualMenu(items)
|
||||
}
|
||||
|
||||
private renderKebab = (lastCommitDate: Date | null, infoTitle: string) => {
|
||||
if (this.props.onCompareToBranch == null) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (!enableCompareSidebar()) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="branches-list-item-menu" title={infoTitle}>
|
||||
<div className="branch-menu-wrapper" onClick={this.onContextMenu}>
|
||||
<Octicon symbol={OcticonSymbol.kebabHorizontal} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
public render() {
|
||||
const lastCommitDate = this.props.lastCommitDate
|
||||
const isCurrentBranch = this.props.isCurrentBranch
|
||||
const name = this.props.branch.name
|
||||
const name = this.props.name
|
||||
|
||||
const date = lastCommitDate ? moment(lastCommitDate).fromNow() : ''
|
||||
const icon = isCurrentBranch ? OcticonSymbol.check : OcticonSymbol.gitBranch
|
||||
const infoTitle = isCurrentBranch
|
||||
? 'Current branch'
|
||||
: lastCommitDate ? lastCommitDate.toString() : ''
|
||||
|
||||
const enableKebabEffect =
|
||||
enableCompareSidebar() &&
|
||||
!isCurrentBranch &&
|
||||
this.props.onCompareToBranch != null
|
||||
|
||||
const className = classNames('branches-list-item', {
|
||||
'kebab-effect': enableKebabEffect,
|
||||
})
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
<div className="branches-list-item">
|
||||
<Octicon className="icon" symbol={icon} />
|
||||
<div className="name" title={name}>
|
||||
<HighlightText text={name} highlight={this.props.matches} />
|
||||
</div>
|
||||
|
||||
<div className="description" title={infoTitle}>
|
||||
{date}
|
||||
</div>
|
||||
|
||||
{this.renderKebab(lastCommitDate, infoTitle)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -8,19 +8,17 @@ import { BranchListItem } from './branch-list-item'
|
|||
export function renderDefaultBranch(
|
||||
item: IBranchListItem,
|
||||
matches: ReadonlyArray<number>,
|
||||
currentBranch: Branch | null,
|
||||
onCompareToBranch?: (branch: Branch) => void
|
||||
currentBranch: Branch | null
|
||||
): JSX.Element {
|
||||
const branch = item.branch
|
||||
const commit = branch.tip
|
||||
const currentBranchName = currentBranch ? currentBranch.name : null
|
||||
return (
|
||||
<BranchListItem
|
||||
branch={branch}
|
||||
name={branch.name}
|
||||
isCurrentBranch={branch.name === currentBranchName}
|
||||
lastCommitDate={commit ? commit.author.date : null}
|
||||
matches={matches}
|
||||
onCompareToBranch={onCompareToBranch}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -7,13 +7,7 @@ import { Branch } from '../../models/branch'
|
|||
import { BranchesTab } from '../../models/branches-tab'
|
||||
|
||||
import { Dispatcher } from '../../lib/dispatcher'
|
||||
import {
|
||||
FoldoutType,
|
||||
PopupType,
|
||||
CompareActionKind,
|
||||
ComparisonView,
|
||||
RepositorySectionTab,
|
||||
} from '../../lib/app-state'
|
||||
import { FoldoutType, PopupType } from '../../lib/app-state'
|
||||
import { assertNever } from '../../lib/fatal-error'
|
||||
|
||||
import { TabBar } from '../tab-bar'
|
||||
|
@ -103,28 +97,11 @@ export class BranchesContainer extends React.Component<
|
|||
)
|
||||
}
|
||||
|
||||
private onCompareToBranch = async (branch: Branch) => {
|
||||
await this.props.dispatcher.initializeCompare(this.props.repository, {
|
||||
kind: CompareActionKind.Branch,
|
||||
branch,
|
||||
mode: ComparisonView.Behind,
|
||||
})
|
||||
await this.props.dispatcher.changeRepositorySection(this.props.repository, {
|
||||
selectedTab: RepositorySectionTab.History,
|
||||
})
|
||||
await this.props.dispatcher.closeFoldout(FoldoutType.Branch)
|
||||
}
|
||||
|
||||
private renderBranch = (
|
||||
item: IBranchListItem,
|
||||
matches: ReadonlyArray<number>
|
||||
) => {
|
||||
return renderDefaultBranch(
|
||||
item,
|
||||
matches,
|
||||
this.props.currentBranch,
|
||||
this.onCompareToBranch
|
||||
)
|
||||
return renderDefaultBranch(item, matches, this.props.currentBranch)
|
||||
}
|
||||
|
||||
private renderSelectedTab() {
|
||||
|
|
|
@ -35,9 +35,9 @@ interface ICompareSidebarProps {
|
|||
readonly sidebarHasFocusWithin: boolean
|
||||
|
||||
/**
|
||||
* Shows the branch list when the component is loaded
|
||||
* A flag from the application to indicate the branches list should be expanded.
|
||||
*/
|
||||
readonly initialShowBranchList: boolean
|
||||
readonly shouldShowBranchesList: boolean
|
||||
readonly onRevertCommit: (commit: Commit) => void
|
||||
readonly onViewCommitOnGitHub: (sha: string) => void
|
||||
}
|
||||
|
@ -68,42 +68,65 @@ export class CompareSidebar extends React.Component<
|
|||
public constructor(props: ICompareSidebarProps) {
|
||||
super(props)
|
||||
|
||||
const formState = props.compareState.formState
|
||||
|
||||
const filterText =
|
||||
formState.kind === ComparisonView.None
|
||||
? ''
|
||||
: formState.comparisonBranch.name
|
||||
|
||||
this.state = {
|
||||
focusedBranch: null,
|
||||
filterText,
|
||||
showBranchList: props.initialShowBranchList,
|
||||
filterText: '',
|
||||
showBranchList: props.shouldShowBranchesList,
|
||||
selectedCommit: null,
|
||||
}
|
||||
}
|
||||
|
||||
public componentWillReceiveProps(nextProps: ICompareSidebarProps) {
|
||||
const hasFormStateChanged =
|
||||
nextProps.compareState.formState.kind !==
|
||||
this.props.compareState.formState.kind
|
||||
|
||||
const newFormState = nextProps.compareState.formState
|
||||
const oldFormState = this.props.compareState.formState
|
||||
|
||||
if (hasFormStateChanged && newFormState.kind === ComparisonView.None) {
|
||||
// the comparison form should be reset to its default state
|
||||
this.setState({ filterText: '', focusedBranch: null })
|
||||
if (
|
||||
newFormState.kind !== oldFormState.kind &&
|
||||
newFormState.kind === ComparisonView.None
|
||||
) {
|
||||
// reset form to it's default state
|
||||
this.setState(
|
||||
{
|
||||
filterText: '',
|
||||
focusedBranch: null,
|
||||
showBranchList: nextProps.shouldShowBranchesList,
|
||||
},
|
||||
() => {
|
||||
// ensure filter text behaviour matches the prop value
|
||||
if (this.textbox !== null) {
|
||||
if (nextProps.shouldShowBranchesList) {
|
||||
this.textbox.focus()
|
||||
} else {
|
||||
this.textbox.blur()
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (newFormState.kind !== ComparisonView.None) {
|
||||
// ensure the filter text is in sync with the comparison branch
|
||||
const branch = newFormState.comparisonBranch
|
||||
if (
|
||||
newFormState.kind !== ComparisonView.None &&
|
||||
oldFormState.kind !== ComparisonView.None
|
||||
) {
|
||||
const oldBranch = oldFormState.comparisonBranch
|
||||
const newBranch = newFormState.comparisonBranch
|
||||
|
||||
this.setState({
|
||||
filterText: branch.name,
|
||||
focusedBranch: branch,
|
||||
})
|
||||
if (oldBranch.name !== newBranch.name) {
|
||||
// ensure the filter text is in sync with the comparison branch
|
||||
this.setState({
|
||||
filterText: newBranch.name,
|
||||
focusedBranch: newBranch,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
this.props.shouldShowBranchesList !== nextProps.shouldShowBranchesList
|
||||
) {
|
||||
if (nextProps.shouldShowBranchesList === true) {
|
||||
this.setState({ showBranchList: true })
|
||||
}
|
||||
}
|
||||
|
||||
if (nextProps.sidebarHasFocusWithin !== this.props.sidebarHasFocusWithin) {
|
||||
|
@ -290,8 +313,7 @@ export class CompareSidebar extends React.Component<
|
|||
<div className="merge-message">
|
||||
This will merge
|
||||
<strong>{` ${count} ${pluralized}`}</strong>
|
||||
<br />
|
||||
from{` `}
|
||||
{` `}from{` `}
|
||||
<strong>{branch.name}</strong>
|
||||
{` `}into{` `}
|
||||
<strong>{currentBranch.name}</strong>
|
||||
|
|
|
@ -158,9 +158,9 @@ export class RepositoryView extends React.Component<
|
|||
const tip = this.props.state.branchesState.tip
|
||||
const currentBranch = tip.kind === TipState.Valid ? tip.branch : null
|
||||
const selectedSection = this.props.state.selectedSection
|
||||
const focusBranchSelector =
|
||||
const shouldShowBranchesList =
|
||||
selectedSection.selectedTab === RepositorySectionTab.History
|
||||
? selectedSection.shouldFocusBranchList || false
|
||||
? selectedSection.shouldShowBranchesList || false
|
||||
: false
|
||||
|
||||
return (
|
||||
|
@ -176,7 +176,7 @@ export class RepositoryView extends React.Component<
|
|||
onRevertCommit={this.onRevertCommit}
|
||||
onViewCommitOnGitHub={this.props.onViewCommitOnGitHub}
|
||||
sidebarHasFocusWithin={this.state.sidebarHasFocusWithin}
|
||||
initialShowBranchList={focusBranchSelector}
|
||||
shouldShowBranchesList={shouldShowBranchesList}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ export class RepositoryView extends React.Component<
|
|||
? { selectedTab: RepositorySectionTab.Changes }
|
||||
: {
|
||||
selectedTab: RepositorySectionTab.History,
|
||||
shouldFocusBranchList: false,
|
||||
shouldShowBranchesList: false,
|
||||
}
|
||||
|
||||
this.props.dispatcher.changeRepositorySection(
|
||||
|
@ -320,7 +320,7 @@ export class RepositoryView extends React.Component<
|
|||
tab === Tab.History
|
||||
? {
|
||||
selectedTab: RepositorySectionTab.History,
|
||||
shouldFocusBranchList: false,
|
||||
shouldShowBranchesList: false,
|
||||
}
|
||||
: { selectedTab: RepositorySectionTab.Changes }
|
||||
|
||||
|
|
|
@ -189,13 +189,16 @@
|
|||
}
|
||||
|
||||
.branches-list {
|
||||
&-item {
|
||||
padding: 0 var(--spacing);
|
||||
}
|
||||
|
||||
&-item {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
min-width: 0;
|
||||
flex-grow: 1;
|
||||
align-items: center;
|
||||
padding: 0 var(--spacing);
|
||||
|
||||
.icon {
|
||||
margin-right: var(--spacing-half);
|
||||
|
@ -218,44 +221,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.branches-list-item-menu {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.kebab-effect:hover {
|
||||
.description {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.branches-list-item-menu {
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.branch-menu-wrapper {
|
||||
display: flex;
|
||||
margin: var(--spacing);
|
||||
margin-right: 0;
|
||||
padding: 0 var(--spacing);
|
||||
border-radius: var(--border-radius);
|
||||
transition: background 0.15s;
|
||||
|
||||
.octicon {
|
||||
fill: var(--text-secondary-color);
|
||||
transition: fill 0.15s;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: rgba($gray-500, 0.2);
|
||||
|
||||
.octicon {
|
||||
fill: var(--text-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.description {
|
||||
margin-right: var(--spacing-half);
|
||||
color: var(--text-secondary-color);
|
||||
|
|
|
@ -1,8 +1,43 @@
|
|||
{
|
||||
"releases": {
|
||||
"1.2.1-beta0": [
|
||||
|
||||
],
|
||||
"1.1.2-test6": [
|
||||
"Testing the Webpack v4 output from the project"
|
||||
],
|
||||
"1.2.0": [
|
||||
"[New] History now has ability to compare to another branch and merge outstanding commits",
|
||||
"[New] Support for selecting more than one file in the changes list - #1712. Thanks @icosamuel!",
|
||||
"[New] Render bitmap images in diffs - #4367. Thanks @MagicMarvMan!",
|
||||
"[Added] Add PowerShell Core support for Windows and macOS - #3791. Thanks @saschanaz!",
|
||||
"[Added] Add MacVim support for macOS - #4532. Thanks @johnelliott!",
|
||||
"[Added] Syntax highlighting for JavaServer Pages (JSP) - #4470. Thanks @damaneice!",
|
||||
"[Added] Syntax highlighting for Haxe files - #4445. Thanks @Gama11!",
|
||||
"[Added] Syntax highlighting for R files - #4455. Thanks @say25!",
|
||||
"[Fixed] 'Open in Shell' on Linux ensures Git is on PATH - #4619. Thanks @ziggy42!",
|
||||
"[Fixed] Pressing 'Enter' on filtered Pull Request does not checkout - #4673",
|
||||
"[Fixed] Alert icon shrinks in rename dialog when branch name is long - #4566",
|
||||
"[Fixed] 'Open in Desktop' performs fetch to ensure branch exists before checkout - #3006",
|
||||
"[Fixed] 'Open in Default Program' on Windows changes the window title - #4446",
|
||||
"[Fixed] Skip fast-forwarding when there are many eligible local branches - #4392",
|
||||
"[Fixed] Image diffs not working for files with upper-case file extension - #4466",
|
||||
"[Fixed] Syntax highlighting not working for files with upper-case file extension - #4462. Thanks @say25!",
|
||||
"[Fixed] Error when creating Git LFS progress causes clone to fail - #4307. Thanks @MagicMarvMan!",
|
||||
"[Fixed] 'Open File in External Editor' always opens a new instance - #4381",
|
||||
"[Fixed] 'Select All' shortcut now works for changes list - #3821",
|
||||
"[Improved] Automatically add valid repository when using command line interface - #4513. Thanks @ggajos!",
|
||||
"[Improved] Always fast-forward the default branch - #4506",
|
||||
"[Improved] Warn when trying to rename a published branch - #4035. Thanks @agisilaos!",
|
||||
"[Improved] Added context menu for files in commit history - #2845. Thanks @crea7or",
|
||||
"[Improved] Discarding all changes always prompts for confirmation - #4459",
|
||||
"[Improved] Getting list of changed files is now more efficient when dealing with thousands of files - #4443",
|
||||
"[Improved] Checking out a Pull Request may skip unnecessary fetch - #4068. Thanks @agisilaos!",
|
||||
"[Improved] Commit summary now has a hint to indicate why committing is disabled - #4429.",
|
||||
"[Improved] Pull request status text now matches format on GitHub - #3521",
|
||||
"[Improved] Add escape hatch to disable hardware acceleration when launching - #3921"
|
||||
>>>>>>> master
|
||||
],
|
||||
"1.1.2-beta7": [
|
||||
],
|
||||
"1.1.2-beta6": [
|
||||
|
|
Loading…
Reference in a new issue