Comparing version
{ | ||
"name": "libzap", | ||
"version": "0.0.85", | ||
"version": "0.0.86", | ||
"description": "JavaScript library for Zap", | ||
@@ -5,0 +5,0 @@ "license": "none", |
@@ -62,2 +62,6 @@ import { Disposable, Emitter, Event } from "vscode-jsonrpc"; | ||
public async attachWorkspace(refID: RefIdentifier, workspace: Workspace, mergeStrategy: MergeStrategy): Promise<void> { | ||
if (!/^branch\//.test(refID.ref) && refID.ref !== "HEAD") { | ||
throw new Error(`invalid Zap ref: ${JSON.stringify(refID.ref)} (no 'branch/' prefix)`); | ||
} | ||
if (this.attaching) { throw new Error(`Attach workspace called multiple times while in process of attaching.`); } | ||
@@ -64,0 +68,0 @@ this.attaching = true; |
@@ -37,3 +37,3 @@ import * as assert from "assert"; | ||
repo: "repo", | ||
ref: "ref", | ||
ref: "branch/b", | ||
state: { gitBase: "c", gitBranch: "d" }, | ||
@@ -47,3 +47,3 @@ } as RefUpdateDownstreamParams); | ||
repo: "repo", | ||
ref: "ref", | ||
ref: "branch/b", | ||
current: { gitBase: "c", gitBranch: "d", rev: 0 }, | ||
@@ -67,3 +67,3 @@ op: { head: "a" }, | ||
repo: "repo", | ||
ref: "ref", | ||
ref: "branch/b", | ||
state: { gitBase: "c", gitBranch: "d" }, | ||
@@ -74,3 +74,3 @@ } as RefUpdateDownstreamParams); | ||
return client.start().initialStart.then(() => { | ||
return handler.attachWorkspace({ repo: "repo", ref: "ref" }, workspace, MergeStrategy.RemoteClobbersLocal).then(() => { | ||
return handler.attachWorkspace({ repo: "repo", ref: "branch/b" }, workspace, MergeStrategy.RemoteClobbersLocal).then(() => { | ||
workspace.mockRecordOp({ head: "a" }); | ||
@@ -88,3 +88,3 @@ return assertResolved(ok, "server did not receive 'ref/update' from client"); | ||
repo: "repo", | ||
ref: "ref", | ||
ref: "branch/b", | ||
state: { gitBase: "c", gitBranch: "d" }, | ||
@@ -101,3 +101,3 @@ } as RefUpdateDownstreamParams); | ||
repo: "repo", | ||
ref: "ref", | ||
ref: "branch/b", | ||
state: { gitBase: "c", gitBranch: "d" }, | ||
@@ -109,9 +109,9 @@ } as RefUpdateDownstreamParams); | ||
let ok = false; | ||
(handler as any).getRepo("repo").getRef("ref").ot.ack = () => { ok = true; }; | ||
(handler as any).getRepo("repo").getRef("branch/b").ot.ack = () => { ok = true; }; | ||
return client.start().initialStart.then(async () => { | ||
await handler.attachWorkspace({ repo: "repo", ref: "ref" }, workspace, MergeStrategy.RemoteClobbersLocal); | ||
await handler.attachWorkspace({ repo: "repo", ref: "branch/b" }, workspace, MergeStrategy.RemoteClobbersLocal); | ||
await server.sendRequest(RefUpdateDownstreamRequest.type, { | ||
repo: "repo", | ||
ref: "ref", | ||
ref: "branch/b", | ||
current: { gitBase: "c", gitBranch: "d" }, | ||
@@ -118,0 +118,0 @@ ack: true, |
@@ -283,2 +283,6 @@ import { NotificationType, NotificationType0, RequestType, RequestType0 } from "vscode-jsonrpc"; | ||
export interface RefInfoParams extends RefIdentifier { | ||
fuzzy?: boolean; | ||
} | ||
export interface RefBaseInfo { | ||
@@ -352,3 +356,3 @@ gitBase: string; | ||
export namespace RefInfoRequest { | ||
export const type = new RequestType<RefIdentifier, RefInfo, void, void>("ref/info"); | ||
export const type = new RequestType<RefInfoParams, RefInfo, void, void>("ref/info"); | ||
} | ||
@@ -355,0 +359,0 @@ |
662878
0.04%19531
0.03%