Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Merge b720c7d into a70b713
Browse files Browse the repository at this point in the history
  • Loading branch information
kuychaco committed Nov 30, 2018
2 parents a70b713 + b720c7d commit 0d10542
Show file tree
Hide file tree
Showing 63 changed files with 2,994 additions and 502 deletions.
10 changes: 10 additions & 0 deletions keymaps/git.cson
Expand Up @@ -39,13 +39,23 @@
'.github-CommitView-editor atom-text-editor:not([mini])':
'cmd-enter': 'github:commit'
'ctrl-enter': 'github:commit'
'tab': 'core:focus-next'
'shift-tab': 'core:focus-previous'

'.github-CommitView-commitPreview':
'cmd-left': 'github:dive'
'ctrl-left': 'github:dive'
'enter': 'native!'

'.github-RecentCommits':
'enter': 'github:dive'
'cmd-left': 'github:dive'
'ctrl-left': 'github:dive'

'.github-CommitDetailView':
'cmd-right': 'github:surface'
'ctrl-right': 'github:surface'

'.github-FilePatchView atom-text-editor:not([mini])':
'cmd-/': 'github:toggle-patch-selection-mode'
'ctrl-/': 'github:toggle-patch-selection-mode'
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions lib/containers/commit-detail-container.js
@@ -0,0 +1,45 @@
import React from 'react';
import PropTypes from 'prop-types';
import yubikiri from 'yubikiri';

import ObserveModel from '../views/observe-model';
import LoadingView from '../views/loading-view';
import CommitDetailController from '../controllers/commit-detail-controller';

export default class CommitDetailContainer extends React.Component {
static propTypes = {
repository: PropTypes.object.isRequired,
sha: PropTypes.string.isRequired,
itemType: PropTypes.func.isRequired,
}

fetchData = repository => {
return yubikiri({
commit: repository.getCommit(this.props.sha),
currentBranch: repository.getCurrentBranch(),
currentRemote: async query => repository.getRemoteForBranch((await query.currentBranch).getName()),
isCommitPushed: repository.isCommitPushed(this.props.sha),
});
}

render() {
return (
<ObserveModel model={this.props.repository} fetchData={this.fetchData}>
{this.renderResult}
</ObserveModel>
);
}

renderResult = data => {
if (this.props.repository.isLoading() || data === null || !data.commit.isPresent()) {
return <LoadingView />;
}

return (
<CommitDetailController
{...data}
{...this.props}
/>
);
}
}
4 changes: 4 additions & 0 deletions lib/containers/issueish-detail-container.js
Expand Up @@ -26,6 +26,8 @@ export default class IssueishDetailContainer extends React.Component {

switchToIssueish: PropTypes.func.isRequired,
onTitleChange: PropTypes.func.isRequired,

workspace: PropTypes.object.isRequired,
}

constructor(props) {
Expand Down Expand Up @@ -169,6 +171,8 @@ export default class IssueishDetailContainer extends React.Component {
addRemote={repository.addRemote.bind(repository)}
onTitleChange={this.props.onTitleChange}
switchToIssueish={this.props.switchToIssueish}
workdirPath={repository.getWorkingDirectoryPath()}
workspace={this.props.workspace}
/>
);
}
Expand Down
18 changes: 7 additions & 11 deletions lib/controllers/commit-controller.js
Expand Up @@ -76,7 +76,7 @@ export default class CommitController extends React.Component {
}),
this.props.workspace.onDidDestroyPaneItem(async ({item}) => {
if (this.props.repository.isPresent() && item.getPath && item.getPath() === this.getCommitMessagePath() &&
this.getCommitMessageEditors().length === 0) {
this.getCommitMessageEditors().length === 0) {
// we closed the last editor pointing to the commit message file
try {
this.commitMessageBuffer.setText(await fs.readFile(this.getCommitMessagePath(), {encoding: 'utf8'}));
Expand Down Expand Up @@ -252,24 +252,20 @@ export default class CommitController extends React.Component {
this.grammarSubscription.dispose();
}

rememberFocus(event) {
return this.refCommitView.map(view => view.rememberFocus(event)).getOr(null);
getFocus(element) {
return this.refCommitView.map(view => view.getFocus(element)).getOr(null);
}

setFocus(focus) {
return this.refCommitView.map(view => view.setFocus(focus)).getOr(false);
}

advanceFocus(...args) {
return this.refCommitView.map(view => view.advanceFocus(...args)).getOr(false);
advanceFocusFrom(...args) {
return this.refCommitView.map(view => view.advanceFocusFrom(...args)).getOr(false);
}

retreatFocus(...args) {
return this.refCommitView.map(view => view.retreatFocus(...args)).getOr(false);
}

hasFocusAtBeginning() {
return this.refCommitView.map(view => view.hasFocusAtBeginning()).getOr(false);
retreatFocusFrom(...args) {
return this.refCommitView.map(view => view.retreatFocusFrom(...args)).getOr(false);
}

toggleCommitPreview() {
Expand Down

0 comments on commit 0d10542

Please sign in to comment.