debian-mirror-gitlab/app/assets/javascripts/ide/stores/mutations/branch.js

38 lines
1,018 B
JavaScript
Raw Normal View History

2018-05-09 12:01:36 +05:30
import * as types from '../mutation_types';
export default {
[types.SET_CURRENT_BRANCH](state, currentBranchId) {
Object.assign(state, {
currentBranchId,
});
},
[types.SET_BRANCH](state, { projectPath, branchName, branch }) {
Object.assign(state.projects[projectPath], {
branches: {
[branchName]: {
...branch,
treeId: `${projectPath}/${branchName}`,
active: true,
workingReference: '',
},
},
});
},
[types.SET_BRANCH_WORKING_REFERENCE](state, { projectId, branchId, reference }) {
2019-09-04 21:01:54 +05:30
if (!state.projects[projectId].branches[branchId]) {
Object.assign(state.projects[projectId].branches, {
[branchId]: {},
});
}
2018-05-09 12:01:36 +05:30
Object.assign(state.projects[projectId].branches[branchId], {
workingReference: reference,
});
},
2018-10-15 14:42:47 +05:30
[types.SET_BRANCH_COMMIT](state, { projectId, branchId, commit }) {
Object.assign(state.projects[projectId].branches[branchId], {
commit,
});
},
2018-05-09 12:01:36 +05:30
};