Merge with 2.0.0-m3

This commit is contained in:
Rene Pfeuffer
2019-11-18 13:15:54 +01:00
7 changed files with 42 additions and 12 deletions

View File

@@ -17,7 +17,7 @@ public class ConcurrentModificationException extends ExceptionWithContext {
this(Collections.singletonList(new ContextEntry(type, id)));
}
private ConcurrentModificationException(List<ContextEntry> context) {
public ConcurrentModificationException(List<ContextEntry> context) {
super(context, createMessage(context));
}
@@ -32,3 +32,4 @@ public class ConcurrentModificationException extends ExceptionWithContext {
.collect(joining(" in ", "", " has been modified concurrently"));
}
}

View File

@@ -213,8 +213,14 @@ public class GitBrowseCommand extends AbstractGitCommand
if (lfsPointer.isPresent()) {
BlobStore lfsBlobStore = lfsBlobStoreFactory.getLfsBlobStore(repository);
Blob blob = lfsBlobStore.get(lfsPointer.get().getOid().getName());
String oid = lfsPointer.get().getOid().getName();
Blob blob = lfsBlobStore.get(oid);
if (blob == null) {
logger.error("lfs blob for lob id {} not found in lfs store of repository {}", oid, repository.getNamespaceAndName());
file.setLength(-1);
} else {
file.setLength(blob.getSize());
}
} else {
file.setLength(loader.getSize());
}

View File

@@ -145,7 +145,12 @@ public class GitCatCommand extends AbstractGitCommand implements CatCommand {
private Loader loadFromLfsStore(TreeWalk treeWalk, RevWalk revWalk, LfsPointer lfsPointer) throws IOException {
BlobStore lfsBlobStore = lfsBlobStoreFactory.getLfsBlobStore(repository);
Blob blob = lfsBlobStore.get(lfsPointer.getOid().getName());
String oid = lfsPointer.getOid().getName();
Blob blob = lfsBlobStore.get(oid);
if (blob == null) {
logger.error("lfs blob for lob id {} not found in lfs store of repository {}", oid, repository.getNamespaceAndName());
throw notFound(entity("LFS", oid).in(repository));
}
GitUtil.release(revWalk);
GitUtil.release(treeWalk);
return new BlobLoader(blob);

View File

@@ -77,7 +77,9 @@ public class HgBrowseCommand extends AbstractCommand implements BrowseCommand
String revision = MoreObjects.firstNonNull(request.getRevision(), "tip");
Changeset c = LogCommand.on(getContext().open()).rev(revision).limit(1).single();
if (c != null) {
cmd.rev(c.getNode());
}
if (!Strings.isNullOrEmpty(request.getPath()))
{
@@ -100,6 +102,6 @@ public class HgBrowseCommand extends AbstractCommand implements BrowseCommand
}
FileObject file = cmd.execute();
return new BrowserResult(c.getNode(), revision, file);
return new BrowserResult(c == null? "tip": c.getNode(), revision, file);
}
}

View File

@@ -80,7 +80,7 @@ class ApiClient {
return fetch(createUrl(url), applyFetchOptions({})).then(handleFailure);
}
post(url: string, payload: any, contentType = "application/json") {
post(url: string, payload?: any, contentType = "application/json") {
return this.httpRequestWithJSONBody("POST", url, contentType, payload);
}
@@ -115,11 +115,13 @@ class ApiClient {
return fetch(createUrl(url), options).then(handleFailure);
}
httpRequestWithJSONBody(method: string, url: string, contentType: string, payload: any): Promise<Response> {
httpRequestWithJSONBody(method: string, url: string, contentType: string, payload?: any): Promise<Response> {
const options: RequestInit = {
method: method,
body: JSON.stringify(payload)
method: method
};
if (payload) {
options.body = JSON.stringify(payload);
}
return this.httpRequestWithBinaryBody(options, url, contentType);
}

View File

@@ -18,6 +18,7 @@ export type ButtonProps = {
type Props = ButtonProps &
RouteComponentProps & {
title?: string;
type?: "button" | "submit" | "reset";
color?: string;
};
@@ -38,7 +39,19 @@ class Button extends React.Component<Props> {
};
render() {
const { label, loading, disabled, type, color, className, icon, fullWidth, reducedMobile, children } = this.props;
const {
label,
title,
loading,
disabled,
type,
color,
className,
icon,
fullWidth,
reducedMobile,
children
} = this.props;
const loadingClass = loading ? "is-loading" : "";
const fullWidthClass = fullWidth ? "is-fullwidth" : "";
const reducedMobileClass = reducedMobile ? "is-reduced-mobile" : "";
@@ -46,6 +59,7 @@ class Button extends React.Component<Props> {
return (
<button
type={type}
title={title}
disabled={disabled}
onClick={this.onClick}
className={classNames("button", "is-" + color, loadingClass, fullWidthClass, reducedMobileClass, className)}
@@ -63,6 +77,7 @@ class Button extends React.Component<Props> {
return (
<button
type={type}
title={title}
disabled={disabled}
onClick={this.onClick}
className={classNames("button", "is-" + color, loadingClass, fullWidthClass, className)}

View File

@@ -48,7 +48,6 @@ const buttonStory = (name: string, storyFn: () => ReactElement) => {
.addDecorator(SpacingDecorator)
.add("Default", storyFn);
};
buttonStory("AddButton", () => <AddButton>Add</AddButton>);
buttonStory("CreateButton", () => <CreateButton>Create</CreateButton>);
buttonStory("DeleteButton", () => <DeleteButton>Delete</DeleteButton>);