airbyte-faros-destination 0.19.56-rc5 → 0.19.56-rc7
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.
|
@@ -4,7 +4,6 @@ import { AzureTfvcConverter } from './common';
|
|
|
4
4
|
export declare class Changesets extends AzureTfvcConverter {
|
|
5
5
|
private readonly branchCollector;
|
|
6
6
|
private readonly fileCollector;
|
|
7
|
-
private readonly mergeChainTracker;
|
|
8
7
|
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
9
8
|
id(record: AirbyteRecord): number;
|
|
10
9
|
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
@@ -5,69 +5,11 @@ const azure_devops_1 = require("faros-airbyte-common/azure-devops");
|
|
|
5
5
|
const faros_js_client_1 = require("faros-js-client");
|
|
6
6
|
const vcs_1 = require("../common/vcs");
|
|
7
7
|
const common_1 = require("./common");
|
|
8
|
-
/**
|
|
9
|
-
* Tracks merge chains to compute transitive branch associations.
|
|
10
|
-
* When a changeset is merged from branch A to B, all changesets on A
|
|
11
|
-
* are transitively associated with B.
|
|
12
|
-
*/
|
|
13
|
-
class MergeChainTracker {
|
|
14
|
-
constructor() {
|
|
15
|
-
// Maps changeset ID to the branch it was originally committed to
|
|
16
|
-
this.changesetBranch = new Map();
|
|
17
|
-
// Maps branch path to all changesets on that branch (including transitive)
|
|
18
|
-
this.branchChangesets = new Map();
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Track a changeset and return only NEW associations for this branch.
|
|
22
|
-
*/
|
|
23
|
-
trackAndGetNewChangesets(changesetId, branch, mergedChangesetIds) {
|
|
24
|
-
this.changesetBranch.set(changesetId, branch);
|
|
25
|
-
const branchChangesets = this.getOrCreateBranchSet(branch);
|
|
26
|
-
const newAssociations = new Set();
|
|
27
|
-
this.addIfNew(changesetId, branchChangesets, newAssociations);
|
|
28
|
-
this.processMergedChangesets(mergedChangesetIds, branchChangesets, newAssociations);
|
|
29
|
-
return newAssociations;
|
|
30
|
-
}
|
|
31
|
-
getOrCreateBranchSet(branch) {
|
|
32
|
-
if (!this.branchChangesets.has(branch)) {
|
|
33
|
-
this.branchChangesets.set(branch, new Set());
|
|
34
|
-
}
|
|
35
|
-
return this.branchChangesets.get(branch);
|
|
36
|
-
}
|
|
37
|
-
addIfNew(id, branchChangesets, newAssociations) {
|
|
38
|
-
if (!branchChangesets.has(id)) {
|
|
39
|
-
newAssociations.add(id);
|
|
40
|
-
branchChangesets.add(id);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
processMergedChangesets(mergedChangesetIds, branchChangesets, newAssociations) {
|
|
44
|
-
for (const mergedId of mergedChangesetIds) {
|
|
45
|
-
const mergedIdStr = String(mergedId);
|
|
46
|
-
const sourceChangesets = this.getSourceBranchChangesets(mergedIdStr);
|
|
47
|
-
if (sourceChangesets) {
|
|
48
|
-
for (const cs of sourceChangesets) {
|
|
49
|
-
this.addIfNew(cs, branchChangesets, newAssociations);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
this.addIfNew(mergedIdStr, branchChangesets, newAssociations);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
getSourceBranchChangesets(mergedIdStr) {
|
|
58
|
-
const sourceBranch = this.changesetBranch.get(mergedIdStr);
|
|
59
|
-
if (sourceBranch && this.branchChangesets.has(sourceBranch)) {
|
|
60
|
-
return this.branchChangesets.get(sourceBranch);
|
|
61
|
-
}
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
8
|
class Changesets extends common_1.AzureTfvcConverter {
|
|
66
9
|
constructor() {
|
|
67
10
|
super(...arguments);
|
|
68
11
|
this.branchCollector = new vcs_1.BranchCollector();
|
|
69
12
|
this.fileCollector = new vcs_1.FileCollector();
|
|
70
|
-
this.mergeChainTracker = new MergeChainTracker();
|
|
71
13
|
this.destinationModels = [
|
|
72
14
|
'tms_TaskCommitAssociation',
|
|
73
15
|
'vcs_Branch',
|
|
@@ -175,15 +117,17 @@ class Changesets extends common_1.AzureTfvcConverter {
|
|
|
175
117
|
if (!branch) {
|
|
176
118
|
return [];
|
|
177
119
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
120
|
+
const records = [
|
|
121
|
+
{
|
|
122
|
+
model: 'vcs_BranchCommitAssociation',
|
|
123
|
+
record: { commit, branch, committedAt },
|
|
124
|
+
},
|
|
125
|
+
];
|
|
126
|
+
for (const mergedId of mergedChangesetIds) {
|
|
183
127
|
records.push({
|
|
184
128
|
model: 'vcs_BranchCommitAssociation',
|
|
185
129
|
record: {
|
|
186
|
-
commit: { sha:
|
|
130
|
+
commit: { sha: String(mergedId), repository },
|
|
187
131
|
branch,
|
|
188
132
|
committedAt,
|
|
189
133
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changesets.js","sourceRoot":"","sources":["../../../src/converters/azure-tfvc/changesets.ts"],"names":[],"mappings":";;;AACA,oEAA+E;AAE/E,qDAAsC;AAEtC,uCAOuB;AAEvB,qCAAoE;AAOpE
|
|
1
|
+
{"version":3,"file":"changesets.js","sourceRoot":"","sources":["../../../src/converters/azure-tfvc/changesets.ts"],"names":[],"mappings":";;;AACA,oEAA+E;AAE/E,qDAAsC;AAEtC,uCAOuB;AAEvB,qCAAoE;AAOpE,MAAa,UAAW,SAAQ,2BAAkB;IAAlD;;QACmB,oBAAe,GAAG,IAAI,qBAAe,EAAE,CAAC;QACxC,kBAAa,GAAG,IAAI,mBAAa,EAAE,CAAC;QAE5C,sBAAiB,GAAoC;YAC5D,2BAA2B;YAC3B,YAAY;YACZ,6BAA6B;YAC7B,YAAY;YACZ,gBAAgB;YAChB,UAAU;SACX,CAAC;IA8LJ,CAAC;IA5LC,EAAE,CAAC,MAAqB;;QACtB,OAAO,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,C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