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

Commit Preview #1767

Merged
merged 416 commits into from Nov 20, 2018
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
416 commits
Select commit Hold shift + click to select a range
45c2ddf
Patch tests are :white_check_mark: :fireworks:
smashwilson Nov 7, 2018
dc0c14d
Adapt callers to changed buildStagePatchForLines() return value
smashwilson Nov 7, 2018
c148a8d
Catch that other "getFilePatchesContaining() returns a Set" call
smashwilson Nov 7, 2018
188d2ea
Cover the last few Patch methods
smashwilson Nov 7, 2018
2fff972
Bring NullPatch up to date
smashwilson Nov 7, 2018
462dffd
missed a rename oops
vanessayuenn Nov 7, 2018
6b1744b
FilePatch tests :white_check_mark: + coverage
smashwilson Nov 7, 2018
c8c0ef0
:fire: dot only
smashwilson Nov 7, 2018
772c36d
:fire: another dot only
smashwilson Nov 7, 2018
bbfd510
getpatchlayer
vanessayuenn Nov 7, 2018
ae8a4fb
WIP MultiFilePatch tests
smashwilson Nov 7, 2018
2b1b4a9
probably should be for..in since we're interating through an array
vanessayuenn Nov 7, 2018
1418498
fix ChangedFileContainer tests
Nov 7, 2018
8d7e965
Merge branch 'commit-preview' of github.com:atom/github into pr-1767/…
vanessayuenn Nov 7, 2018
4b12015
Merge remote-tracking branch 'origin' into pr-1767/atom/commit-preview
Nov 7, 2018
8a49372
fix some of the RootController tests
Nov 8, 2018
680f373
WIP - why `RootController` tests no worky
Nov 8, 2018
1513921
fix test syntax oops
Nov 8, 2018
43199ee
Correctly invalidate cache in `applyPatchToIndex` based on MFP file p…
kuychaco Nov 8, 2018
05dff68
:fire: duplicate `getPatchLayer`
kuychaco Nov 8, 2018
15039ba
:fire: unused import
kuychaco Nov 8, 2018
344f4b9
Clear and remark patch layer in `adoptBufferFrom`
kuychaco Nov 8, 2018
eb714c5
Add missing methods to NullPatch
kuychaco Nov 8, 2018
8d9aa25
Restyle file and hunk headers
simurai Nov 8, 2018
1b1cbd2
Remove long-obsolete .setState() calls in RootController tests
smashwilson Nov 8, 2018
8c004aa
Update RootController discard and undo tests to use MultiFilePatches
smashwilson Nov 8, 2018
f3809cb
Accept a MultiFilePatch in Present::applyPatchToWorkdir()
smashwilson Nov 8, 2018
86a8da1
Construct partial stage patches on an existing non-empty TextBuffer
smashwilson Nov 8, 2018
181adf8
Passing test for cross-file partial stage patch generation
smashwilson Nov 8, 2018
972cab7
Preserve FilePatch order in getFilePatchesContaining()
smashwilson Nov 8, 2018
836207f
make CommitPreviewContainer tests pass
Nov 8, 2018
07cee58
fix nullpatch being displayed
vanessayuenn Nov 8, 2018
ddd0630
fix commitpreviewitem tests
vanessayuenn Nov 8, 2018
6bfe025
Turns out we don't actually need that Set
smashwilson Nov 8, 2018
1eff20f
We actually care about typechanges, not just having a symlink
smashwilson Nov 8, 2018
ccd4eb6
MultiFilePatch tests: (un)staged patch generation, predicates
smashwilson Nov 8, 2018
d52b987
filePatch is soooo last week; we are on multiFilePatch now. 🆒
vanessayuenn Nov 8, 2018
d03c37c
we don't care about active/inactive anymore... i think.
vanessayuenn Nov 8, 2018
467a33e
no `.only`
vanessayuenn Nov 8, 2018
ea76f59
Full MultiFilePatch coverage for everything but getNextSelectionRange()
smashwilson Nov 8, 2018
c6a8aa0
new clone method for MFP
vanessayuenn Nov 8, 2018
4ac8af8
use the new clone method in MFP view test
vanessayuenn Nov 8, 2018
3908ffc
import the right thing
vanessayuenn Nov 8, 2018
44bc9b7
use this.constructor.name for metrics
Nov 8, 2018
bc86c23
replace usages of old clone method with those of the new one
vanessayuenn Nov 8, 2018
634a391
One more thing...
vanessayuenn Nov 8, 2018
973566d
Make the MultiFilePatch constructor like the others
smashwilson Nov 8, 2018
a3ef82a
Return real Ranges
smashwilson Nov 8, 2018
37de91a
Use .clone() within MultiFilePatch
smashwilson Nov 8, 2018
ccced0b
Test fixture builders for the MultiFilePatch models
smashwilson Nov 8, 2018
5294545
Default newFile to oldFile because they're almost always the same
smashwilson Nov 8, 2018
8fc07fa
Can't use the same names for properties and methods
smashwilson Nov 8, 2018
483c69f
Forgot the first argument to .appendMarked()
smashwilson Nov 8, 2018
8547505
First batch of examples that use the builder API
smashwilson Nov 8, 2018
f3a8b1f
Build real Ranges in Patch methods
smashwilson Nov 8, 2018
b6176ec
Delegate getFirstChangeRange() to the Patch
smashwilson Nov 8, 2018
566b9e9
Forward .status() and .addHunk() to PatchBuilder
smashwilson Nov 8, 2018
73d88c0
fix MultiFilePatchController tests
Nov 9, 2018
e62f508
:fire: mount
Nov 9, 2018
e6561aa
I fuck up partial staging more often than not.
Nov 9, 2018
1ece7eb
:shirt:
Nov 9, 2018
513e83c
it was the missing brackets in the parlor with the lead pipe.
Nov 9, 2018
4f80490
that's not how you get the hunks
Nov 9, 2018
f9930e5
Add more spacing between files
simurai Nov 9, 2018
dfdbd47
Make text selections blue
simurai Nov 9, 2018
8da27e6
Remove background color from hunks
simurai Nov 9, 2018
70b4dee
Fix cursor line on diffs
simurai Nov 9, 2018
4280a30
Add borders to hunk buttons
simurai Nov 9, 2018
c898ad6
:fire: Remove gutter background
simurai Nov 9, 2018
53177a8
Mark regions with exclusive: true to avoid stretching markers
smashwilson Nov 9, 2018
5bebe03
It helps if you actually call that block
smashwilson Nov 9, 2018
9b69f0e
Initialize default regions before computing hunk row counts
smashwilson Nov 9, 2018
e7feca7
Compute valid hunk start rows
smashwilson Nov 9, 2018
1475fce
It helps if you call methods that actually exist
smashwilson Nov 9, 2018
c514170
Mark to the end of the previous line
smashwilson Nov 9, 2018
d81a9cc
Allow nullFiles in FilePatches
smashwilson Nov 9, 2018
e5d0b95
Another method/property name collision
smashwilson Nov 9, 2018
b7a4dc7
fix exec mode change tests
vanessayuenn Nov 9, 2018
ec70e50
fix hunk headers test
vanessayuenn Nov 9, 2018
e0855f6
Allow empty blocks for addHunk() and addFilePatch() to accept defaults
smashwilson Nov 9, 2018
1fd0b0d
Right right that expects an Array
smashwilson Nov 9, 2018
cd4ec37
fix hunk lines tests
vanessayuenn Nov 9, 2018
13ad648
That rename we were just talking about
smashwilson Nov 9, 2018
cca116e
MultiFilePatch tests so far
smashwilson Nov 9, 2018
3c3d8ba
use the new shiny `multiFilePatchBuilder` ✨
vanessayuenn Nov 9, 2018
5a16641
replace old buildMultiPatch method with multiFilePatchBuilder
vanessayuenn Nov 9, 2018
6679c9c
nonewline is its own special ting
vanessayuenn Nov 9, 2018
fc1faa7
greenify open file tests
vanessayuenn Nov 9, 2018
a142e52
remove old builder methods from mfp view test suite
vanessayuenn Nov 9, 2018
c0a296e
fix hunk navigation tests
vanessayuenn Nov 9, 2018
2bb78b0
fix typo in patch building for mfp file opening tests
Nov 9, 2018
1fc0d85
Break out of the correct loop
smashwilson Nov 9, 2018
3603a76
getNextSelectionRange() tests :tada:
smashwilson Nov 9, 2018
201033e
:fire: unused imports, beforeEach, and lets
smashwilson Nov 9, 2018
02407d3
Fix MultiFilePatchController tests
kuychaco Nov 9, 2018
11e78f4
Test coverage for .clone()
smashwilson Nov 9, 2018
c667d3e
getFirstChangeRange() returns a real Range object
smashwilson Nov 9, 2018
aa1e8bf
Implement .isEqual() on MultiFilePatch the dumbest possible way
smashwilson Nov 9, 2018
e686a1f
The method is called .anyPresent() on a MultiFilePatch
smashwilson Nov 9, 2018
ce8363b
Reword spec names to reflect MultiFilePatches being returned
smashwilson Nov 9, 2018
d12e3fd
fix buildFilePatch null patch test
Nov 9, 2018
47aeebe
watchWorkspaceItem tests :white_check_mark: + :100:
smashwilson Nov 9, 2018
a7a345b
Use `anyPresent` instead of `isPresent`
kuychaco Nov 9, 2018
0c8f000
Check status on individual filePatch instead of MFP
kuychaco Nov 9, 2018
7cd5cfd
Set pull.rebase config to false in `setUpLocalAndRemoteRepositories`
kuychaco Nov 9, 2018
4886129
Move coveralls report to after_script
smashwilson Nov 9, 2018
7b4078f
Only call `discardLines` if MFP has a single file patch
kuychaco Nov 9, 2018
3908db1
Fix `buildFilePatch`
kuychaco Nov 9, 2018
37967ee
Fix `buildMultiFilePatch` tests
kuychaco Nov 9, 2018
3a3c68a
Fix `Open in File` and make it work for multiple files
kuychaco Nov 10, 2018
52634b9
workshopping button text
Nov 10, 2018
73f5d69
Finish up that question/comment...
kuychaco Nov 10, 2018
dc1c009
Fix `undoLastDiscard`
kuychaco Nov 10, 2018
6ab88e8
:memo: add new components to React atlas
Nov 10, 2018
a92f21c
Fix `undoLastDiscard` test for MultiFilePatchView
kuychaco Nov 10, 2018
a2d5c99
Update button text in tests
kuychaco Nov 10, 2018
a60cfc5
Fix tests for opening file when there is only a single file patch
kuychaco Nov 10, 2018
1c711f0
:fire: console.logs
kuychaco Nov 10, 2018
36e1e5f
:shirt: don't shadow `fp`
kuychaco Nov 10, 2018
54b23c9
Make commit preview button styled as `secondary` rather than `primary`
kuychaco Nov 10, 2018
fd800ef
:fire: dot only
smashwilson Nov 10, 2018
005e56f
Merge branch 'master' into commit-preview
smashwilson Nov 11, 2018
2640e81
Merge branch 'master' of github.com:atom/github into commit-preview
smashwilson Nov 12, 2018
549bd86
:fire: dead code in patch models
smashwilson Nov 12, 2018
7f3af52
Delete unused Region range accessors
smashwilson Nov 12, 2018
0875df3
Explicitly construct empty Patches
smashwilson Nov 13, 2018
44d7245
Cover remaining lines in MultiFilePatchView::componentDidMount()
smashwilson Nov 13, 2018
a207ad2
Cover FilePatchHeaderView action properties
smashwilson Nov 13, 2018
ade143e
Symlink changes apply to typechange patches, not any patch with a sym…
smashwilson Nov 13, 2018
01358f4
Test coverage for bulk typechange and mode change patch toggling
smashwilson Nov 13, 2018
474c25f
Turns out .findMarkers({intersectsRow}) normalizes its argument
smashwilson Nov 13, 2018
7209488
Cover that last line in MultiFilePatchController
smashwilson Nov 13, 2018
08fa778
Always require a layeredBuffer
smashwilson Nov 13, 2018
4783803
More unused isEqual methods
smashwilson Nov 13, 2018
cca1ab5
Remove unused-slash-broken FilePatch forwarding methods
smashwilson Nov 13, 2018
3180f44
Unit tests for commit preview stub item creation
smashwilson Nov 13, 2018
c3e6d89
No need for a default arg there
smashwilson Nov 13, 2018
35a7aaa
Register github:toggle-commit-preview in non-dev-mode
smashwilson Nov 13, 2018
058dd0f
Test coverage for RootController change
smashwilson Nov 13, 2018
5d30f13
fix bug in discardRows
vanessayuenn Nov 13, 2018
50232b0
test was setup incorrectly too :ohno:
vanessayuenn Nov 13, 2018
e364b0c
Those tests worky now :wink:
smashwilson Nov 13, 2018
e8a911a
Test for RootController::discardLines() with multiple patches
smashwilson Nov 13, 2018
21c91d8
Coverage for timing-dependent bits of Repository::saveDiscardHistory()
smashwilson Nov 13, 2018
e58e8b0
`github:open-file` --> `github:jump-to-file`
kuychaco Nov 13, 2018
d517b2e
Rename context menu item from "Open File" to "Jump to File"
kuychaco Nov 13, 2018
f58035a
:art: test description wording
kuychaco Nov 13, 2018
aadfc9c
MultiFilePatch predicate to determine if a set of rows spans files
smashwilson Nov 13, 2018
f9c2ebc
Track selections that span file patches in the MultiFilePatchController
smashwilson Nov 13, 2018
2d7e71a
Notify the selectedRowsChanged prop with file-spanning selection status
smashwilson Nov 13, 2018
f61d5dd
"Jump to file" or "Jump to files" button caption
smashwilson Nov 13, 2018
a9ed6cb
:fire: unused import
smashwilson Nov 13, 2018
c068bbf
Accept a pending argument in openFile action method
smashwilson Nov 13, 2018
b653c0f
Unit tests for opening multiple files
smashwilson Nov 13, 2018
65a8c22
Update file spanning state when manipulating selected rows manually
smashwilson Nov 13, 2018
a367b78
Jump to correct file if there is no diff selection for file
kuychaco Nov 14, 2018
7a18876
Jump to first changed line
kuychaco Nov 14, 2018
7bd749c
Drop the rest in an `else` clause
kuychaco Nov 14, 2018
1685f11
Check for existence of `selectedFilePatch` before accessing methods o…
kuychaco Nov 14, 2018
bed19dc
Don't mistake filePatch param with command event
kuychaco Nov 14, 2018
2a70de1
Oops we want to be getting the keys of `cursorsByFilePatch`
kuychaco Nov 14, 2018
62be5a4
Pass the right argument for pending panes
kuychaco Nov 14, 2018
18a08d9
Add tests for jumping to file from header button
kuychaco Nov 14, 2018
4fe18c5
:art: test to get us back to 100% test coverage of new lines
kuychaco Nov 14, 2018
c3a1d78
:shirt:
smashwilson Nov 14, 2018
5b6f364
Merge branch 'master' into commit-preview
smashwilson Nov 14, 2018
df837c8
Delete extraneous test that slipped in with the merge conflict
smashwilson Nov 14, 2018
5e123b5
Move test changes into MultiFilePatchController
smashwilson Nov 14, 2018
0adec32
Fix error where getFilePath is not a function on a CommitPreviewItem
Nov 14, 2018
3a62b79
props only work if you pass them to child components
Nov 14, 2018
bc58a8a
:art: Make UI more consistent
Nov 14, 2018
f49d4db
we don't need to test for no stinkin tooltips
Nov 15, 2018
1fc35c4
Explicitly only render Undo Discard button if ChangedFileItem
kuychaco Nov 15, 2018
c7535ce
Explicitly only render Undo Discard button if ChangedFileItem
kuychaco Nov 15, 2018
1f68596
Add `itemType` prop types for :shirt:
kuychaco Nov 15, 2018
4b53ba7
Make basename bold in FilePatchHeaderView
kuychaco Nov 15, 2018
ea07e4d
Fix tests to include itemType
kuychaco Nov 15, 2018
5bfd3d0
Update docs/react-component-atlas.md
kuychaco Nov 15, 2018
989c90d
Update docs/react-component-atlas.md
kuychaco Nov 15, 2018
a16e7f2
:world: CommitPreviewItem is beneath RootController, not GitHubTabItem
smashwilson Nov 15, 2018
64c9608
Use an object spread for that data why not
smashwilson Nov 15, 2018
9aa1a60
Pass a Decoration's className to the created DOM element
smashwilson Nov 15, 2018
3d63ab0
Set and style a more specific CSS class for control blocks
smashwilson Nov 15, 2018
90295f4
File.modes constants for well-known file modes
smashwilson Nov 15, 2018
8fc267f
Use File mode constants where possible
smashwilson Nov 15, 2018
0ec9039
Go into more detail on why that opener is necessary
smashwilson Nov 15, 2018
707f136
tweak symlink changes styles
Nov 15, 2018
43c16bf
executable mode change styling tweaks
Nov 15, 2018
04ed3c8
:fire: unused cache key for stagedChangesSinceParentCommit
kuychaco Nov 15, 2018
b48fceb
Use `path.sep` to join dirname and basename
smashwilson Nov 16, 2018
209961d
Merge branch 'master' of github.com:atom/github into commit-preview
smashwilson Nov 16, 2018
da9fe4c
Avoid double "\\ No newline at end of file"
smashwilson Nov 16, 2018
6147c86
Skip filesystem events with no path
smashwilson Nov 16, 2018
f6f56d6
Remove unnecessary <Fragment>
smashwilson Nov 16, 2018
b7049ee
Wait for new unstaged patch to arrive
smashwilson Nov 16, 2018
83ccf8f
Adapt the expected path separator to the current platform
smashwilson Nov 16, 2018
1325650
Default itemType to avoid the PropTypes warning
smashwilson Nov 16, 2018
da87fa7
Workspace item watcher only cares about active items
kuychaco Nov 16, 2018
098edb4
:fire: props that aren't used in `CommitPreviewItem`
kuychaco Nov 16, 2018
8362279
:fire: mysterious handleClick prop in MultiFilePatchController
kuychaco Nov 16, 2018
7eb7db0
Invalidate `stagedChanges` key when undoing last commit or head moves
kuychaco Nov 16, 2018
cd7003a
:fire: useEditorAutoHeight since we are now using a single editor
kuychaco Nov 16, 2018
218d6cb
Actually we want autoHeight set to false on AtomTextEditor
kuychaco Nov 16, 2018
1c1b2d2
:fire: .only
kuychaco Nov 16, 2018
3b5d030
📝 comment for `intersectRows`
vanessayuenn Nov 16, 2018
d599b3c
:fire: unnecessary button class name
Nov 16, 2018
d360bd5
compare multifilepatches with toString()
vanessayuenn Nov 16, 2018
111108e
change variable name to make the logic more clear
vanessayuenn Nov 16, 2018
42f957b
Activate the commit preview on cmd-left from the button
smashwilson Nov 16, 2018
9ebb954
MultiFilePatchView prop rename
smashwilson Nov 16, 2018
2c89cdb
Pass surface callback through MultiFilePatchController
smashwilson Nov 16, 2018
7c59876
Bring the keymap up to date
smashwilson Nov 16, 2018
71f9da7
ChangedFileController to control surfacing behavior for ChangedFileItems
smashwilson Nov 16, 2018
1bc9688
CommitPreviewController to interpret surface as surfaceToCommitPreview
smashwilson Nov 16, 2018
dd90907
Render a ChangedFileController within the container
smashwilson Nov 16, 2018
55b6f9e
Destroy the atomEnv
smashwilson Nov 16, 2018
4061824
Render a CommitPreviewController within CommitPreviewContainer
smashwilson Nov 16, 2018
48ea0b5
Add missing PropTypes to the CommitPreviewItem
smashwilson Nov 16, 2018
9b4ffc4
Unconditional CommitPreviewItem activation for github:dive binding
smashwilson Nov 16, 2018
fe3aa61
Imperatively select the commit preview button
smashwilson Nov 16, 2018
97f803e
GitTabView commit preview focusing
smashwilson Nov 16, 2018
e809b5e
Forward surfaceToCommitPreviewButton to the GitTabController
smashwilson Nov 16, 2018
f4e844a
Method to surface and focus the commit preview button
smashwilson Nov 16, 2018
632349f
:fire: debugger
smashwilson Nov 16, 2018
7282f0f
Revert "compare multifilepatches with toString()"
kuychaco Nov 16, 2018
a0dafda
package-lock updates
kuychaco Nov 16, 2018
1685484
Add logic to `getNextSelectionRange` so that selection remains at bot…
kuychaco Nov 16, 2018
8be43e5
Test that bottom-most line is selected after staging bottom-most line
kuychaco Nov 16, 2018
c4d0dec
Add more comments to explain logic in `getNextSelectionRange`
kuychaco Nov 16, 2018
d16b900
WIP Fix one thing, break another =/. Fix marker for patches w/ no hunks
kuychaco Nov 17, 2018
111c0c7
Add test for marker range for a patch with no hunks
kuychaco Nov 17, 2018
c5c2c89
Ensure that marker range for no-hunk patch is not affected by hunks a…
kuychaco Nov 17, 2018
1acd91e
Throw error if too many markers found (to help with debugging)
kuychaco Nov 17, 2018
d33f3e9
:fire: .only
kuychaco Nov 17, 2018
e34e46a
Revert "Throw error if too many markers found (to help with debugging)"
smashwilson Nov 19, 2018
5f1f65d
add missing props to CommitPreviewItem tests
Nov 19, 2018
d02451e
fix integration tests for file patch
Nov 19, 2018
764b6e8
add test for `surfaceToCommitPreviewButton` in `RootController`
Nov 19, 2018
9b15735
test that getFileMode returns the correct file mode for symlinks
Nov 19, 2018
3c97dca
test file mode for executable files in git-strategies test
Nov 20, 2018
f8e4aae
test that repository.updateCommitMessageAfterFileSystemChange handles…
Nov 20, 2018
bfaacb4
maybe make windows filemode happy?
Nov 20, 2018
358adbb
istanbul ignore test-only code
Nov 20, 2018
1a3e5a4
Test that getPanesWithStalePendingFilePatchItem ignores CommitPreview…
kuychaco Nov 20, 2018
f51c570
:shirt:
Nov 20, 2018
e03ce4d
fix misaligned line numbers in file mode changes
Nov 20, 2018
27373b4
Check that `getFileMode` works for untracked symlink files
kuychaco Nov 20, 2018
27ca512
Fix `undoLastDiscardFromCoreUndo` for keyboard users
kuychaco Nov 20, 2018
7b5935d
Fix test for undoing last discard from `core:undo`
kuychaco Nov 20, 2018
8e5d9ee
Restyle mode changes
simurai Nov 20, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 15 additions & 3 deletions docs/react-component-atlas.md
Expand Up @@ -66,12 +66,24 @@ This is a high-level overview of the structure of the React component tree that
> > > > > >
> > > > > > Render a list of issueish results as rows within the result list of a specific search.
>
> > [`<FilePatchController>`](/lib/controllers/file-patch-controller.js)
> > [`<FilePatchView>`](/lib/views/file-patch-view.js)
> > [`<ChangedFileItem>`](/lib/items/changed-file-item.js)
> > [`<ChangedFileContainer>`](/lib/containers/changed-file-container.js)
> >
> > The workspace-center pane that appears when looking at the staged or unstaged changes associated with a file.
> >
> > :construction: Being rewritten in [#1712](https://github.com/atom/github/pull/1512) :construction:
> > > [`<MultiFilePatchController>`](/lib/controllers/multi-file-patch-controller.js)
> > > [`<MultiFilePatchView>`](/lib/views/multi-file-patch-view.js)
> > >
> > > Render a sequence of git-generated file patches within a TextEditor, using decorations to include contextually
> > > relevant controls.
>
> > [`<CommitPreviewItem>`](/lig/items/commit-preview-item.js)
> > [`<CommitPreviewContainer>`](/lib/containers/commit-preview-container.js)
> >
> > The workspace-center pane that appears when looking at _all_ the staged changes that will be going into the next commit.
> >
kuychaco marked this conversation as resolved.
Show resolved Hide resolved
simurai marked this conversation as resolved.
Show resolved Hide resolved
> > > [`<MultiFilePatchController>`](/lib/controllers/multi-file-patch-controller.js)
> > > [`<MultiFilePatchView>`](/lib/views/multi-file-patch-view.js)
>
> > [`<IssueishDetailItem>`](/lib/items/issueish-detail-item.js)
> > [`<IssueishDetailContainer>`](/lib/containers/issueish-detail-container.js)
Expand Down
2 changes: 1 addition & 1 deletion docs/react-component-classification.md
Expand Up @@ -6,7 +6,7 @@ This is a high-level summary of the organization and implementation of our React

**Items** are intended to be used as top-level components within subtrees that are rendered into some [Portal](https://reactjs.org/docs/portals.html) and passed to the Atom API, like pane items, dock items, or tooltips. They are mostly responsible for implementing the [Atom "item" contract](https://github.com/atom/atom/blob/a3631f0dafac146185289ac5e37eaff17b8b0209/src/workspace.js#L29-L174).

These live within [`lib/items/`](/lib/items), are tested within [`test/items/`](/test/items), and are named with an `Item` suffix. Examples: `PullRequestDetailItem`, `FilePatchItem`.
These live within [`lib/items/`](/lib/items), are tested within [`test/items/`](/test/items), and are named with an `Item` suffix. Examples: `PullRequestDetailItem`, `ChangedFileItem`.

## Containers

Expand Down
20 changes: 15 additions & 5 deletions keymaps/git.cson
Expand Up @@ -24,8 +24,13 @@
'.github-StagingView':
'tab': 'core:focus-next'
'shift-tab': 'core:focus-previous'
'o': 'github:open-file'
'o': 'github:jump-to-file'
'left': 'core:move-left'
'cmd-left': 'core:move-left'

'.github-CommitView button':
'tab': 'core:focus-next'
'shift-tab': 'core:focus-previous'

'.github-StagingView.unstaged-changes-focused':
'cmd-backspace': 'github:discard-changes-in-selected-files'
Expand All @@ -36,17 +41,22 @@
'ctrl-enter': 'github:commit'
'shift-tab': 'core:focus-previous'

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

'.github-FilePatchView atom-text-editor:not([mini])':
'cmd-/': 'github:toggle-patch-selection-mode'
'ctrl-/': 'github:toggle-patch-selection-mode'
'cmd-backspace': 'github:discard-selected-lines'
'ctrl-backspace': 'github:discard-selected-lines'
'cmd-enter': 'core:confirm'
'ctrl-enter': 'core:confirm'
'cmd-right': 'github:surface-file'
'ctrl-right': 'github:surface-file'
'cmd-o': 'github:open-file'
'ctrl-o': 'github:open-file'
'cmd-right': 'github:surface'
'ctrl-right': 'github:surface'
'cmd-o': 'github:jump-to-file'
'ctrl-o': 'github:jump-to-file'

'.github-FilePatchView--hunkMode atom-text-editor:not([mini])':
'down': 'github:select-next-hunk'
Expand Down
3 changes: 2 additions & 1 deletion lib/atom/decoration.js
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import {Disposable} from 'event-kit';
import cx from 'classnames';

import {createItem, autobind, extractProps} from '../helpers';
import {RefHolderPropType} from '../prop-types';
Expand Down Expand Up @@ -49,7 +50,7 @@ class BareDecoration extends React.Component {
this.item = null;
if (['gutter', 'overlay', 'block'].includes(this.props.type)) {
this.domNode = document.createElement('div');
this.domNode.className = 'react-atom-decoration';
this.domNode.className = cx('react-atom-decoration', this.props.className);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/atom/uri-pattern.js
Expand Up @@ -246,7 +246,7 @@ function dashEscape(raw) {
* Reverse the escaping performed by `dashEscape` by un-doubling `-` characters.
*/
function dashUnescape(escaped) {
return escaped.replace('--', '-');
return escaped.replace(/--/g, '-');
}

/**
Expand Down
Expand Up @@ -5,9 +5,9 @@ import yubikiri from 'yubikiri';
import {autobind} from '../helpers';
import ObserveModel from '../views/observe-model';
import LoadingView from '../views/loading-view';
import FilePatchController from '../controllers/file-patch-controller';
import ChangedFileController from '../controllers/changed-file-controller';

export default class FilePatchContainer extends React.Component {
export default class ChangedFileContainer extends React.Component {
kuychaco marked this conversation as resolved.
Show resolved Hide resolved
static propTypes = {
repository: PropTypes.object.isRequired,
stagingStatus: PropTypes.oneOf(['staged', 'unstaged']),
Expand All @@ -30,8 +30,10 @@ export default class FilePatchContainer extends React.Component {
}

fetchData(repository) {
const staged = this.props.stagingStatus === 'staged';

return yubikiri({
filePatch: repository.getFilePatchForPath(this.props.relPath, {staged: this.props.stagingStatus === 'staged'}),
multiFilePatch: repository.getFilePatchForPath(this.props.relPath, {staged}),
isPartiallyStaged: repository.isPartiallyStaged(this.props.relPath),
hasUndoHistory: repository.hasDiscardHistory(this.props.relPath),
});
Expand All @@ -51,10 +53,8 @@ export default class FilePatchContainer extends React.Component {
}

return (
<FilePatchController
filePatch={data.filePatch}
isPartiallyStaged={data.isPartiallyStaged}
hasUndoHistory={data.hasUndoHistory}
<ChangedFileController
{...data}
{...this.props}
/>
);
Expand Down
41 changes: 41 additions & 0 deletions lib/containers/commit-preview-container.js
@@ -0,0 +1,41 @@
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 CommitPreviewController from '../controllers/commit-preview-controller';

export default class CommitPreviewContainer extends React.Component {
static propTypes = {
repository: PropTypes.object.isRequired,
}

fetchData = repository => {
return yubikiri({
multiFilePatch: repository.getStagedChangesPatch(),
});
}

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

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

return (
<CommitPreviewController
stagingStatus={'staged'}
{...data}
{...this.props}
/>
);
}
}
33 changes: 33 additions & 0 deletions lib/controllers/changed-file-controller.js
@@ -0,0 +1,33 @@
import React from 'react';
import PropTypes from 'prop-types';

import MultiFilePatchController from './multi-file-patch-controller';

export default class ChangedFileController extends React.Component {
static propTypes = {
repository: PropTypes.object.isRequired,
stagingStatus: PropTypes.oneOf(['staged', 'unstaged']),
relPath: PropTypes.string.isRequired,

workspace: PropTypes.object.isRequired,
commands: PropTypes.object.isRequired,
keymaps: PropTypes.object.isRequired,
tooltips: PropTypes.object.isRequired,
config: PropTypes.object.isRequired,

destroy: PropTypes.func.isRequired,
undoLastDiscard: PropTypes.func.isRequired,
surfaceFileAtPath: PropTypes.func.isRequired,
}

render() {
return (
<MultiFilePatchController
surface={this.surface}
{...this.props}
/>
);
}

surface = () => this.props.surfaceFileAtPath(this.props.relPath, this.props.stagingStatus)
}
49 changes: 44 additions & 5 deletions lib/controllers/commit-controller.js
Expand Up @@ -8,7 +8,9 @@ import fs from 'fs-extra';

import CommitView from '../views/commit-view';
import RefHolder from '../models/ref-holder';
import CommitPreviewItem from '../items/commit-preview-item';
import {AuthorPropType, UserStorePropType} from '../prop-types';
import {watchWorkspaceItem} from '../watch-workspace-item';
import {autobind} from '../helpers';
import {addEvent} from '../reporter-proxy';

Expand Down Expand Up @@ -42,7 +44,8 @@ export default class CommitController extends React.Component {

constructor(props, context) {
super(props, context);
autobind(this, 'commit', 'handleMessageChange', 'toggleExpandedCommitMessageEditor', 'grammarAdded');
autobind(this, 'commit', 'handleMessageChange', 'toggleExpandedCommitMessageEditor', 'grammarAdded',
'toggleCommitPreview');

this.subscriptions = new CompositeDisposable();
this.refCommitView = new RefHolder();
Expand All @@ -51,6 +54,14 @@ export default class CommitController extends React.Component {
this.subscriptions.add(
this.commitMessageBuffer.onDidChange(this.handleMessageChange),
);

this.previewWatcher = watchWorkspaceItem(
this.props.workspace,
CommitPreviewItem.buildURI(this.props.repository.getWorkingDirectoryPath()),
this,
'commitPreviewActive',
);
this.subscriptions.add(this.previewWatcher);
}

componentDidMount() {
Expand Down Expand Up @@ -105,12 +116,21 @@ export default class CommitController extends React.Component {
userStore={this.props.userStore}
selectedCoAuthors={this.props.selectedCoAuthors}
updateSelectedCoAuthors={this.props.updateSelectedCoAuthors}
toggleCommitPreview={this.toggleCommitPreview}
activateCommitPreview={this.activateCommitPreview}
commitPreviewActive={this.state.commitPreviewActive}
/>
);
}

componentDidUpdate(prevProps) {
this.commitMessageBuffer.setTextViaDiff(this.getCommitMessage());

if (prevProps.repository !== this.props.repository) {
this.previewWatcher.setPattern(
CommitPreviewItem.buildURI(this.props.repository.getWorkingDirectoryPath()),
);
}
}

componentWillUnmount() {
Expand Down Expand Up @@ -240,12 +260,31 @@ export default class CommitController extends React.Component {
return this.refCommitView.map(view => view.setFocus(focus)).getOr(false);
}

hasFocus() {
return this.refCommitView.map(view => view.hasFocus()).getOr(false);
advanceFocus(...args) {
return this.refCommitView.map(view => view.advanceFocus(...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);
}

toggleCommitPreview() {
addEvent('toggle-commit-preview', {package: 'github'});
const uri = CommitPreviewItem.buildURI(this.props.repository.getWorkingDirectoryPath());
if (this.props.workspace.hide(uri)) {
return Promise.resolve();
} else {
return this.props.workspace.open(uri, {searchAllPanes: true, pending: true});
}
}

hasFocusEditor() {
return this.refCommitView.map(view => view.hasFocusEditor()).getOr(false);
activateCommitPreview = () => {
const uri = CommitPreviewItem.buildURI(this.props.repository.getWorkingDirectoryPath());
return this.props.workspace.open(uri, {searchAllPanes: true, pending: true, activate: true});
}
}

Expand Down
30 changes: 30 additions & 0 deletions lib/controllers/commit-preview-controller.js
@@ -0,0 +1,30 @@
import React from 'react';
import PropTypes from 'prop-types';

import MultiFilePatchController from './multi-file-patch-controller';

export default class CommitPreviewController extends React.Component {
static propTypes = {
repository: PropTypes.object.isRequired,
stagingStatus: PropTypes.oneOf(['staged', 'unstaged']),

workspace: PropTypes.object.isRequired,
commands: PropTypes.object.isRequired,
keymaps: PropTypes.object.isRequired,
tooltips: PropTypes.object.isRequired,
config: PropTypes.object.isRequired,

destroy: PropTypes.func.isRequired,
undoLastDiscard: PropTypes.func.isRequired,
surfaceToCommitPreviewButton: PropTypes.func.isRequired,
}

render() {
return (
<MultiFilePatchController
surface={this.props.surfaceToCommitPreviewButton}
{...this.props}
/>
);
}
}
4 changes: 4 additions & 0 deletions lib/controllers/git-tab-controller.js
Expand Up @@ -348,6 +348,10 @@ export default class GitTabController extends React.Component {
return this.refView.map(view => view.focusAndSelectStagingItem(filePath, stagingStatus)).getOr(null);
}

focusAndSelectCommitPreviewButton() {
return this.refView.map(view => view.focusAndSelectCommitPreviewButton());
}

quietlySelectItem(filePath, stagingStatus) {
return this.refView.map(view => view.quietlySelectItem(filePath, stagingStatus)).getOr(null);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/controllers/github-tab-controller.js
Expand Up @@ -19,7 +19,7 @@ export default class GitHubTabController extends React.Component {
allRemotes: RemoteSetPropType.isRequired,
branches: BranchSetPropType.isRequired,
selectedRemoteName: PropTypes.string,
aheadCount: PropTypes.number.isRequired,
aheadCount: PropTypes.number,
pushInProgress: PropTypes.bool.isRequired,
isLoading: PropTypes.bool.isRequired,
}
Expand Down