@davmash/bygone 0.8.9 → 0.8.11
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.
- package/CHANGELOG.md +8 -0
- package/docs/releasing.md +2 -0
- package/media/webview.js +136 -136
- package/out/standalone-main.js +104 -51
- package/package.json +1 -1
package/out/standalone-main.js
CHANGED
|
@@ -2624,6 +2624,7 @@ __export(gitComparison_exports, {
|
|
|
2624
2624
|
listBranchCommits: () => listBranchCommits,
|
|
2625
2625
|
listChangedPaths: () => listChangedPaths,
|
|
2626
2626
|
materializeBranchReviewTrees: () => materializeBranchReviewTrees,
|
|
2627
|
+
materializeGitTree: () => materializeGitTree,
|
|
2627
2628
|
parseNameStatusZ: () => parseNameStatusZ,
|
|
2628
2629
|
resolveBranchReviewRange: () => resolveBranchReviewRange,
|
|
2629
2630
|
resolveReviewPathPair: () => resolveReviewPathPair
|
|
@@ -2764,6 +2765,15 @@ function materializeBranchReviewTrees(review, leftRoot, rightRoot) {
|
|
|
2764
2765
|
}
|
|
2765
2766
|
}
|
|
2766
2767
|
}
|
|
2768
|
+
function materializeGitTree(repoRoot, relativeDir, targetRoot, commit = "HEAD") {
|
|
2769
|
+
for (const relativeFile of listGitBlobPaths(repoRoot, commit, relativeDir)) {
|
|
2770
|
+
writeMaterializedGitFile(
|
|
2771
|
+
targetRoot,
|
|
2772
|
+
relativeFile,
|
|
2773
|
+
readGitBlob(repoRoot, commit, relativeFile)
|
|
2774
|
+
);
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2767
2777
|
function resolveReviewPathPair(changedPaths, selectedPath) {
|
|
2768
2778
|
const changedPath = changedPaths.find((candidate) => candidate.path === selectedPath || candidate.previousPath === selectedPath);
|
|
2769
2779
|
if (!changedPath) {
|
|
@@ -2805,21 +2815,90 @@ function tryRunGit(runGit2, args, cwd) {
|
|
|
2805
2815
|
}
|
|
2806
2816
|
}
|
|
2807
2817
|
function materializeGitPath(repoRoot, commit, relativePath, targetRoot) {
|
|
2808
|
-
if (!relativePath) {
|
|
2818
|
+
if (!relativePath || !isGitBlobPath(repoRoot, commit, relativePath)) {
|
|
2809
2819
|
return;
|
|
2810
2820
|
}
|
|
2821
|
+
writeMaterializedGitFile(targetRoot, relativePath, readGitBlob(repoRoot, commit, relativePath));
|
|
2822
|
+
}
|
|
2823
|
+
function writeMaterializedGitFile(targetRoot, relativePath, content) {
|
|
2811
2824
|
const resolvedRoot = path7.resolve(targetRoot);
|
|
2812
2825
|
const targetFile = path7.resolve(resolvedRoot, relativePath);
|
|
2813
2826
|
if (targetFile !== resolvedRoot && !targetFile.startsWith(`${resolvedRoot}${path7.sep}`)) {
|
|
2814
2827
|
throw new Error(`Refusing to materialize path outside review root: ${relativePath}`);
|
|
2815
2828
|
}
|
|
2816
|
-
|
|
2829
|
+
fs6.mkdirSync(path7.dirname(targetFile), { recursive: true });
|
|
2830
|
+
fs6.writeFileSync(targetFile, content);
|
|
2831
|
+
}
|
|
2832
|
+
function listGitBlobPaths(repoRoot, commit, relativeDir) {
|
|
2833
|
+
if (commit === "INDEX") {
|
|
2834
|
+
const args2 = ["ls-files", "--stage", "-z", "--"];
|
|
2835
|
+
if (relativeDir) {
|
|
2836
|
+
args2.push(relativeDir);
|
|
2837
|
+
}
|
|
2838
|
+
return parseNulRecords(runGitText(repoRoot, args2)).flatMap((record) => {
|
|
2839
|
+
const parsed = parseIndexStageRecord(record);
|
|
2840
|
+
return parsed && parsed.mode !== GITLINK_MODE ? [parsed.path] : [];
|
|
2841
|
+
});
|
|
2842
|
+
}
|
|
2843
|
+
const args = ["ls-tree", "-r", "-z", commit];
|
|
2844
|
+
if (relativeDir) {
|
|
2845
|
+
args.push("--", relativeDir);
|
|
2846
|
+
}
|
|
2847
|
+
return parseNulRecords(runGitText(repoRoot, args)).flatMap((record) => {
|
|
2848
|
+
const parsed = parseLsTreeRecord(record);
|
|
2849
|
+
return parsed && parsed.type === "blob" ? [parsed.path] : [];
|
|
2850
|
+
});
|
|
2851
|
+
}
|
|
2852
|
+
function isGitBlobPath(repoRoot, commit, relativePath) {
|
|
2853
|
+
if (commit === "INDEX") {
|
|
2854
|
+
return listGitBlobPaths(repoRoot, commit, relativePath).includes(relativePath);
|
|
2855
|
+
}
|
|
2856
|
+
const parsed = parseLsTreeRecord(parseNulRecords(runGitText(repoRoot, ["ls-tree", "-z", commit, "--", relativePath]))[0] ?? "");
|
|
2857
|
+
return parsed?.type === "blob";
|
|
2858
|
+
}
|
|
2859
|
+
function parseNulRecords(output) {
|
|
2860
|
+
return output.split("\0").filter((record) => record.length > 0);
|
|
2861
|
+
}
|
|
2862
|
+
function parseLsTreeRecord(record) {
|
|
2863
|
+
const tab = record.indexOf(" ");
|
|
2864
|
+
if (tab === -1) {
|
|
2865
|
+
return void 0;
|
|
2866
|
+
}
|
|
2867
|
+
const type = record.slice(0, tab).split(" ")[1];
|
|
2868
|
+
const relativePath = record.slice(tab + 1);
|
|
2869
|
+
if (!type || !relativePath) {
|
|
2870
|
+
return void 0;
|
|
2871
|
+
}
|
|
2872
|
+
return { type, path: relativePath };
|
|
2873
|
+
}
|
|
2874
|
+
function parseIndexStageRecord(record) {
|
|
2875
|
+
const tab = record.indexOf(" ");
|
|
2876
|
+
if (tab === -1) {
|
|
2877
|
+
return void 0;
|
|
2878
|
+
}
|
|
2879
|
+
const mode = record.slice(0, tab).split(" ")[0];
|
|
2880
|
+
const relativePath = record.slice(tab + 1);
|
|
2881
|
+
if (!mode || !relativePath) {
|
|
2882
|
+
return void 0;
|
|
2883
|
+
}
|
|
2884
|
+
return { mode, path: relativePath };
|
|
2885
|
+
}
|
|
2886
|
+
function readGitBlob(repoRoot, commit, relativePath) {
|
|
2887
|
+
const spec = commit && commit !== "INDEX" ? `${commit}:${relativePath}` : `:${relativePath}`;
|
|
2888
|
+
return (0, import_child_process3.execFileSync)("git", ["show", spec], {
|
|
2817
2889
|
cwd: repoRoot,
|
|
2890
|
+
encoding: "buffer",
|
|
2891
|
+
maxBuffer: readGitMaxBuffer(),
|
|
2892
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
2893
|
+
});
|
|
2894
|
+
}
|
|
2895
|
+
function runGitText(repoRoot, args) {
|
|
2896
|
+
return (0, import_child_process3.execFileSync)("git", [...args], {
|
|
2897
|
+
cwd: repoRoot,
|
|
2898
|
+
encoding: "utf8",
|
|
2818
2899
|
maxBuffer: readGitMaxBuffer(),
|
|
2819
2900
|
stdio: ["ignore", "pipe", "pipe"]
|
|
2820
2901
|
});
|
|
2821
|
-
fs6.mkdirSync(path7.dirname(targetFile), { recursive: true });
|
|
2822
|
-
fs6.writeFileSync(targetFile, content);
|
|
2823
2902
|
}
|
|
2824
2903
|
function changeKindForStatus(code) {
|
|
2825
2904
|
if (code === "A") {
|
|
@@ -2843,7 +2922,7 @@ function readGitMaxBuffer() {
|
|
|
2843
2922
|
const parsed = Number.parseInt(process.env.BYGONE_GIT_MAX_BUFFER_BYTES ?? "", 10);
|
|
2844
2923
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_GIT_MAX_BUFFER_BYTES2;
|
|
2845
2924
|
}
|
|
2846
|
-
var import_child_process3, fs6, path7, DEFAULT_GIT_MAX_BUFFER_BYTES2;
|
|
2925
|
+
var import_child_process3, fs6, path7, DEFAULT_GIT_MAX_BUFFER_BYTES2, GITLINK_MODE;
|
|
2847
2926
|
var init_gitComparison = __esm({
|
|
2848
2927
|
"src/gitComparison.ts"() {
|
|
2849
2928
|
"use strict";
|
|
@@ -2851,6 +2930,7 @@ var init_gitComparison = __esm({
|
|
|
2851
2930
|
fs6 = __toESM(require("fs"));
|
|
2852
2931
|
path7 = __toESM(require("path"));
|
|
2853
2932
|
DEFAULT_GIT_MAX_BUFFER_BYTES2 = 64 * 1024 * 1024;
|
|
2933
|
+
GITLINK_MODE = "160000";
|
|
2854
2934
|
}
|
|
2855
2935
|
});
|
|
2856
2936
|
|
|
@@ -2886,6 +2966,12 @@ var require_navigationUtils = __commonJS({
|
|
|
2886
2966
|
}
|
|
2887
2967
|
return matches[0].index;
|
|
2888
2968
|
}
|
|
2969
|
+
function findMultiPanelChangeIndex(changes, pairIndex, blockIndex) {
|
|
2970
|
+
if (!Array.isArray(changes) || !Number.isInteger(pairIndex) || !Number.isInteger(blockIndex)) {
|
|
2971
|
+
return -1;
|
|
2972
|
+
}
|
|
2973
|
+
return changes.findIndex((change) => change.pairIndex === pairIndex && change.blockIndex === blockIndex);
|
|
2974
|
+
}
|
|
2889
2975
|
function buildBlockChanges(blocks, side) {
|
|
2890
2976
|
if (!Array.isArray(blocks) || side !== "left" && side !== "right") {
|
|
2891
2977
|
return [];
|
|
@@ -2957,6 +3043,7 @@ var require_navigationUtils = __commonJS({
|
|
|
2957
3043
|
buildDirectoryNavigationState: buildDirectoryNavigationState2,
|
|
2958
3044
|
containsModelLine,
|
|
2959
3045
|
findChangeIndexAtLine,
|
|
3046
|
+
findMultiPanelChangeIndex,
|
|
2960
3047
|
resolveFileNavigationAction
|
|
2961
3048
|
};
|
|
2962
3049
|
}
|
|
@@ -5198,7 +5285,7 @@ var require_changeTour = __commonJS({
|
|
|
5198
5285
|
const stack = source.stack.map((entry) => ({
|
|
5199
5286
|
id: entry.id,
|
|
5200
5287
|
ref: entry.ref,
|
|
5201
|
-
oid:
|
|
5288
|
+
oid: runGitText2(repoRoot, ["rev-parse", "--verify", `${entry.ref}^{commit}`]),
|
|
5202
5289
|
label: entry.label || entry.ref
|
|
5203
5290
|
}));
|
|
5204
5291
|
const adjacentChanges = stack.slice(0, -1).map((entry, index) => parseNameStatusZ2((0, import_child_process4.execFileSync)("git", [
|
|
@@ -5302,7 +5389,7 @@ var require_changeTour = __commonJS({
|
|
|
5302
5389
|
return false;
|
|
5303
5390
|
}
|
|
5304
5391
|
}
|
|
5305
|
-
function
|
|
5392
|
+
function runGitText2(repoRoot, args) {
|
|
5306
5393
|
return (0, import_child_process4.execFileSync)("git", args, {
|
|
5307
5394
|
cwd: repoRoot,
|
|
5308
5395
|
encoding: "utf8",
|
|
@@ -9210,7 +9297,7 @@ var require_package = __commonJS({
|
|
|
9210
9297
|
displayName: "Bygone",
|
|
9211
9298
|
desktopName: "com.davidmashburn.bygone.desktop",
|
|
9212
9299
|
description: "See how change happened. Visual diff and file history for VS Code.",
|
|
9213
|
-
version: "0.8.
|
|
9300
|
+
version: "0.8.11",
|
|
9214
9301
|
author: "David Mashburn",
|
|
9215
9302
|
license: "MIT",
|
|
9216
9303
|
private: false,
|
|
@@ -9421,6 +9508,7 @@ var require_package = __commonJS({
|
|
|
9421
9508
|
reinstall: "node ./scripts/dev-sync.mjs --install-only",
|
|
9422
9509
|
"release:check": "npm run security:audit && npm test && npm run bundle:check && npm run lint && npm run package:vsix && npm run package:npm && npm run package:npm:dry-run",
|
|
9423
9510
|
"release:build": "node ./scripts/release.mjs",
|
|
9511
|
+
"release:publish:npm": "npm publish ./dist/npm-package --access public",
|
|
9424
9512
|
"release:publish": "node ./scripts/release.mjs --publish",
|
|
9425
9513
|
"release:verify-macos": "node ./scripts/verify-macos-signing.mjs --require-notarized",
|
|
9426
9514
|
lint: "eslint . --max-warnings=0",
|
|
@@ -22441,7 +22529,7 @@ var { detectRipgrepCapability: detectRipgrepCapability2, startRepositorySearch:
|
|
|
22441
22529
|
var { buildRepositoryReplacementPlan: buildRepositoryReplacementPlan2, applyRepositoryReplacementPlan: applyRepositoryReplacementPlan2, undoRepositoryReplacementPlan: undoRepositoryReplacementPlan2 } = (init_repositoryReplace(), __toCommonJS(repositoryReplace_exports));
|
|
22442
22530
|
var { searchFileHistory: searchFileHistory2 } = (init_gitHistorySearch(), __toCommonJS(gitHistorySearch_exports));
|
|
22443
22531
|
var { classifyAuthoredTourPaths: classifyAuthoredTourPaths2, discoverAuthoredTourDocument: discoverAuthoredTourDocument2 } = (init_tourDocument(), __toCommonJS(tourDocument_exports));
|
|
22444
|
-
var { materializeBranchReviewTrees: materializeBranchReviewTrees2, resolveBranchReviewRange: resolveBranchReviewRange2, resolveReviewPathPair: resolveReviewPathPair2 } = (init_gitComparison(), __toCommonJS(gitComparison_exports));
|
|
22532
|
+
var { materializeBranchReviewTrees: materializeBranchReviewTrees2, materializeGitTree: materializeGitTree2, resolveBranchReviewRange: resolveBranchReviewRange2, resolveReviewPathPair: resolveReviewPathPair2 } = (init_gitComparison(), __toCommonJS(gitComparison_exports));
|
|
22445
22533
|
var { buildDirectoryNavigationState } = require_navigationUtils();
|
|
22446
22534
|
var { getMenuCapabilities } = require_menuUtils();
|
|
22447
22535
|
var {
|
|
@@ -24298,14 +24386,14 @@ function resolveGitRefForDiff(repoRoot, ref) {
|
|
|
24298
24386
|
}
|
|
24299
24387
|
function materializeGitDiffSource(repoRoot, source, targetRoot) {
|
|
24300
24388
|
if (source.kind === "index") {
|
|
24301
|
-
|
|
24389
|
+
materializeGitTree2(repoRoot, "", targetRoot, "INDEX");
|
|
24302
24390
|
return;
|
|
24303
24391
|
}
|
|
24304
24392
|
if (source.kind === "worktree") {
|
|
24305
24393
|
materializeWorkingTree(repoRoot, "", targetRoot);
|
|
24306
24394
|
return;
|
|
24307
24395
|
}
|
|
24308
|
-
|
|
24396
|
+
materializeGitTree2(repoRoot, "", targetRoot, source.sha);
|
|
24309
24397
|
}
|
|
24310
24398
|
function getGitDiffSourceLabel(source) {
|
|
24311
24399
|
if (source.label) {
|
|
@@ -24556,35 +24644,6 @@ function hasUnstagedDirectoryChanges(repoRoot, relativeDir) {
|
|
|
24556
24644
|
const output = runGit(["status", "--porcelain", "--", relativeDir || "."], repoRoot);
|
|
24557
24645
|
return output.split("\n").some((line) => line.length >= 2 && line[1] !== " ");
|
|
24558
24646
|
}
|
|
24559
|
-
function materializeGitTree(repoRoot, relativeDir, targetRoot, commit = "HEAD") {
|
|
24560
|
-
let files;
|
|
24561
|
-
if (commit === "INDEX") {
|
|
24562
|
-
const lsArgs = ["ls-files", "-z", "--"];
|
|
24563
|
-
if (relativeDir) {
|
|
24564
|
-
lsArgs.push(relativeDir);
|
|
24565
|
-
}
|
|
24566
|
-
files = execFileSync4("git", lsArgs, {
|
|
24567
|
-
cwd: repoRoot,
|
|
24568
|
-
encoding: "utf8",
|
|
24569
|
-
maxBuffer: GIT_MAX_BUFFER_BYTES2
|
|
24570
|
-
}).split("\0").filter((filePath) => filePath.length > 0);
|
|
24571
|
-
} else {
|
|
24572
|
-
const lsArgs = ["ls-tree", "-r", "-z", "--name-only", commit];
|
|
24573
|
-
if (relativeDir) {
|
|
24574
|
-
lsArgs.push("--", relativeDir);
|
|
24575
|
-
}
|
|
24576
|
-
files = execFileSync4("git", lsArgs, {
|
|
24577
|
-
cwd: repoRoot,
|
|
24578
|
-
encoding: "utf8",
|
|
24579
|
-
maxBuffer: GIT_MAX_BUFFER_BYTES2
|
|
24580
|
-
}).split("\0").filter((filePath) => filePath.length > 0);
|
|
24581
|
-
}
|
|
24582
|
-
for (const relativeFile of files) {
|
|
24583
|
-
const targetFile = path8.join(targetRoot, relativeFile);
|
|
24584
|
-
fs7.mkdirSync(path8.dirname(targetFile), { recursive: true });
|
|
24585
|
-
fs7.writeFileSync(targetFile, readGitBlob(repoRoot, commit === "INDEX" ? "" : commit, relativeFile));
|
|
24586
|
-
}
|
|
24587
|
-
}
|
|
24588
24647
|
function materializeWorkingTree(repoRoot, relativeDir, targetRoot) {
|
|
24589
24648
|
const lsArgs = ["ls-files", "-co", "-z", "--exclude-standard"];
|
|
24590
24649
|
if (relativeDir) {
|
|
@@ -24872,14 +24931,14 @@ function ensureDirectoryHistoryEntryMaterialized(dirHistory, index) {
|
|
|
24872
24931
|
const leftRoot = fs7.mkdtempSync(path8.join(os.tmpdir(), "bygone-dir-left-"));
|
|
24873
24932
|
const rightRoot = fs7.mkdtempSync(path8.join(os.tmpdir(), "bygone-dir-right-"));
|
|
24874
24933
|
if (entry.commit === "WORKTREE") {
|
|
24875
|
-
|
|
24934
|
+
materializeGitTree2(dirHistory.repoRoot, dirHistory.relativeDir, leftRoot, entry.parentCommit);
|
|
24876
24935
|
materializeWorkingTree(dirHistory.repoRoot, dirHistory.relativeDir, rightRoot);
|
|
24877
24936
|
} else if (entry.commit === "INDEX") {
|
|
24878
|
-
|
|
24879
|
-
|
|
24937
|
+
materializeGitTree2(dirHistory.repoRoot, dirHistory.relativeDir, leftRoot, entry.parentCommit);
|
|
24938
|
+
materializeGitTree2(dirHistory.repoRoot, dirHistory.relativeDir, rightRoot, "INDEX");
|
|
24880
24939
|
} else {
|
|
24881
|
-
|
|
24882
|
-
|
|
24940
|
+
materializeGitTree2(dirHistory.repoRoot, dirHistory.relativeDir, leftRoot, entry.parentCommit);
|
|
24941
|
+
materializeGitTree2(dirHistory.repoRoot, dirHistory.relativeDir, rightRoot, entry.commit);
|
|
24883
24942
|
}
|
|
24884
24943
|
const leftDir = path8.join(leftRoot, dirHistory.relativeDir);
|
|
24885
24944
|
const rightDir = path8.join(rightRoot, dirHistory.relativeDir);
|
|
@@ -27422,12 +27481,6 @@ function parseGitHistoryRecords(logOutput) {
|
|
|
27422
27481
|
};
|
|
27423
27482
|
});
|
|
27424
27483
|
}
|
|
27425
|
-
function readGitBlob(repoRoot, commit, relativePath) {
|
|
27426
|
-
return execFileSync4("git", ["show", `${commit}:${relativePath}`], {
|
|
27427
|
-
cwd: repoRoot,
|
|
27428
|
-
maxBuffer: GIT_MAX_BUFFER_BYTES2
|
|
27429
|
-
});
|
|
27430
|
-
}
|
|
27431
27484
|
function getPathKind(filePath) {
|
|
27432
27485
|
try {
|
|
27433
27486
|
const stats = fs7.statSync(filePath);
|