@zq-silk/yui 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -229,8 +229,8 @@ const taskChildren = [
|
|
|
229
229
|
{
|
|
230
230
|
name: "rebuild",
|
|
231
231
|
summary: "Rebuild a legacy Task workspace under its canonical identity.",
|
|
232
|
-
usage: "yui task rebuild <task>",
|
|
233
|
-
options: []
|
|
232
|
+
usage: "yui task rebuild <task> [--latest]",
|
|
233
|
+
options: ["--latest"]
|
|
234
234
|
},
|
|
235
235
|
{
|
|
236
236
|
name: "history",
|
|
@@ -20,11 +20,17 @@ export async function runTaskWorkspaceCommand(args, store, preparer, options = {
|
|
|
20
20
|
+ "yui task history list|archive [task], yui task replace <task>.");
|
|
21
21
|
}
|
|
22
22
|
async function rebuildTaskCommand(args, preparer) {
|
|
23
|
-
const usage = "Task rebuild usage: yui task rebuild <task
|
|
23
|
+
const usage = "Task rebuild usage: yui task rebuild <task> [--latest].";
|
|
24
24
|
const taskId = args[0];
|
|
25
|
-
|
|
25
|
+
const options = new Set(args.slice(1));
|
|
26
|
+
if (taskId === undefined
|
|
27
|
+
|| options.size !== args.length - 1
|
|
28
|
+
|| [...options].some((option) => option !== "--latest")) {
|
|
26
29
|
throw usageError(usage);
|
|
27
|
-
|
|
30
|
+
}
|
|
31
|
+
const result = await preparer.rebuildTaskWorkspace(taskId, {
|
|
32
|
+
latestRemote: options.has("--latest")
|
|
33
|
+
});
|
|
28
34
|
const archived = result.archived.length === 0
|
|
29
35
|
? "no legacy refs"
|
|
30
36
|
: `${result.archived.length} legacy ref(s) archived`;
|
|
@@ -35,7 +41,8 @@ async function rebuildTaskCommand(args, preparer) {
|
|
|
35
41
|
data: {
|
|
36
42
|
taskId: result.task.id,
|
|
37
43
|
archived: result.archived,
|
|
38
|
-
resumed: result.resumed
|
|
44
|
+
resumed: result.resumed,
|
|
45
|
+
latestRemote: options.has("--latest")
|
|
39
46
|
}
|
|
40
47
|
};
|
|
41
48
|
}
|
|
@@ -1485,7 +1485,7 @@ export class FileTaskWorkspacePreparer {
|
|
|
1485
1485
|
* A Task that already carries an identity takes the resume path: only the
|
|
1486
1486
|
* pending legacy archive and old-worktree removal run.
|
|
1487
1487
|
*/
|
|
1488
|
-
async rebuildTaskWorkspace(taskId) {
|
|
1488
|
+
async rebuildTaskWorkspace(taskId, options = {}) {
|
|
1489
1489
|
const task = requireTask(this.store, taskId);
|
|
1490
1490
|
if (!["draft", "active"].includes(task.status)) {
|
|
1491
1491
|
throw new Error(`Only a draft or active Task can be rebuilt in place: ${task.id}/${task.status}.`);
|
|
@@ -1518,9 +1518,12 @@ export class FileTaskWorkspacePreparer {
|
|
|
1518
1518
|
const pins = new Map();
|
|
1519
1519
|
for (const binding of task.projectBindings) {
|
|
1520
1520
|
const project = requireProject(this.store, binding.projectId);
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1521
|
+
// `--latest` explicitly re-resolves every remote-backed Project. Without
|
|
1522
|
+
// it, only a still-symbolic creation default is refreshed; an explicit
|
|
1523
|
+
// or previously pinned commit retains the established rebuild behavior.
|
|
1524
|
+
const useRemoteDefault = (options.latestRemote === true
|
|
1525
|
+
|| (defaultProjects.has(project.id) && !looksLikeCommit(binding.baseRef)))
|
|
1526
|
+
&& project.remoteUrl !== undefined;
|
|
1524
1527
|
if (useRemoteDefault) {
|
|
1525
1528
|
const resolver = this.git.resolveRemoteBaseline;
|
|
1526
1529
|
if (typeof resolver !== "function") {
|
|
@@ -1529,9 +1532,9 @@ export class FileTaskWorkspacePreparer {
|
|
|
1529
1532
|
const remote = await resolver.call(this.git, {
|
|
1530
1533
|
repositoryPath: project.path,
|
|
1531
1534
|
remoteUrl: project.remoteUrl,
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
+
developmentRef: options.latestRemote === true
|
|
1536
|
+
? project.developmentBranch
|
|
1537
|
+
: binding.baseRef
|
|
1535
1538
|
});
|
|
1536
1539
|
pins.set(project.id, remote.commit);
|
|
1537
1540
|
}
|