From 672a697e979f6f103d02b56c0ad52065027bb05b Mon Sep 17 00:00:00 2001 From: simurai Date: Thu, 15 Dec 2016 16:18:08 +0900 Subject: [PATCH 1/3] Rename CSS classes from git -> github --- keymaps/git.cson | 8 +++--- lib/controllers/file-patch-controller.js | 4 +-- lib/controllers/status-bar-tile-controller.js | 6 ++-- lib/views/branch-menu-view.js | 16 +++++------ lib/views/branch-view.js | 2 +- lib/views/changed-files-count-view.js | 2 +- lib/views/commit-view.js | 14 +++++----- lib/views/file-patch-list-item-view.js | 6 ++-- lib/views/file-patch-view.js | 2 +- lib/views/git-panel-view.js | 10 +++---- lib/views/hunk-view.js | 18 ++++++------ lib/views/merge-conflict-list-item-view.js | 12 ++++---- lib/views/prompt.js | 6 ++-- lib/views/push-pull-menu-view.js | 12 ++++---- lib/views/push-pull-view.js | 10 +++---- lib/views/staging-view.js | 28 +++++++++---------- styles/branch-menu-view.less | 2 +- styles/changed-files-count-view.less | 2 +- styles/commit-view.less | 2 +- styles/file-patch-list-view.less | 8 +++--- styles/file-patch-view.less | 2 +- styles/git-panel.less | 2 +- styles/hunk-view.less | 12 ++++---- styles/pane-view.less | 2 +- styles/prompt.less | 2 +- styles/push-pull-menu-view.less | 10 +++---- styles/push-pull-view.less | 2 +- styles/staging-view.less | 2 +- styles/status-bar-tile-controller.less | 2 +- .../status-bar-tile-controller.test.js | 12 ++++---- test/views/hunk-view.test.js | 12 ++++---- 31 files changed, 115 insertions(+), 115 deletions(-) diff --git a/keymaps/git.cson b/keymaps/git.cson index d500d9e7fe..16e51ebf5a 100644 --- a/keymaps/git.cson +++ b/keymaps/git.cson @@ -4,19 +4,19 @@ '.platform-win32, .platform-linux': 'alt-shift-c': 'git:toggle-git-panel' -'.git-StagingView': +'.github-StagingView': 'left': 'git:focus-diff-view' -'.git-CommitView-editor atom-text-editor:not([mini])': +'.github-CommitView-editor atom-text-editor:not([mini])': 'cmd-enter': 'git:commit' 'ctrl-enter': 'git:commit' -'.git-FilePatchView': +'.github-FilePatchView': '/': 'git:toggle-patch-selection-mode' 'tab': 'git:select-next-hunk' 'shift-tab': 'git:select-previous-hunk' 'right': 'git:focus-git-panel' -'.git-Prompt-input': +'.github-Prompt-input': 'enter': 'core:confirm' 'esc': 'core:cancel' diff --git a/lib/controllers/file-patch-controller.js b/lib/controllers/file-patch-controller.js index 514c87a8d4..0171fa94b3 100644 --- a/lib/controllers/file-patch-controller.js +++ b/lib/controllers/file-patch-controller.js @@ -34,14 +34,14 @@ export default class FilePatchController { const hunks = this.props.filePatch.getHunks(); if (!hunks.length) { return ( -
+
File has no contents
); } else { // NOTE: Outer div is required for etch to render elements correctly return ( -
+
+
+
{this.textEditorWidget}
); @@ -106,7 +106,7 @@ export default class BranchMenuView { const selectBranchView = ( Amend - -
+
{this.getRemainingCharacters()}
diff --git a/lib/views/file-patch-list-item-view.js b/lib/views/file-patch-list-item-view.js index db5471a067..47a3ccef7a 100644 --- a/lib/views/file-patch-list-item-view.js +++ b/lib/views/file-patch-list-item-view.js @@ -24,9 +24,9 @@ export default class FilePatchListItemView { const className = selected ? 'is-selected' : ''; return ( -
- - {filePatch.filePath} +
+ + {filePatch.filePath}
); } diff --git a/lib/views/file-patch-view.js b/lib/views/file-patch-view.js index 319294c0d0..fd1fbfd53d 100644 --- a/lib/views/file-patch-view.js +++ b/lib/views/file-patch-view.js @@ -61,7 +61,7 @@ export default class FilePatchView { const hunkSelectionMode = this.selection.getMode() === 'hunk'; const stageButtonLabelPrefix = this.props.stagingStatus === 'unstaged' ? 'Stage' : 'Unstage'; return ( -
{this.props.hunks.map(hunk => { diff --git a/lib/views/git-panel-view.js b/lib/views/git-panel-view.js index a6cd90394b..429b42eaf2 100644 --- a/lib/views/git-panel-view.js +++ b/lib/views/git-panel-view.js @@ -21,19 +21,19 @@ export default class GitPanelView { render() { if (!this.props.repository) { return ( -
-
No repository for active pane item
+
+
No repository for active pane item
); } else if (this.props.fetchInProgress) { return ( -
-
Fetching repository data
+
+
Fetching repository data
); } else { return ( -
+
-
+
this.props.mousedownOnHeader()}> - {this.props.hunk.getHeader()} + {this.props.hunk.getHeader()} -
+
-
+
); } diff --git a/lib/views/push-pull-view.js b/lib/views/push-pull-view.js index 20ee5a42aa..1a520f6cff 100644 --- a/lib/views/push-pull-view.js +++ b/lib/views/push-pull-view.js @@ -17,13 +17,13 @@ export default class PushPullView { render() { return ( -
- - +
+ + {this.props.behindCount ? `${this.props.behindCount}` : ''} - - + + {this.props.aheadCount ? `${this.props.aheadCount}` : ''}
diff --git a/lib/views/staging-view.js b/lib/views/staging-view.js index dae6d156da..304abaf3dd 100644 --- a/lib/views/staging-view.js +++ b/lib/views/staging-view.js @@ -200,16 +200,16 @@ export default class StagingView { return (
-
-
+
+
- Unstaged Changes + Unstaged Changes
-
+
{ this.props.unstagedChanges.map(filePatch => (
{ this.renderMergeConflicts() } -
-
+
+
- + Staged Changes { this.props.isAmending @@ -237,7 +237,7 @@ export default class StagingView { }
-
+
{ this.props.stagedChanges.map(filePatch => ( 0) { const selectedItems = this.selection.getSelectedItems(); return ( -
-
- - Merge Conflicts +
+
+ + Merge Conflicts
-
+
{ mergeConflicts.map(mergeConflict => ( { // FIXME: Remove this guard when 1.13 is on stable. if (parseFloat(atom.getVersion() >= 1.13)) { - assert.isUndefined(document.querySelectorAll('.git-BranchMenuView')[0]); + assert.isUndefined(document.querySelectorAll('.github-BranchMenuView')[0]); branchView.element.click(); - assert.isDefined(document.querySelectorAll('.git-BranchMenuView')[0]); + assert.isDefined(document.querySelectorAll('.github-BranchMenuView')[0]); branchView.element.click(); - assert.isUndefined(document.querySelectorAll('.git-BranchMenuView')[0]); + assert.isUndefined(document.querySelectorAll('.github-BranchMenuView')[0]); } }); @@ -196,11 +196,11 @@ describe('StatusBarTileController', () => { // FIXME: Remove this guard when 1.13 is on stable. if (parseFloat(atom.getVersion() >= 1.13)) { - assert.isUndefined(document.querySelectorAll('.git-PushPullMenuView')[0]); + assert.isUndefined(document.querySelectorAll('.github-PushPullMenuView')[0]); pushPullView.element.click(); - assert.isDefined(document.querySelectorAll('.git-PushPullMenuView')[0]); + assert.isDefined(document.querySelectorAll('.github-PushPullMenuView')[0]); pushPullView.element.click(); - assert.isUndefined(document.querySelectorAll('.git-PushPullMenuView')[0]); + assert.isUndefined(document.querySelectorAll('.github-PushPullMenuView')[0]); } }); diff --git a/test/views/hunk-view.test.js b/test/views/hunk-view.test.js index c8fdbdd441..e6f0c1a2b6 100644 --- a/test/views/hunk-view.test.js +++ b/test/views/hunk-view.test.js @@ -17,7 +17,7 @@ describe('HunkView', () => { const view = new HunkView({hunk: hunk1, selectedLines: new Set()}); const element = view.element; // eslint-disable-next-line prefer-const - let [line1, line2, line3, line4] = Array.from(element.querySelectorAll('.git-HunkView-line')); + let [line1, line2, line3, line4] = Array.from(element.querySelectorAll('.github-HunkView-line')); assert.equal(view.refs.header.textContent, hunk1.getHeader()); assertHunkLineElementEqual( @@ -41,7 +41,7 @@ describe('HunkView', () => { new HunkLine('line-1', 'deleted', 8, -1), new HunkLine('line-2', 'added', -1, 8), ]); - const lines = Array.from(element.querySelectorAll('.git-HunkView-line')); + const lines = Array.from(element.querySelectorAll('.github-HunkView-line')); line1 = lines[0]; line2 = lines[1]; @@ -105,7 +105,7 @@ describe('HunkView', () => { // selectLine callback not called when selectionEnabled = false const view = new HunkView({hunk, selectedLines: new Set(), mousedownOnLine, mousemoveOnLine, selectionEnabled: false}); const element = view.element; - const lineElements = Array.from(element.querySelectorAll('.git-HunkView-line')); + const lineElements = Array.from(element.querySelectorAll('.github-HunkView-line')); const mousedownEvent = new MouseEvent('mousedown'); lineElements[0].dispatchEvent(mousedownEvent); assert.deepEqual(mousedownOnLine.args[0], [mousedownEvent, hunk, hunk.lines[0]]); @@ -125,8 +125,8 @@ describe('HunkView', () => { }); function assertHunkLineElementEqual(lineElement, {oldLineNumber, newLineNumber, origin, content, isSelected}) { - assert.equal(lineElement.querySelector('.git-HunkView-lineNumber.is-old').textContent, oldLineNumber); - assert.equal(lineElement.querySelector('.git-HunkView-lineNumber.is-new').textContent, newLineNumber); - assert.equal(lineElement.querySelector('.git-HunkView-lineContent').textContent, origin + content); + assert.equal(lineElement.querySelector('.github-HunkView-lineNumber.is-old').textContent, oldLineNumber); + assert.equal(lineElement.querySelector('.github-HunkView-lineNumber.is-new').textContent, newLineNumber); + assert.equal(lineElement.querySelector('.github-HunkView-lineContent').textContent, origin + content); assert.equal(lineElement.classList.contains('is-selected'), isSelected); } From 1df15e7e8cf6616e3fbb3507c02239dbb5c13979 Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Thu, 15 Dec 2016 08:14:48 -0500 Subject: [PATCH 2/3] Split line that was over the maximum line length --- lib/views/commit-view.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/views/commit-view.js b/lib/views/commit-view.js index d58908b2e6..2d3bad71f3 100644 --- a/lib/views/commit-view.js +++ b/lib/views/commit-view.js @@ -109,7 +109,8 @@ export default class CommitView { -
+
{this.getRemainingCharacters()}
From cdaa9175da17c14fcc990d6b039d50c04b6e9a77 Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Thu, 15 Dec 2016 08:17:01 -0500 Subject: [PATCH 3/3] Rename `git:` commands to `github:` --- keymaps/git.cson | 18 +++++++++--------- lib/controllers/git-controller.js | 4 ++-- lib/views/commit-view.js | 2 +- lib/views/file-patch-view.js | 2 +- lib/views/staging-view.js | 6 +++--- menus/git.cson | 4 ++-- test/views/commit-view.test.js | 12 ++++++------ 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/keymaps/git.cson b/keymaps/git.cson index 16e51ebf5a..f6ba953f13 100644 --- a/keymaps/git.cson +++ b/keymaps/git.cson @@ -1,21 +1,21 @@ '.platform-darwin': - 'cmd-shift-c': 'git:toggle-git-panel' + 'cmd-shift-c': 'github:toggle-git-panel' '.platform-win32, .platform-linux': - 'alt-shift-c': 'git:toggle-git-panel' + 'alt-shift-c': 'github:toggle-git-panel' '.github-StagingView': - 'left': 'git:focus-diff-view' + 'left': 'github:focus-diff-view' '.github-CommitView-editor atom-text-editor:not([mini])': - 'cmd-enter': 'git:commit' - 'ctrl-enter': 'git:commit' + 'cmd-enter': 'github:commit' + 'ctrl-enter': 'github:commit' '.github-FilePatchView': - '/': 'git:toggle-patch-selection-mode' - 'tab': 'git:select-next-hunk' - 'shift-tab': 'git:select-previous-hunk' - 'right': 'git:focus-git-panel' + '/': 'github:toggle-patch-selection-mode' + 'tab': 'github:select-next-hunk' + 'shift-tab': 'github:select-previous-hunk' + 'right': 'github:focus-git-panel' '.github-Prompt-input': 'enter': 'core:confirm' diff --git a/lib/controllers/git-controller.js b/lib/controllers/git-controller.js index 14822c4686..9052ffa791 100644 --- a/lib/controllers/git-controller.js +++ b/lib/controllers/git-controller.js @@ -60,8 +60,8 @@ export default class GitController extends React.Component { this.subscriptions = new CompositeDisposable(); this.subscriptions.add( props.commandRegistry.add('atom-workspace', { - 'git:toggle-git-panel': this.toggleGitPanel.bind(this), - 'git:focus-git-panel': this.openAndFocusGitPanel.bind(this), + 'github:toggle-git-panel': this.toggleGitPanel.bind(this), + 'github:focus-git-panel': this.openAndFocusGitPanel.bind(this), }), ); diff --git a/lib/views/commit-view.js b/lib/views/commit-view.js index 2d3bad71f3..62b997ec38 100644 --- a/lib/views/commit-view.js +++ b/lib/views/commit-view.js @@ -18,7 +18,7 @@ export default class CommitView { this.subscriptions = new CompositeDisposable( this.editor.onDidChangeCursorPosition(() => { etch.update(this); }), this.editor.getBuffer().onDidChangeText(() => { etch.update(this); }), - props.commandRegistry.add(this.element, {'git:commit': () => this.commit()}), + props.commandRegistry.add(this.element, {'github:commit': () => this.commit()}), ); this.setMessageAndAmendStatus(); this.updateStateForRepository(); diff --git a/lib/views/file-patch-view.js b/lib/views/file-patch-view.js index fd1fbfd53d..5d2d65d44e 100644 --- a/lib/views/file-patch-view.js +++ b/lib/views/file-patch-view.js @@ -28,7 +28,7 @@ export default class FilePatchView { etch.initialize(this); this.disposables.add(atom.commands.add(this.element, { - 'git:toggle-patch-selection-mode': this.togglePatchSelectionMode.bind(this), + 'github:toggle-patch-selection-mode': this.togglePatchSelectionMode.bind(this), 'core:confirm': () => this.didConfirm(), 'core:move-up': () => this.selectPrevious(), 'core:move-down': () => this.selectNext(), diff --git a/lib/views/staging-view.js b/lib/views/staging-view.js index 304abaf3dd..ceff077e7a 100644 --- a/lib/views/staging-view.js +++ b/lib/views/staging-view.js @@ -60,9 +60,9 @@ export default class StagingView { 'core:select-to-top': () => this.selectFirst(true), 'core:select-to-bottom': () => this.selectLast(true), 'core:confirm': () => this.confirmSelectedItems(), - 'git:activate-next-list': () => this.activateNextList(), - 'git:activate-previous-list': () => this.activatePreviousList(), - 'git:focus-diff-view': () => this.props.focusFilePatchView(), + 'github:activate-next-list': () => this.activateNextList(), + 'github:activate-previous-list': () => this.activatePreviousList(), + 'github:focus-diff-view': () => this.props.focusFilePatchView(), })); window.addEventListener('mouseup', this.mouseup); this.subscriptions.add(new Disposable(() => window.removeEventListener('mouseup', this.mouseup))); diff --git a/menus/git.cson b/menus/git.cson index 2ba950c065..bd9224a103 100644 --- a/menus/git.cson +++ b/menus/git.cson @@ -4,7 +4,7 @@ 'submenu': [ { 'label': 'Toggle Git Panel' - 'command': 'git:toggle-git-panel' + 'command': 'github:toggle-git-panel' } ] } @@ -16,7 +16,7 @@ 'submenu': [ { 'label': 'Toggle' - 'command': 'git:toggle-git-panel' + 'command': 'github:toggle-git-panel' } ] } diff --git a/test/views/commit-view.test.js b/test/views/commit-view.test.js index c0caaf0c88..8da5aed677 100644 --- a/test/views/commit-view.test.js +++ b/test/views/commit-view.test.js @@ -118,7 +118,7 @@ describe('CommitView', () => { assert.isTrue(commitButton.disabled); }); - it('calls props.commit(message) when the commit button is clicked or git:commit is dispatched', async () => { + it('calls props.commit(message) when the commit button is clicked or github:commit is dispatched', async () => { const workdirPath = await cloneRepository('three-files'); const repository = await buildRepository(workdirPath); const commit = sinon.spy(); @@ -138,22 +138,22 @@ describe('CommitView', () => { commandRegistry.dispatch(editor.element, 'core:undo'); assert.equal(editor.getText(), ''); - // commit via the git:commit command + // commit via the github:commit command commit.reset(); await view.update({repository, stagedChangesExist: true}); editor.setText('Commit 2'); await etch.getScheduler().getNextUpdatePromise(); - commandRegistry.dispatch(editor.element, 'git:commit'); + commandRegistry.dispatch(editor.element, 'github:commit'); await etch.getScheduler().getNextUpdatePromise(); assert.equal(commit.args[0][0], 'Commit 2'); assert.equal(editor.getText(), ''); - // disable git:commit when there are no staged changes... + // disable github:commit when there are no staged changes... commit.reset(); await view.update({repository, stagedChangesExist: false}); editor.setText('Commit 4'); await etch.getScheduler().getNextUpdatePromise(); - commandRegistry.dispatch(editor.element, 'git:commit'); + commandRegistry.dispatch(editor.element, 'github:commit'); await etch.getScheduler().getNextUpdatePromise(); assert.equal(commit.callCount, 0); assert.equal(editor.getText(), 'Commit 4'); @@ -163,7 +163,7 @@ describe('CommitView', () => { editor.setText(''); await etch.getScheduler().getNextUpdatePromise(); await view.update({repository, stagedChangesExist: true}); - commandRegistry.dispatch(editor.element, 'git:commit'); + commandRegistry.dispatch(editor.element, 'github:commit'); await etch.getScheduler().getNextUpdatePromise(); assert.equal(commit.callCount, 0); });