Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
14de9c92
Commit
14de9c92
authored
Jun 18, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
b4658940
c4efc7b5
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
99 additions
and
11 deletions
+99
-11
app/assets/javascripts/ide/services/index.js
app/assets/javascripts/ide/services/index.js
+7
-1
app/assets/javascripts/ide/stores/modules/commit/actions.js
app/assets/javascripts/ide/stores/modules/commit/actions.js
+1
-0
app/assets/javascripts/ide/stores/utils.js
app/assets/javascripts/ide/stores/utils.js
+9
-2
app/assets/javascripts/mr_popover/queries/merge_request.graphql
...sets/javascripts/mr_popover/queries/merge_request.graphql
+1
-1
changelogs/unreleased/59023-fix-web-ide-creating-branches-off-new-commits.yml
...d/59023-fix-web-ide-creating-branches-off-new-commits.yml
+5
-0
changelogs/unreleased/63261-the-graphql-query-for-the-mr-popover-failes-on-the-frontend.yml
...aphql-query-for-the-mr-popover-failes-on-the-frontend.yml
+6
-0
spec/frontend/ide/services/index_spec.js
spec/frontend/ide/services/index_spec.js
+55
-0
spec/javascripts/ide/stores/modules/commit/actions_spec.js
spec/javascripts/ide/stores/modules/commit/actions_spec.js
+13
-5
spec/javascripts/ide/stores/utils_spec.js
spec/javascripts/ide/stores/utils_spec.js
+2
-2
No files found.
app/assets/javascripts/ide/services/index.js
View file @
14de9c92
...
@@ -56,7 +56,13 @@ export default {
...
@@ -56,7 +56,13 @@ export default {
return
Api
.
branchSingle
(
projectId
,
currentBranchId
);
return
Api
.
branchSingle
(
projectId
,
currentBranchId
);
},
},
commit
(
projectId
,
payload
)
{
commit
(
projectId
,
payload
)
{
return
Api
.
commitMultiple
(
projectId
,
payload
);
// Currently the `commit` endpoint does not support `start_sha` so we
// have to make the request in the FE. This is not ideal and will be
// resolved soon. https://gitlab.com/gitlab-org/gitlab-ce/issues/59023
const
{
branch
,
start_sha
:
ref
}
=
payload
;
const
branchPromise
=
ref
?
Api
.
createBranch
(
projectId
,
{
ref
,
branch
})
:
Promise
.
resolve
();
return
branchPromise
.
then
(()
=>
Api
.
commitMultiple
(
projectId
,
payload
));
},
},
getFiles
(
projectUrl
,
branchId
)
{
getFiles
(
projectUrl
,
branchId
)
{
const
url
=
`
${
projectUrl
}
/files/
${
branchId
}
`
;
const
url
=
`
${
projectUrl
}
/files/
${
branchId
}
`
;
...
...
app/assets/javascripts/ide/stores/modules/commit/actions.js
View file @
14de9c92
...
@@ -142,6 +142,7 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState, roo
...
@@ -142,6 +142,7 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState, roo
getters
,
getters
,
state
,
state
,
rootState
,
rootState
,
rootGetters
,
});
});
return
service
.
commit
(
rootState
.
currentProjectId
,
payload
);
return
service
.
commit
(
rootState
.
currentProjectId
,
payload
);
...
...
app/assets/javascripts/ide/stores/utils.js
View file @
14de9c92
...
@@ -135,7 +135,14 @@ export const getCommitFiles = stagedFiles =>
...
@@ -135,7 +135,14 @@ export const getCommitFiles = stagedFiles =>
});
});
},
[]);
},
[]);
export
const
createCommitPayload
=
({
branch
,
getters
,
newBranch
,
state
,
rootState
})
=>
({
export
const
createCommitPayload
=
({
branch
,
getters
,
newBranch
,
state
,
rootState
,
rootGetters
,
})
=>
({
branch
,
branch
,
commit_message
:
state
.
commitMessage
||
getters
.
preBuiltCommitMessage
,
commit_message
:
state
.
commitMessage
||
getters
.
preBuiltCommitMessage
,
actions
:
getCommitFiles
(
rootState
.
stagedFiles
).
map
(
f
=>
({
actions
:
getCommitFiles
(
rootState
.
stagedFiles
).
map
(
f
=>
({
...
@@ -146,7 +153,7 @@ export const createCommitPayload = ({ branch, getters, newBranch, state, rootSta
...
@@ -146,7 +153,7 @@ export const createCommitPayload = ({ branch, getters, newBranch, state, rootSta
encoding
:
f
.
base64
?
'
base64
'
:
'
text
'
,
encoding
:
f
.
base64
?
'
base64
'
:
'
text
'
,
last_commit_id
:
newBranch
||
f
.
deleted
||
f
.
prevPath
?
undefined
:
f
.
lastCommitSha
,
last_commit_id
:
newBranch
||
f
.
deleted
||
f
.
prevPath
?
undefined
:
f
.
lastCommitSha
,
})),
})),
start_
branch
:
newBranch
?
rootState
.
currentBranchI
d
:
undefined
,
start_
sha
:
newBranch
?
rootGetters
.
lastCommit
.
short_i
d
:
undefined
,
});
});
export
const
createNewMergeRequestUrl
=
(
projectUrl
,
source
,
target
)
=>
export
const
createNewMergeRequestUrl
=
(
projectUrl
,
source
,
target
)
=>
...
...
app/assets/javascripts/mr_popover/queries/merge_request.graphql
View file @
14de9c92
query
mergeRequest
(
$projectPath
:
ID
!,
$mergeRequestIID
:
ID
!)
{
query
mergeRequest
(
$projectPath
:
ID
!,
$mergeRequestIID
:
String
!)
{
project
(
fullPath
:
$projectPath
)
{
project
(
fullPath
:
$projectPath
)
{
mergeRequest
(
iid
:
$mergeRequestIID
)
{
mergeRequest
(
iid
:
$mergeRequestIID
)
{
createdAt
createdAt
...
...
changelogs/unreleased/59023-fix-web-ide-creating-branches-off-new-commits.yml
0 → 100644
View file @
14de9c92
---
title
:
Fix IDE commit using latest ref in branch and overriding contents
merge_request
:
29769
author
:
type
:
fixed
changelogs/unreleased/63261-the-graphql-query-for-the-mr-popover-failes-on-the-frontend.yml
0 → 100644
View file @
14de9c92
---
title
:
Make sure we are receiving the proper information on the MR Popover by updating
the IID in the graphql query
merge_request
:
author
:
type
:
fixed
spec/frontend/ide/services/index_spec.js
0 → 100644
View file @
14de9c92
import
services
from
'
~/ide/services
'
;
import
Api
from
'
~/api
'
;
jest
.
mock
(
'
~/api
'
);
const
TEST_PROJECT_ID
=
'
alice/wonderland
'
;
const
TEST_BRANCH
=
'
master-patch-123
'
;
const
TEST_COMMIT_SHA
=
'
123456789
'
;
describe
(
'
IDE services
'
,
()
=>
{
describe
(
'
commit
'
,
()
=>
{
let
payload
;
beforeEach
(()
=>
{
payload
=
{
branch
:
TEST_BRANCH
,
commit_message
:
'
Hello world
'
,
actions
:
[],
start_sha
:
undefined
,
};
Api
.
createBranch
.
mockReturnValue
(
Promise
.
resolve
());
Api
.
commitMultiple
.
mockReturnValue
(
Promise
.
resolve
());
});
describe
.
each
`
startSha | shouldCreateBranch
${
undefined
}
|
${
false
}
${
TEST_COMMIT_SHA
}
|
${
true
}
`
(
'
when start_sha is $startSha
'
,
({
startSha
,
shouldCreateBranch
})
=>
{
beforeEach
(()
=>
{
payload
.
start_sha
=
startSha
;
return
services
.
commit
(
TEST_PROJECT_ID
,
payload
);
});
if
(
shouldCreateBranch
)
{
it
(
'
should create branch
'
,
()
=>
{
expect
(
Api
.
createBranch
).
toHaveBeenCalledWith
(
TEST_PROJECT_ID
,
{
ref
:
TEST_COMMIT_SHA
,
branch
:
TEST_BRANCH
,
});
});
}
else
{
it
(
'
should not create branch
'
,
()
=>
{
expect
(
Api
.
createBranch
).
not
.
toHaveBeenCalled
();
});
}
it
(
'
should commit
'
,
()
=>
{
expect
(
Api
.
commitMultiple
).
toHaveBeenCalledWith
(
TEST_PROJECT_ID
,
payload
);
});
});
});
});
spec/javascripts/ide/stores/modules/commit/actions_spec.js
View file @
14de9c92
...
@@ -6,9 +6,11 @@ import eventHub from '~/ide/eventhub';
...
@@ -6,9 +6,11 @@ import eventHub from '~/ide/eventhub';
import
consts
from
'
~/ide/stores/modules/commit/constants
'
;
import
consts
from
'
~/ide/stores/modules/commit/constants
'
;
import
*
as
mutationTypes
from
'
~/ide/stores/modules/commit/mutation_types
'
;
import
*
as
mutationTypes
from
'
~/ide/stores/modules/commit/mutation_types
'
;
import
*
as
actions
from
'
~/ide/stores/modules/commit/actions
'
;
import
*
as
actions
from
'
~/ide/stores/modules/commit/actions
'
;
import
testAction
from
'
../../../../helpers/vuex_action_helper
'
;
import
{
commitActionTypes
}
from
'
~/ide/constants
'
;
import
{
commitActionTypes
}
from
'
~/ide/constants
'
;
import
{
resetStore
,
file
}
from
'
spec/ide/helpers
'
;
import
{
resetStore
,
file
}
from
'
spec/ide/helpers
'
;
import
testAction
from
'
../../../../helpers/vuex_action_helper
'
;
const
TEST_COMMIT_SHA
=
'
123456789
'
;
describe
(
'
IDE commit module actions
'
,
()
=>
{
describe
(
'
IDE commit module actions
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
...
@@ -139,6 +141,9 @@ describe('IDE commit module actions', () => {
...
@@ -139,6 +141,9 @@ describe('IDE commit module actions', () => {
branches
:
{
branches
:
{
master
:
{
master
:
{
workingReference
:
''
,
workingReference
:
''
,
commit
:
{
short_id
:
TEST_COMMIT_SHA
,
},
},
},
},
},
};
};
...
@@ -239,6 +244,9 @@ describe('IDE commit module actions', () => {
...
@@ -239,6 +244,9 @@ describe('IDE commit module actions', () => {
branches
:
{
branches
:
{
master
:
{
master
:
{
workingReference
:
'
1
'
,
workingReference
:
'
1
'
,
commit
:
{
short_id
:
TEST_COMMIT_SHA
,
},
},
},
},
},
};
};
...
@@ -247,7 +255,7 @@ describe('IDE commit module actions', () => {
...
@@ -247,7 +255,7 @@ describe('IDE commit module actions', () => {
...
file
(
'
changed
'
),
...
file
(
'
changed
'
),
type
:
'
blob
'
,
type
:
'
blob
'
,
active
:
true
,
active
:
true
,
lastCommitSha
:
'
123456789
'
,
lastCommitSha
:
TEST_COMMIT_SHA
,
};
};
store
.
state
.
stagedFiles
.
push
(
f
);
store
.
state
.
stagedFiles
.
push
(
f
);
store
.
state
.
changedFiles
=
[
store
.
state
.
changedFiles
=
[
...
@@ -307,7 +315,7 @@ describe('IDE commit module actions', () => {
...
@@ -307,7 +315,7 @@ describe('IDE commit module actions', () => {
previous_path
:
undefined
,
previous_path
:
undefined
,
},
},
],
],
start_
branch
:
'
master
'
,
start_
sha
:
TEST_COMMIT_SHA
,
});
});
done
();
done
();
...
@@ -330,11 +338,11 @@ describe('IDE commit module actions', () => {
...
@@ -330,11 +338,11 @@ describe('IDE commit module actions', () => {
file_path
:
jasmine
.
anything
(),
file_path
:
jasmine
.
anything
(),
content
:
undefined
,
content
:
undefined
,
encoding
:
jasmine
.
anything
(),
encoding
:
jasmine
.
anything
(),
last_commit_id
:
'
123456789
'
,
last_commit_id
:
TEST_COMMIT_SHA
,
previous_path
:
undefined
,
previous_path
:
undefined
,
},
},
],
],
start_
branch
:
undefined
,
start_
sha
:
undefined
,
});
});
done
();
done
();
...
...
spec/javascripts/ide/stores/utils_spec.js
View file @
14de9c92
...
@@ -132,7 +132,7 @@ describe('Multi-file store utils', () => {
...
@@ -132,7 +132,7 @@ describe('Multi-file store utils', () => {
previous_path
:
undefined
,
previous_path
:
undefined
,
},
},
],
],
start_
branch
:
undefined
,
start_
sha
:
undefined
,
});
});
});
});
...
@@ -187,7 +187,7 @@ describe('Multi-file store utils', () => {
...
@@ -187,7 +187,7 @@ describe('Multi-file store utils', () => {
previous_path
:
undefined
,
previous_path
:
undefined
,
},
},
],
],
start_
branch
:
undefined
,
start_
sha
:
undefined
,
});
});
});
});
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment