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

Use Atom opener to display file diff #1016

Merged
merged 126 commits into from
Jul 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
cddafca
Add FilePatchPaneItem and register opener
kuychaco Jul 5, 2017
03396d9
Use workspace opener to view file diffs
kuychaco Jul 5, 2017
5a41db5
Rerender FilePatchController when repo updates
kuychaco Jul 5, 2017
23c32c8
Update state when diving into corresponding file patch
kuychaco Jul 5, 2017
9029c0b
Use workspace opener to view changes for current file
kuychaco Jul 5, 2017
8c29f48
:art: it's technically a FilePatchPaneItem
kuychaco Jul 5, 2017
1df891a
Move command `github:focus-diff-view` to FilePatchController
kuychaco Jul 5, 2017
eec5940
Pass file patch object to `discardLines`
kuychaco Jul 5, 2017
b0aaa3d
Fix url parsing and :fire: activate prop
kuychaco Jul 5, 2017
d4e1837
Update when amending state changes
kuychaco Jul 5, 2017
f4cfbc4
:fire: unused code in RootController
kuychaco Jul 5, 2017
ffef247
Focus FilePatchController component after it has been created
kuychaco Jul 6, 2017
594f348
Display empty diff view if filePatch is null
kuychaco Jul 6, 2017
22b6eb6
Update selected item when StagingView updates
kuychaco Jul 6, 2017
086ed6f
:fire: unnecessary query param `activate`
kuychaco Jul 6, 2017
4604157
Only open FilePatchPaneItem if a pending one is present or file was c…
kuychaco Jul 6, 2017
7111964
Select file path in StagingView when FilePatchPaneItem becomes active
kuychaco Jul 6, 2017
3485ef3
Hacky fix to prevent flickering when staging/unstaging
kuychaco Jul 6, 2017
0da3c87
Don't set state if component is unmounted
kuychaco Jul 6, 2017
ed110bc
Don't throw error if item cannot be found in quietlySelectItem
kuychaco Jul 6, 2017
71d3f9d
Add deserializer for FilePatchPaneItem
kuychaco Jul 6, 2017
dc77a52
Only set isAmending state if file patch exists
kuychaco Jul 6, 2017
f8863dd
Add onDidDestroy to FilePatchPaneItem
kuychaco Jul 6, 2017
98b7ab5
Destroy FilePatchPaneItems with 'staged' status after committing
kuychaco Jul 6, 2017
c29ff7a
Add command to close all diff views
kuychaco Jul 6, 2017
a425a4d
:art: StagingView, create `showFilePatchItem` method
kuychaco Jul 7, 2017
2786f39
Fix StagingView tests
kuychaco Jul 7, 2017
5bbade0
Fix GitTabController tests
kuychaco Jul 7, 2017
2323b97
Make `stagingStatus` a query parameter
kuychaco Jul 7, 2017
becf0dd
Keep focus on file diff after staging all hunks
kuychaco Jul 7, 2017
fb97a5b
Terminate pending state for FilePatchPaneItem by double clicking
kuychaco Jul 7, 2017
4acc69d
Add `onDidChangeActivePaneItem` disposable to subscriptions...
kuychaco Jul 8, 2017
f11d3ef
Update active repo when FilePatchPaneItem is active
kuychaco Jul 8, 2017
c8aff9b
Only register FilePatchView commands if associated repo is active
kuychaco Jul 8, 2017
005117f
Fix deserializers
kuychaco Jul 10, 2017
39434c6
Remove FilePatchPaneItem deserializer and punt on implementing until …
kuychaco Jul 10, 2017
54bb64c
Move logic for viewing merge conflicts from RootController to Staging…
kuychaco Jul 10, 2017
d178174
Add `github:show-diff-view` command
kuychaco Jul 11, 2017
014bb72
Only FilePatchView commands if view corresponds to selected file
kuychaco Jul 11, 2017
f038611
:shirt:
kuychaco Jul 11, 2017
fab182c
Merge branch 'master' into ku-next-diff-please
kuychaco Jul 11, 2017
0a59edc
:art: StagingView#getSelectedItem -> getSelectedItems
kuychaco Jul 11, 2017
488f309
Fix StagingView tests
kuychaco Jul 11, 2017
df085a2
Move stubs into local beforeEach blocks
kuychaco Jul 11, 2017
85fa5c3
Stub workspace.open to prevent console errors
kuychaco Jul 11, 2017
31cfc13
Add test for StagingView#showFilePatchItem
kuychaco Jul 12, 2017
8ce84fc
Make clearing out filePatch less hacky
kuychaco Jul 12, 2017
b778e7a
Add test for StagingView#showMergeConflictFileForPath
kuychaco Jul 12, 2017
65a793d
WIP
kuychaco Jul 13, 2017
d210db0
More WIP
kuychaco Jul 13, 2017
215477b
Use stub and proxy system for viewing diff views
kuychaco Jul 13, 2017
02b7745
Clean up code
kuychaco Jul 14, 2017
f2c4a52
First check if item exists
kuychaco Jul 14, 2017
4a83d48
Check if filePatchView exists before calling goToDiffLine
kuychaco Jul 14, 2017
59dee04
Wait for filePatch to be loaded before calling goToDiffLine
kuychaco Jul 14, 2017
4402bbe
WIP
kuychaco Jul 14, 2017
e75ff0e
Update diff view when amend is toggled
kuychaco Jul 14, 2017
dfd90dc
Add methods to support terminating pending state
kuychaco Jul 14, 2017
1903b8c
:fire: legacy panels
BinaryMuse Jul 14, 2017
155f2a4
Always use URIs and StubItems to manage Git/GitHub dock items
BinaryMuse Jul 14, 2017
ff28f8b
Clean up tab tracker stuffs
BinaryMuse Jul 14, 2017
47118ba
Add copy method to FilePatchController to enable split-and-copy commands
kuychaco Jul 14, 2017
5407f73
:shirt: and clean up
kuychaco Jul 14, 2017
77cba05
Fix tests
kuychaco Jul 15, 2017
59cad1b
Add back PaneItem#activate
kuychaco Jul 15, 2017
42b0f00
Fix tests
kuychaco Jul 15, 2017
f16b4cb
Fix more tests WIP
kuychaco Jul 15, 2017
6b2c99c
Don't overwrite stub Git/GitHub items
BinaryMuse Jul 17, 2017
361f658
:fire: unneeded StubItem methods
BinaryMuse Jul 17, 2017
24bb80a
:shirt:
BinaryMuse Jul 17, 2017
084b8e1
Namespace deserializers
BinaryMuse Jul 17, 2017
843d40f
:fire: comment
BinaryMuse Jul 17, 2017
1d73fe9
Properly destroy closed DockItems
BinaryMuse Jul 17, 2017
8b419a5
Merge pull request #1034 from atom/mkt-openers-for-dock-items
BinaryMuse Jul 17, 2017
ff86454
Handle deserializing diff views
BinaryMuse Jul 17, 2017
db7ecc3
Add missing return
BinaryMuse Jul 18, 2017
2f57631
Fix FilePatchController tests
kuychaco Jul 18, 2017
1e6d32b
Only save data if model exists
kuychaco Jul 18, 2017
8a58ea6
:fire: unused getSelectedStagingViewItems
BinaryMuse Jul 18, 2017
92f9c62
:fire: logs
BinaryMuse Jul 18, 2017
cd5ded0
Don't store repository on FilePatchController state
BinaryMuse Jul 18, 2017
4e61a6e
:shirt:
BinaryMuse Jul 18, 2017
f1770c3
:fire: RootController savedState that is no longer necessary
kuychaco Jul 18, 2017
af65ebc
Remove test for legacy panels, always use dock
kuychaco Jul 18, 2017
5ff8696
Remove unnecessary tests for saved state
kuychaco Jul 18, 2017
e75a365
Fix TabTracker tests
kuychaco Jul 18, 2017
302a440
Fix initial panel visibility tests
kuychaco Jul 18, 2017
720b43b
Pass repo to onRepoRefresh in tests
kuychaco Jul 18, 2017
fcd36fa
:art: FilePatchController. Extract getFilePatchForPath method
kuychaco Jul 20, 2017
2312f9b
Relocate tests from RootController to FilePatchController and Staging…
kuychaco Jul 20, 2017
a413133
Don't pass filePatch to FilePatchView
kuychaco Jul 20, 2017
b477b0f
:art: extract FilePatchController#isStaged method
kuychaco Jul 20, 2017
56f56e0
:art: and clean up
kuychaco Jul 20, 2017
a881be4
Prevent console error about unique key prop
kuychaco Jul 20, 2017
89e620a
Actually we need that for tests...
kuychaco Jul 20, 2017
e9b3646
Get rid of more console errors in tests
kuychaco Jul 20, 2017
e9ffdbd
Quick fix for error when line is undefined
kuychaco Jul 20, 2017
85203d3
Merge branch 'master' into ku-next-diff-please
kuychaco Jul 20, 2017
28f444b
:shirt:
kuychaco Jul 20, 2017
0338163
Fix call to quietlySelectItem
kuychaco Jul 20, 2017
9afeb1c
Revert "Quick fix for error when line is undefined"
kuychaco Jul 20, 2017
bf95096
Actual quick fix for error when line is undefined
kuychaco Jul 20, 2017
e390418
Fix bug in StubItem#destroy that broke `close-all-diff-views` command
kuychaco Jul 20, 2017
1b26b82
Add `github:close-empty-diff-views` command
kuychaco Jul 20, 2017
634484b
Focus failing test
kuychaco Jul 20, 2017
4a15548
Add logs
kuychaco Jul 20, 2017
6a62460
Add more logs
kuychaco Jul 20, 2017
66821ce
Await changePatchPromise
kuychaco Jul 20, 2017
4fe470d
:fire: logs
kuychaco Jul 20, 2017
f69e93b
:fire: logs
kuychaco Jul 20, 2017
a44664e
Fix things
kuychaco Jul 20, 2017
d31431d
Unfocus test. Fixed! :tada:
kuychaco Jul 20, 2017
8ea3ecd
Only select item in ListSelection if it exists (as default)
kuychaco Jul 21, 2017
c0ae1d5
Retain diff view header when file patch is empty or too large to display
kuychaco Jul 21, 2017
17922f4
Fix CSS
kuychaco Jul 21, 2017
dad3ae9
:art:
kuychaco Jul 24, 2017
57a79ce
Remove quick fix for the line is undefined error
kuychaco Jul 24, 2017
d4e869f
Fix FilePatchController tests
kuychaco Jul 25, 2017
bfcdd2c
Does this work on all platforms?
kuychaco Jul 25, 2017
6c70da8
Focus test
kuychaco Jul 25, 2017
947a7be
:shirt:
kuychaco Jul 26, 2017
cc6b5d9
Pass on appveyor?
kuychaco Jul 26, 2017
bd16e7e
Let's try this
kuychaco Jul 26, 2017
4243458
Unfocus test
kuychaco Jul 26, 2017
deb0816
Add spy to get rid of console error
kuychaco Jul 26, 2017
83e8fb1
:fire: comment
kuychaco Jul 26, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 28 additions & 30 deletions lib/atom-items/stub-item.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,57 @@
import {Emitter, CompositeDisposable} from 'event-kit';

let key = 0;
export default class StubItem {
static stubsBySelector = new Map()

// StubItems should only be created by `create` and never constructed directly.
static create(selector, props) {
const stub = new StubItem(selector, props);
static create(name, props, uri = '') {
const stub = new StubItem(name, props, uri);
const override = {
_getStub: () => stub,
getElement: () => stub.getElement(),
destroy: stub.destroy.bind(stub),
};
const proxy = new Proxy(override, {
get(target, name) {
get(target, propName) {
const item = stub.getRealItem();
if (Reflect.has(target, name)) {
return target[name];
} else if (item && Reflect.has(item, name)) {
let val = item[name];
if (Reflect.has(target, propName)) {
return target[propName];
} else if (item && Reflect.has(item, propName)) {
let val = item[propName];
if (typeof val === 'function') {
val = val.bind(item);
}
return val;
} else {
let val = stub[name];
let val = stub[propName];
if (typeof val === 'function') {
val = val.bind(stub);
}
return val;
}
},
});
this.stubsBySelector.set(selector, proxy);
return proxy;
}

static getBySelector(selector) {
return this.stubsBySelector.get(selector);
}

static getElementBySelector(selector) {
const stub = this.getBySelector(selector);
if (stub) {
return stub.getElement();
} else {
return null;
}
}

constructor(selector, props = {}) {
constructor(name, props = {}, uri) {
this.emitter = new Emitter();
this.subscriptions = new CompositeDisposable();

this.selector = selector;
this.name = name;
this.props = props;
this.uri = uri;
this.key = ++key;
this.element = document.createElement('div');
this.element.classList.add(`github-StubItem-${selector}`);
this.element.classList.add(`github-StubItem-${name}`);
this.realItem = null;
this.realItemPromise = new Promise(res => {
this.resolveRealItemPromise = res;
});
}

setRealItem(item) {
this.realItem = item;
this.resolveRealItemPromise();
this.emitter.emit('did-change-title');
this.emitter.emit('did-change-icon');

Expand All @@ -80,10 +71,18 @@ export default class StubItem {
}
}

getRealItemPromise() {
return this.realItemPromise;
}

getRealItem() {
return this.realItem;
}

getURI() {
return this.uri;
}

getTitle() {
return this.props.title || null;
}
Expand Down Expand Up @@ -111,9 +110,8 @@ export default class StubItem {
destroy() {
this.subscriptions.dispose();
this.emitter.dispose();
StubItem.stubsBySelector.delete(this.selector);
if (this.actualItem) {
this.actualItem.destroy && this.actualItem.destroy();
if (this.realItem) {
this.realItem.destroy && this.realItem.destroy();
}
}
}
Loading