@gitkraken/core-gitlens 0.15.3 → 0.15.4
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 +28 -1
- package/dist/git/cache.d.ts +24 -11
- package/dist/git/cache.js +44 -16
- package/dist/git/cache.js.map +1 -1
- package/dist/git/models/pullRequest.d.ts +7 -5
- package/dist/git/models/pullRequest.js.map +1 -1
- package/dist/git/models/reference.d.ts +8 -0
- package/dist/git/providers/branches.d.ts +43 -0
- package/dist/git/watching/changeEvent.d.ts +4 -2
- package/dist/git/watching/changeEvent.js +3 -1
- package/dist/git/watching/changeEvent.js.map +1 -1
- package/dist/git/watching/watchGroup.d.ts +3 -3
- package/dist/git/watching/watchGroup.js +1 -0
- package/dist/git/watching/watchGroup.js.map +1 -1
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git/watching/watchSession.d.ts +2 -1
- package/dist/git/watching/watchSession.js +3 -2
- package/dist/git/watching/watchSession.js.map +1 -1
- package/dist/git/watching/watcherPatterns.js +1 -0
- package/dist/git/watching/watcherPatterns.js.map +1 -1
- package/dist/git/watching/worktreeSummary.d.ts +19 -3
- package/dist/git/watching/worktreeSummary.js +107 -17
- package/dist/git/watching/worktreeSummary.js.map +1 -1
- package/dist/git-cli/parsers/refParser.js +2 -1
- package/dist/git-cli/parsers/refParser.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts +8 -1
- package/dist/git-cli/providers/branches.js +84 -12
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts +32 -9
- package/dist/git-cli/providers/config.js +113 -24
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +29 -14
- package/dist/plus/integrations/models/gitHostIntegration.js +41 -19
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.d.ts +16 -16
- package/dist/plus/integrations/providers/azure/azure.js +45 -25
- package/dist/plus/integrations/providers/azure/azure.js.map +1 -1
- package/dist/plus/integrations/providers/azure/azure.utils.d.ts +12 -0
- package/dist/plus/integrations/providers/azure/azure.utils.js +17 -1
- package/dist/plus/integrations/providers/azure/azure.utils.js.map +1 -1
- package/dist/plus/integrations/providers/azure/search.d.ts +4 -0
- package/dist/plus/integrations/providers/azure/search.js +46 -2
- package/dist/plus/integrations/providers/azure/search.js.map +1 -1
- package/dist/plus/integrations/providers/azure/workItemSearch.d.ts +11 -0
- package/dist/plus/integrations/providers/azure/workItemSearch.js +54 -0
- package/dist/plus/integrations/providers/azure/workItemSearch.js.map +1 -0
- package/dist/plus/integrations/providers/azure/workItemStateCategories.d.ts +2 -2
- package/dist/plus/integrations/providers/azure/workItemStateCategories.js +19 -15
- package/dist/plus/integrations/providers/azure/workItemStateCategories.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +33 -20
- package/dist/plus/integrations/providers/azureDevOps.js +109 -48
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +16 -47
- package/dist/plus/integrations/providers/azureDevOpsServer.js +52 -91
- package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts +5 -0
- package/dist/plus/integrations/providers/models.js +14 -3
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/reads/drains.d.ts +2 -2
- package/dist/plus/integrations/reads/drains.js +4 -4
- package/dist/plus/integrations/reads/drains.js.map +1 -1
- package/dist/plus/integrations/reads/issues.js +7 -4
- package/dist/plus/integrations/reads/issues.js.map +1 -1
- package/dist/plus/integrations/reads/resolveRepository.js +5 -5
- package/dist/plus/integrations/reads/resolveRepository.js.map +1 -1
- package/package.json +1 -1
|
@@ -736,6 +736,26 @@ var BranchesGitSubProvider = class {
|
|
|
736
736
|
const branches = new PageableResult((p) => this.getBranches(repoPath, p != null ? { paging: p } : void 0, cancellation));
|
|
737
737
|
return getLocalBranchByUpstream(remoteBranchName, branches);
|
|
738
738
|
}
|
|
739
|
+
async getPushTarget(repoPath, branch, cancellation) {
|
|
740
|
+
const records = await this.provider.refs.getRefs(repoPath, cancellation);
|
|
741
|
+
if (!records.length) return { known: false };
|
|
742
|
+
if (branch == null) {
|
|
743
|
+
const current = await this.getCurrentBranchReference(repoPath, cancellation);
|
|
744
|
+
if (current == null) return { known: false };
|
|
745
|
+
if (current.remote || isDetachedHead(current.name)) return {
|
|
746
|
+
known: true,
|
|
747
|
+
push: void 0,
|
|
748
|
+
upstream: void 0
|
|
749
|
+
};
|
|
750
|
+
branch = current.name;
|
|
751
|
+
}
|
|
752
|
+
const record = findRefRecord(records, branch.startsWith("refs/heads/") ? branch : `refs/heads/${branch}`);
|
|
753
|
+
return {
|
|
754
|
+
known: true,
|
|
755
|
+
push: record?.push ? toPushTargetRef(records, record.push) : void 0,
|
|
756
|
+
upstream: record?.upstream ? toPushTargetRef(records, record.upstream) : void 0
|
|
757
|
+
};
|
|
758
|
+
}
|
|
739
759
|
/** Detects potential conflicts when applying commits onto a target branch (git rebase and cherry-pick) */
|
|
740
760
|
async getPotentialApplyConflicts(repoPath, targetBranch, shas, options, cancellation) {
|
|
741
761
|
if (!shas.length) return { status: "clean" };
|
|
@@ -1006,7 +1026,7 @@ var BranchesGitSubProvider = class {
|
|
|
1006
1026
|
};
|
|
1007
1027
|
if (createdFrom !== "HEAD") {
|
|
1008
1028
|
if (options?.upstream) {
|
|
1009
|
-
const upstream = await this.
|
|
1029
|
+
const upstream = await this.getUpstreamName(repoPath, createdFrom, priorityOpts, cancellation);
|
|
1010
1030
|
if (upstream) return {
|
|
1011
1031
|
branch: upstream,
|
|
1012
1032
|
failed: false
|
|
@@ -1030,7 +1050,7 @@ var BranchesGitSubProvider = class {
|
|
|
1030
1050
|
if (match?.length === 2) {
|
|
1031
1051
|
let name = match[1];
|
|
1032
1052
|
if (options?.upstream) {
|
|
1033
|
-
const upstream = await this.
|
|
1053
|
+
const upstream = await this.getUpstreamName(repoPath, name, priorityOpts, cancellation);
|
|
1034
1054
|
if (upstream) return {
|
|
1035
1055
|
branch: upstream,
|
|
1036
1056
|
failed: false
|
|
@@ -1106,6 +1126,21 @@ var BranchesGitSubProvider = class {
|
|
|
1106
1126
|
if (await this.isSelfRef(repoPath, name, branch, cancellation)) return void 0;
|
|
1107
1127
|
return name;
|
|
1108
1128
|
}
|
|
1129
|
+
getAheadOfBaseConfigKey(repoPath, cancellation) {
|
|
1130
|
+
return this.cache.getAheadOfBaseConfigKey(repoPath, async (commonPath, cacheable, signal) => {
|
|
1131
|
+
const result = await this.git.run({
|
|
1132
|
+
cwd: commonPath,
|
|
1133
|
+
cancellation: signal,
|
|
1134
|
+
expectedExitCodes: [1]
|
|
1135
|
+
}, "config", "--null", "--get-regexp", "^(branch\\..*\\.(remote|merge)|remote\\..*|init\\.defaultbranch)$");
|
|
1136
|
+
if (signal?.aborted) throw new CancellationError();
|
|
1137
|
+
if (result.completion.status !== "exited") {
|
|
1138
|
+
cacheable.invalidate();
|
|
1139
|
+
return;
|
|
1140
|
+
}
|
|
1141
|
+
return result.stdout;
|
|
1142
|
+
}, cancellation);
|
|
1143
|
+
}
|
|
1109
1144
|
async getAheadOfBase(repoPath, branch, options, cancellation) {
|
|
1110
1145
|
if (branch != null && isDetachedHead(branch)) branch = void 0;
|
|
1111
1146
|
const dependsOn = new Set(branch != null ? [`refs/heads/${branch}`] : []);
|
|
@@ -1547,7 +1582,7 @@ var BranchesGitSubProvider = class {
|
|
|
1547
1582
|
if (!candidate || candidate.startsWith("-")) return void 0;
|
|
1548
1583
|
if (candidate === branch || candidate === `refs/heads/${branch}`) return void 0;
|
|
1549
1584
|
addRefDependencies(dependsOn, candidate);
|
|
1550
|
-
const upstreamName = this.
|
|
1585
|
+
const upstreamName = this.getUpstreamName(repoPath, candidate, void 0, cancellation);
|
|
1551
1586
|
const getUpstreamFork = async () => {
|
|
1552
1587
|
const upstream = await upstreamName;
|
|
1553
1588
|
if (!upstream || upstream.startsWith("-")) return void 0;
|
|
@@ -1599,6 +1634,14 @@ var BranchesGitSubProvider = class {
|
|
|
1599
1634
|
} : void 0;
|
|
1600
1635
|
}
|
|
1601
1636
|
/**
|
|
1637
|
+
* `<name>@{u}`, without asking git when the cached ref list shows `name` can't have one: a failed lookup isn't
|
|
1638
|
+
* cached, so asking it of a remote-tracking ref (`origin/main`, the usual default) re-spawns on every read.
|
|
1639
|
+
*/
|
|
1640
|
+
async getUpstreamName(repoPath, name, options, cancellation) {
|
|
1641
|
+
if (!mayHaveUpstream(await this.provider.refs.getRefs(repoPath, cancellation), name)) return void 0;
|
|
1642
|
+
return this.provider.refs.getSymbolicReferenceName(repoPath, `${name}@{u}`, options, cancellation);
|
|
1643
|
+
}
|
|
1644
|
+
/**
|
|
1602
1645
|
* The base for a branch that is itself the default branch, with its tip: its own upstream, `upstream/<branch>`
|
|
1603
1646
|
* when an `upstream` remote has it, else `<branch>@{u}`. Read from the cached ref and branch lists; only a
|
|
1604
1647
|
* `<branch>` that isn't checked out spawns, for its `@{u}`. `undefined` when there is neither, or its ref is gone.
|
|
@@ -1844,16 +1887,18 @@ __decorate([debug()], BranchesGitSubProvider.prototype, "deleteLocalBranch", nul
|
|
|
1844
1887
|
__decorate([debug()], BranchesGitSubProvider.prototype, "deleteRemoteBranch", null);
|
|
1845
1888
|
__decorate([debug()], BranchesGitSubProvider.prototype, "getBranchMergedStatus", null);
|
|
1846
1889
|
__decorate([debug()], BranchesGitSubProvider.prototype, "getLocalBranchByUpstream", null);
|
|
1890
|
+
__decorate([trace({ exit: true })], BranchesGitSubProvider.prototype, "getPushTarget", null);
|
|
1847
1891
|
__decorate([debug()], BranchesGitSubProvider.prototype, "getPotentialApplyConflicts", null);
|
|
1848
1892
|
__decorate([debug()], BranchesGitSubProvider.prototype, "getPotentialMergeConflicts", null);
|
|
1849
1893
|
__decorate([debug()], BranchesGitSubProvider.prototype, "getPotentialStashReapplyConflicts", null);
|
|
1850
1894
|
__decorate([debug({ exit: true })], BranchesGitSubProvider.prototype, "getBaseBranchName", null);
|
|
1895
|
+
__decorate([trace()], BranchesGitSubProvider.prototype, "getAheadOfBaseConfigKey", null);
|
|
1851
1896
|
__decorate([debug({ exit: true })], BranchesGitSubProvider.prototype, "getAheadOfBase", null);
|
|
1852
1897
|
__decorate([debug({ exit: true })], BranchesGitSubProvider.prototype, "getAheadBehindCounts", null);
|
|
1853
1898
|
__decorate([debug({ exit: true })], BranchesGitSubProvider.prototype, "getMergedBranches", null);
|
|
1854
1899
|
__decorate([debug({ exit: true })], BranchesGitSubProvider.prototype, "getStoredMergeTargetBranchName", null);
|
|
1855
|
-
__decorate([
|
|
1856
|
-
__decorate([
|
|
1900
|
+
__decorate([trace({ exit: true })], BranchesGitSubProvider.prototype, "getStoredDetectedMergeTargetBranchName", null);
|
|
1901
|
+
__decorate([trace()], BranchesGitSubProvider.prototype, "getStoredUserMergeTargetBranchName", null);
|
|
1857
1902
|
__decorate([trace()], BranchesGitSubProvider.prototype, "onCurrentBranchAccessed", null);
|
|
1858
1903
|
__decorate([trace()], BranchesGitSubProvider.prototype, "onCurrentBranchModified", null);
|
|
1859
1904
|
__decorate([trace()], BranchesGitSubProvider.prototype, "onCurrentBranchAgentActivity", null);
|
|
@@ -1870,19 +1915,14 @@ function parseSymbolicFullNames(stdout) {
|
|
|
1870
1915
|
upstream: upstream || void 0
|
|
1871
1916
|
};
|
|
1872
1917
|
}
|
|
1873
|
-
/** Each ref list {@link findRefTip} searched, by full name: one base read looks up many names in the same cached list */
|
|
1918
|
+
/** Each ref list {@link findRefTip} and {@link findRefRecord} searched, by full name: one base read looks up many names in the same cached list */
|
|
1874
1919
|
const refRecordsByName = /* @__PURE__ */ new WeakMap();
|
|
1875
1920
|
/**
|
|
1876
1921
|
* The commit `name` resolves to among `records`, tried in git's own order for a short name (`refs/tags/` before
|
|
1877
1922
|
* `refs/heads/` before `refs/remotes/`); annotated tags peel to their commit. `undefined` when no listed ref matches.
|
|
1878
1923
|
*/
|
|
1879
1924
|
function findRefTip(records, name) {
|
|
1880
|
-
|
|
1881
|
-
if (byName == null) {
|
|
1882
|
-
byName = /* @__PURE__ */ new Map();
|
|
1883
|
-
for (const record of records) if (!byName.has(record.name)) byName.set(record.name, record);
|
|
1884
|
-
refRecordsByName.set(records, byName);
|
|
1885
|
-
}
|
|
1925
|
+
const byName = getRefRecordsByName(records);
|
|
1886
1926
|
for (const candidate of [
|
|
1887
1927
|
name,
|
|
1888
1928
|
`refs/${name}`,
|
|
@@ -1895,6 +1935,38 @@ function findRefTip(records, name) {
|
|
|
1895
1935
|
if (record != null) return record.peeledObjectname || record.objectname;
|
|
1896
1936
|
}
|
|
1897
1937
|
}
|
|
1938
|
+
function getRefRecordsByName(records) {
|
|
1939
|
+
let byName = refRecordsByName.get(records);
|
|
1940
|
+
if (byName == null) {
|
|
1941
|
+
byName = /* @__PURE__ */ new Map();
|
|
1942
|
+
for (const record of records) if (!byName.has(record.name)) byName.set(record.name, record);
|
|
1943
|
+
refRecordsByName.set(records, byName);
|
|
1944
|
+
}
|
|
1945
|
+
return byName;
|
|
1946
|
+
}
|
|
1947
|
+
/** The record for the full ref name `fullName` in `records`, the cached ref list; no short-name resolution */
|
|
1948
|
+
function findRefRecord(records, fullName) {
|
|
1949
|
+
return getRefRecordsByName(records).get(fullName);
|
|
1950
|
+
}
|
|
1951
|
+
function toPushTargetRef(records, ref) {
|
|
1952
|
+
const record = findRefRecord(records, ref);
|
|
1953
|
+
return {
|
|
1954
|
+
ref,
|
|
1955
|
+
sha: record != null ? record.peeledObjectname || record.objectname : void 0
|
|
1956
|
+
};
|
|
1957
|
+
}
|
|
1958
|
+
/**
|
|
1959
|
+
* Whether `<name>@{u}` can resolve, judged from `records`, the cached ref list. git follows `@{u}` only from the
|
|
1960
|
+
* upstream configured for a branch of that short name (`branch.<name>.merge`), so a remote-tracking ref, a tag or a
|
|
1961
|
+
* full ref name (`refs/heads/main@{u}` is "no such branch") has none. A name that names a local branch, or no ref at
|
|
1962
|
+
* all (a deleted branch's leftover config still answers), is asked. An empty list is a failed enumeration (see
|
|
1963
|
+
* `getRefTip`), which says nothing either way.
|
|
1964
|
+
*/
|
|
1965
|
+
function mayHaveUpstream(records, name) {
|
|
1966
|
+
if (!records.length || name === "HEAD") return true;
|
|
1967
|
+
if (findRefTip(records, `refs/heads/${name}`) != null) return true;
|
|
1968
|
+
return findRefTip(records, name) == null;
|
|
1969
|
+
}
|
|
1898
1970
|
/**
|
|
1899
1971
|
* Adds the full ref names a `.git/refs` watcher would report for `name`. A short name can't be told tag from local
|
|
1900
1972
|
* from remote without a spawn, so it adds every form, including the tag git resolves it to first; a spurious one
|