mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
Merged in feature/merge_conflictResolution (pull request #126)
Feature/merge conflictResolution
This commit is contained in:
@@ -0,0 +1,59 @@
|
|||||||
|
//@flow
|
||||||
|
import React from "react";
|
||||||
|
import type { Repository } from "@scm-manager/ui-types";
|
||||||
|
import { translate } from "react-i18next";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
repository: Repository,
|
||||||
|
target: string,
|
||||||
|
source: string,
|
||||||
|
t: string => string
|
||||||
|
};
|
||||||
|
|
||||||
|
class GitMergeInformation extends React.Component<Props> {
|
||||||
|
render() {
|
||||||
|
const { source, target, t } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<h4>{t("scm-git-plugin.information.merge.heading")}</h4>
|
||||||
|
{t("scm-git-plugin.information.merge.checkout")}
|
||||||
|
<pre>
|
||||||
|
<code>git checkout {target}</code>
|
||||||
|
</pre>
|
||||||
|
{t("scm-git-plugin.information.merge.update")}
|
||||||
|
<pre>
|
||||||
|
<code>
|
||||||
|
git pull
|
||||||
|
</code>
|
||||||
|
</pre>
|
||||||
|
{t("scm-git-plugin.information.merge.merge")}
|
||||||
|
<pre>
|
||||||
|
<code>
|
||||||
|
git merge {source}
|
||||||
|
</code>
|
||||||
|
</pre>
|
||||||
|
{t("scm-git-plugin.information.merge.resolve")}
|
||||||
|
<pre>
|
||||||
|
<code>
|
||||||
|
git add <conflict file>
|
||||||
|
</code>
|
||||||
|
</pre>
|
||||||
|
{t("scm-git-plugin.information.merge.commit")}
|
||||||
|
<pre>
|
||||||
|
<code>
|
||||||
|
git commit -m "Merge {source} into {target}"
|
||||||
|
</code>
|
||||||
|
</pre>
|
||||||
|
{t("scm-git-plugin.information.merge.push")}
|
||||||
|
<pre>
|
||||||
|
<code>
|
||||||
|
git push
|
||||||
|
</code>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default translate("plugins")(GitMergeInformation);
|
||||||
@@ -5,6 +5,7 @@ import GitAvatar from "./GitAvatar";
|
|||||||
|
|
||||||
import { ConfigurationBinder as cfgBinder } from "@scm-manager/ui-components";
|
import { ConfigurationBinder as cfgBinder } from "@scm-manager/ui-components";
|
||||||
import GitGlobalConfiguration from "./GitGlobalConfiguration";
|
import GitGlobalConfiguration from "./GitGlobalConfiguration";
|
||||||
|
import GitMergeInformation from "./GitMergeInformation";
|
||||||
|
|
||||||
// repository
|
// repository
|
||||||
|
|
||||||
@@ -13,6 +14,7 @@ const gitPredicate = (props: Object) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
binder.bind("repos.repository-details.information", ProtocolInformation, gitPredicate);
|
binder.bind("repos.repository-details.information", ProtocolInformation, gitPredicate);
|
||||||
|
binder.bind("repos.repository-merge.information", GitMergeInformation, gitPredicate);
|
||||||
binder.bind("repos.repository-avatar", GitAvatar, gitPredicate);
|
binder.bind("repos.repository-avatar", GitAvatar, gitPredicate);
|
||||||
|
|
||||||
// global config
|
// global config
|
||||||
|
|||||||
@@ -3,7 +3,16 @@
|
|||||||
"information": {
|
"information": {
|
||||||
"clone" : "Clone the repository",
|
"clone" : "Clone the repository",
|
||||||
"create" : "Create a new repository",
|
"create" : "Create a new repository",
|
||||||
"replace" : "Push an existing repository"
|
"replace" : "Push an existing repository",
|
||||||
|
"merge": {
|
||||||
|
"heading": "How to merge source branch into target branch",
|
||||||
|
"checkout": "1. Make sure your workspace is clean and checkout target branch",
|
||||||
|
"update": "2. Update workspace",
|
||||||
|
"merge": "3. Merge source branch",
|
||||||
|
"resolve": "4. Resolve merge conflicts and add corrected files to index",
|
||||||
|
"commit": "5. Commit",
|
||||||
|
"push": "6. Push your merge"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"link": "Git",
|
"link": "Git",
|
||||||
|
|||||||
@@ -16,30 +16,19 @@ function handleStatusCode(response: Response) {
|
|||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
switch (response.status) {
|
switch (response.status) {
|
||||||
case 401:
|
case 401:
|
||||||
return throwError(response, UNAUTHORIZED_ERROR);
|
throw UNAUTHORIZED_ERROR;
|
||||||
case 404:
|
case 404:
|
||||||
return throwError(response, NOT_FOUND_ERROR);
|
throw NOT_FOUND_ERROR;
|
||||||
case 409:
|
case 409:
|
||||||
return throwError(response, CONFLICT_ERROR);
|
throw CONFLICT_ERROR;
|
||||||
default:
|
default:
|
||||||
return throwError(response, new Error("server returned status code " + response.status));
|
throw new Error("server returned status code " + response.status);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
function throwError(response: Response, err: Error) {
|
|
||||||
return response.json().then(
|
|
||||||
json => {
|
|
||||||
throw Error(json.message);
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createUrl(url: string) {
|
export function createUrl(url: string) {
|
||||||
if (url.includes("://")) {
|
if (url.includes("://")) {
|
||||||
return url;
|
return url;
|
||||||
|
|||||||
Reference in New Issue
Block a user