ics-builder 4.2.1 → 4.2.2
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/package.json
CHANGED
|
@@ -6,8 +6,8 @@ var GitScmProvider = /** @class */ (function () {
|
|
|
6
6
|
function GitScmProvider(options) {
|
|
7
7
|
this.options = options;
|
|
8
8
|
}
|
|
9
|
-
GitScmProvider.prototype.exec = function (cmd, targetDir) {
|
|
10
|
-
return utils_1.Utils.exec("git " + cmd, { silent: true, cwd: targetDir || "" });
|
|
9
|
+
GitScmProvider.prototype.exec = function (cmd, targetDir, skipError) {
|
|
10
|
+
return utils_1.Utils.exec("git " + cmd, { silent: true, cwd: targetDir || "", skipError: skipError });
|
|
11
11
|
};
|
|
12
12
|
GitScmProvider.prototype.clone = function (config) {
|
|
13
13
|
utils_1.Logger.info("Cloning repository " + config.package.name + " in " + config.paths.source + ", please wait...");
|
|
@@ -19,8 +19,11 @@ var GitScmProvider = /** @class */ (function () {
|
|
|
19
19
|
};
|
|
20
20
|
GitScmProvider.prototype.update = function (config, version) {
|
|
21
21
|
var update = this.exec("checkout " + version.branch + " --force", config.paths.source);
|
|
22
|
-
if (!version.isTag)
|
|
23
|
-
this.exec("merge", config.paths.source);
|
|
22
|
+
if (!version.isTag) {
|
|
23
|
+
var result = this.exec("merge", config.paths.source, true);
|
|
24
|
+
if (result.code !== 0)
|
|
25
|
+
throw result.stderr || result.stdout;
|
|
26
|
+
}
|
|
24
27
|
utils_1.Logger.info(config.package.name + " updated to " + version.branch + " (rev. " + version.revision + ")");
|
|
25
28
|
return update;
|
|
26
29
|
};
|
|
@@ -29,16 +29,39 @@ var SourceManager = /** @class */ (function () {
|
|
|
29
29
|
var scmProvider = sourceType === "git" ? new gitScmProvider_1.GitScmProvider(scmOptions) : new hgScmProvider_1.HgScmProvider(scmOptions);
|
|
30
30
|
var version;
|
|
31
31
|
if (!skipLoad) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
try {
|
|
33
|
+
utils_1.Utils.ensurePath(path.join(sourceConfig.paths.source, "." + sourceType.toLowerCase()))
|
|
34
|
+
? scmProvider.pull(sourceConfig)
|
|
35
|
+
: scmProvider.clone(sourceConfig);
|
|
36
|
+
version = this.update(scmProvider, sourceConfig, true);
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
if (e.includes("Merge conflict")) {
|
|
40
|
+
utils_1.Logger.warn("Merge conflict, retrying");
|
|
41
|
+
utils_1.Utils.prepareDir(sourceConfig.paths.source);
|
|
42
|
+
scmProvider.clone(sourceConfig);
|
|
43
|
+
version = this.update(scmProvider, sourceConfig, false);
|
|
44
|
+
}
|
|
45
|
+
else
|
|
46
|
+
throw e;
|
|
47
|
+
}
|
|
37
48
|
}
|
|
38
49
|
else
|
|
39
50
|
version = scmProvider.getVersion(sourceConfig);
|
|
40
51
|
return version;
|
|
41
52
|
};
|
|
53
|
+
SourceManager.prototype.update = function (scmProvider, sourceConfig, throwError) {
|
|
54
|
+
try {
|
|
55
|
+
var version = scmProvider.getVersion(sourceConfig);
|
|
56
|
+
scmProvider.update(sourceConfig, version);
|
|
57
|
+
return version;
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
if (throwError)
|
|
61
|
+
throw e;
|
|
62
|
+
utils_1.Logger.error(e);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
42
65
|
return SourceManager;
|
|
43
66
|
}());
|
|
44
67
|
exports.SourceManager = SourceManager;
|