Skip to content

Commit 8bafd95

Browse files
authored
Merge pull request #96 from yodamad/dev
🍸 Release 1.19.0
2 parents 49171d7 + 09f04e8 commit 8bafd95

File tree

10 files changed

+118
-28
lines changed

10 files changed

+118
-28
lines changed

.gitlab-ci.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
stages:
2+
- 🚧 build
3+
- 🗣 publish
4+
5+
# Custom steps
6+
🛠 build-application:
7+
stage: 🚧 build
8+
image: jhipster/jhipster
9+
before_script:
10+
- export MAVEN_USER_HOME=`pwd`/.maven
11+
- ./mvnw com.github.eirslett:frontend-maven-plugin:install-node-and-npm -DnodeVersion=v14.3.0 -DnpmVersion=6.13.7
12+
- ./mvnw com.github.eirslett:frontend-maven-plugin:install-node-and-yarn -DnodeVersion=v14.3.0 -DyarnVersion=v1.10.1
13+
script:
14+
- ./mvnw clean package -DskipTests -Pprod
15+
artifacts:
16+
paths:
17+
- target
18+
expire_in: 1 week
19+
20+
🐳 build-image:
21+
stage: 🗣 publish
22+
image:
23+
name: gcr.io/kaniko-project/executor:debug-v0.18.0
24+
entrypoint: [""]
25+
dependencies:
26+
- 🛠 build-application
27+
script:
28+
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
29+
- /kaniko/executor --context="$CI_PROJECT_DIR" --dockerfile="$CI_PROJECT_DIR/Dockerfile" --destination="$CI_REGISTRY_IMAGE:$BUILD_VERSION"
30+
only:
31+
- internal_master
32+
- master
33+
- dev
34+
except:
35+
- schedules

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"file-loader": "3.0.1",
5858
"fork-ts-checker-webpack-plugin": "0.5.2",
5959
"friendly-errors-webpack-plugin": "1.7.0",
60-
"generator-jhipster": "5.4.2",
60+
"generator-jhipster": "6.7.1",
6161
"html-loader": "0.5.5",
6262
"html-webpack-plugin": "3.2.0",
6363
"husky": "1.3.1",
@@ -128,7 +128,7 @@
128128
"webpack:prod": "npm run cleanup && npm run webpack:prod:main && npm run clean-www",
129129
"webpack:test": "npm run test",
130130
"webpack-dev-server": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js",
131-
"webpack": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js"
131+
"webpack": "node --max_old_space_size=5120 node_modules/webpack/bin/webpack.js"
132132
},
133133
"jestSonar": {
134134
"reportPath": "target/test-results/jest",

pom.xml

+25-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>fr.yodamad.svn2git</groupId>
66
<artifactId>svn-2-git</artifactId>
7-
<version>1.18.2</version>
7+
<version>1.19.0</version>
88
<packaging>jar</packaging>
99
<name>Svn 2 GitLab</name>
1010

@@ -23,7 +23,7 @@
2323
<maven.version>3.0.0</maven.version>
2424
<java.version>1.8</java.version>
2525
<scala.version>2.12.6</scala.version>
26-
<node.version>v8.16.2</node.version>
26+
<node.version>v14.3.0</node.version>
2727
<yarn.version>v1.10.1</yarn.version>
2828
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2929
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
@@ -66,7 +66,7 @@
6666
<maven-surefire-plugin.version>2.22.0</maven-surefire-plugin.version>
6767
<maven-war-plugin.version>3.2.2</maven-war-plugin.version>
6868
<jib-maven-plugin.version>1.8.0</jib-maven-plugin.version>
69-
<frontend-maven-plugin.version>1.8.0</frontend-maven-plugin.version>
69+
<frontend-maven-plugin.version>1.10.0</frontend-maven-plugin.version>
7070
<jacoco-maven-plugin.version>0.8.2</jacoco-maven-plugin.version>
7171
<scala-maven-plugin.version>3.4.2</scala-maven-plugin.version>
7272
<sonar-maven-plugin.version>3.5.0.1254</sonar-maven-plugin.version>
@@ -766,6 +766,17 @@
766766
<artifactId>frontend-maven-plugin</artifactId>
767767
<version>${frontend-maven-plugin.version}</version>
768768
<executions>
769+
<execution>
770+
<id>install node and npm</id>
771+
<goals>
772+
<goal>install-node-and-npm</goal>
773+
</goals>
774+
<configuration>
775+
<nodeVersion>${node.version}</nodeVersion>
776+
<npmVersion>6.13.7</npmVersion>
777+
</configuration>
778+
<phase>generate-resources</phase>
779+
</execution>
769780
<execution>
770781
<id>install node and yarn</id>
771782
<goals>
@@ -949,6 +960,17 @@
949960
<artifactId>frontend-maven-plugin</artifactId>
950961
<version>${frontend-maven-plugin.version}</version>
951962
<executions>
963+
<execution>
964+
<id>install node and npm</id>
965+
<goals>
966+
<goal>install-node-and-npm</goal>
967+
</goals>
968+
<configuration>
969+
<nodeVersion>${node.version}</nodeVersion>
970+
<npmVersion>6.13.7</npmVersion>
971+
</configuration>
972+
<phase>generate-resources</phase>
973+
</execution>
952974
<execution>
953975
<id>install node and yarn</id>
954976
<goals>

src/main/java/fr/yodamad/svn2git/service/Cleaner.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,12 @@ public CleanedFilesManager listCleanedFiles(WorkUnit workUnit) throws IOExceptio
166166
AtomicBoolean warnings = new AtomicBoolean(false);
167167

168168
if (!isEmpty(workUnit.migration.getTrunk())) {
169-
CleanedFiles cleanedFilesTrunk = listCleanedFilesInSvnLocation(workUnit, "trunk", SvnLayout.TRUNK);
170-
cleanedFilesMap.put("trunk", cleanedFilesTrunk);
169+
CleanedFiles cleanedFilesTrunk = listCleanedFilesInSvnLocation(workUnit, workUnit.migration.getTrunk(), SvnLayout.TRUNK);
170+
cleanedFilesMap.put(workUnit.migration.getTrunk(), cleanedFilesTrunk);
171171
}
172172

173173
List<String> remotes = listRemotes(workUnit.directory);
174-
listBranchesOnly(remotes).forEach(
174+
listBranchesOnly(remotes, workUnit.migration.getTrunk()).forEach(
175175
b -> {
176176
try {
177177
// get branchName
@@ -530,14 +530,14 @@ Pair<AtomicBoolean, List<String>> cleanRemovedElements(WorkUnit workUnit, boolea
530530
.map(l -> l.trim().replace("origin/", ""))
531531
.filter(t -> t.startsWith("tags"))
532532
.map(l -> l.replace(TAGS, ""))
533-
.filter(l -> !l.equalsIgnoreCase("trunk"))
533+
.filter(l -> !l.equalsIgnoreCase(workUnit.migration.getTrunk()))
534534
.collect(Collectors.toList());
535535
} else {
536536
gitElementsToDelete = Files.readAllLines(Paths.get(workUnit.directory, GIT_LIST))
537537
.stream()
538538
.map(l -> l.trim().replace("origin/", ""))
539539
.filter(l -> !l.startsWith(TAGS))
540-
.filter(l -> !l.equalsIgnoreCase("trunk"))
540+
.filter(l -> !l.equalsIgnoreCase(workUnit.migration.getTrunk()))
541541
.collect(Collectors.toList());
542542
}
543543

src/main/java/fr/yodamad/svn2git/service/GitManager.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ private static String generateIgnorePaths(String trunk, String tags, String bran
205205

206206
if (trunk != null) {
207207
sb.append(svnProject.replaceFirst("/", "/?"))
208-
.append("/trunk/");
208+
.append(format("/%s/", trunk));
209209

210210
if (tags != null || branches != null) {
211211
sb.append("|");
@@ -289,14 +289,14 @@ static List<String> listRemotes(String directory) throws InterruptedException, I
289289
* @param remotes Remote list
290290
* @return list containing only branches
291291
*/
292-
static List<String> listBranchesOnly(List<String> remotes) {
292+
static List<String> listBranchesOnly(List<String> remotes, String trunk) {
293293
return remotes.stream()
294294
.map(String::trim)
295295
// Remove tags
296296
.filter(b -> !b.startsWith(ORIGIN_TAGS))
297297
// Remove master/trunk
298298
.filter(b -> !b.contains(MASTER))
299-
.filter(b -> !b.contains("trunk"))
299+
.filter(b -> !b.contains(trunk))
300300
.filter(b -> !b.contains("@"))
301301
.collect(Collectors.toList());
302302
}
@@ -496,7 +496,7 @@ private String initCommand(WorkUnit workUnit, String username, String secret) {
496496
String sCommand = format("%s git svn clone %s %s %s %s %s %s %s %s%s",
497497
StringUtils.isEmpty(secret) ? "" : isWindows ? format("echo(%s|", secret) : format("echo %s |", secret),
498498
StringUtils.isEmpty(username) ? "" : format("--username %s", username),
499-
workUnit.migration.getTrunk() == null ? "" : format("--trunk=%s/trunk", workUnit.migration.getSvnProject()),
499+
(workUnit.migration.getTrunk() == null || !workUnit.migration.getTrunk().equals("trunk")) ? "" : format("--trunk=%s/trunk", workUnit.migration.getSvnProject()),
500500
workUnit.migration.getBranches() == null ? "" : format("--branches=%s/branches", workUnit.migration.getSvnProject()),
501501
workUnit.migration.getTags() == null ? "" : format("--tags=%s/tags", workUnit.migration.getSvnProject()),
502502
StringUtils.isEmpty(ignorePaths) ? "" : ignorePaths,
@@ -761,7 +761,7 @@ private StatusEnum mv(WorkUnit workUnit, String svnDir, String gitDir, String br
761761
* @param remotes
762762
*/
763763
void manageBranches(WorkUnit workUnit, List<String> remotes) {
764-
listBranchesOnly(remotes).forEach(b -> {
764+
listBranchesOnly(remotes, workUnit.migration.getTrunk()).forEach(b -> {
765765
final boolean warn = pushBranch(workUnit, b);
766766
workUnit.warnings.set(workUnit.warnings.get() || warn);
767767

src/main/java/fr/yodamad/svn2git/service/MigrationManager.java

+14-5
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,23 @@ public void startMigration(final long migrationId, final boolean retry) {
220220
}
221221

222222
// 4. Git push master based on SVN trunk
223-
if (migration.getTrunk() != null && migration.getTrunk().equals("*")) {
224-
history = historyMgr.startStep(migration, StepEnum.GIT_PUSH, "SVN trunk -> GitLab master");
223+
if (migration.getTrunk() != null) {
224+
history = historyMgr.startStep(migration, StepEnum.GIT_PUSH, format("SVN %s -> GitLab master", migration.getTrunk()));
225225

226226
// Set origin
227227
execCommand(commandManager, workUnit.directory,
228228
gitManager.buildRemoteCommand(workUnit, svn, false),
229229
gitManager.buildRemoteCommand(workUnit, svn, true));
230230

231+
if (!migration.getTrunk().equals("trunk")) {
232+
gitCommand = format("git checkout -b %s %s", migration.getTrunk(), "refs/remotes/origin/" + migration.getTrunk());
233+
execCommand(workUnit.commandManager, workUnit.directory, gitCommand);
234+
gitCommand = format("git branch -D master");
235+
execCommand(workUnit.commandManager, workUnit.directory, gitCommand);
236+
gitCommand = format("git branch -m master");
237+
execCommand(workUnit.commandManager, workUnit.directory, gitCommand);
238+
}
239+
231240
// if no history option set
232241
if (migration.getSvnHistory().equals("nothing")) {
233242
gitManager.removeHistory(workUnit, MASTER, false, history);
@@ -246,8 +255,8 @@ public void startMigration(final long migrationId, final boolean retry) {
246255
boolean warning = gitManager.applyMapping(workUnit, MASTER);
247256
workUnit.warnings.set(workUnit.warnings.get() || warning);
248257
} else {
249-
history = historyMgr.startStep(migration, StepEnum.GIT_PUSH, "Trunk");
250-
historyMgr.endStep(history, StatusEnum.IGNORED, "Skip trunk");
258+
history = historyMgr.startStep(migration, StepEnum.GIT_PUSH, migration.getTrunk());
259+
historyMgr.endStep(history, StatusEnum.IGNORED, format("Skip %s", migration.getTrunk()));
251260
}
252261

253262
// 6. List branches & tags
@@ -308,7 +317,7 @@ public void startMigration(final long migrationId, final boolean retry) {
308317
}
309318

310319
} else {
311-
history = historyMgr.startStep(migration, StepEnum.GIT_PUSH, "Trunk, Tags, Branches");
320+
history = historyMgr.startStep(migration, StepEnum.GIT_PUSH, format("%s, Tags, Branches", migration.getTrunk()));
312321
historyMgr.endStep(history, StatusEnum.IGNORED, "Skipping Migration : No Files Available. No Push to Gitlab");
313322
}
314323

src/main/webapp/app/migration/migration-stepper.component.html

+7
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
<td mat-cell *matCellDef="let directory" style="width: 70px">
144144
<mat-checkbox (click)="$event.stopPropagation()"
145145
(change)="$event ? historyToggle(directory) : null"
146+
[disabled]="noTrunk() && directory === 'trunk'"
146147
[checked]="historyChecked(directory)">
147148
</mat-checkbox>
148149
</td>
@@ -174,6 +175,12 @@
174175
<input matInput placeholder="{{'migration-process.history.tags-to-migrate-placeholder' | translate}}" formControlName="tagsToMigrate">
175176
</mat-form-field>
176177
</li>
178+
<li>
179+
<mat-form-field *ngIf="true" class="tagsbranches-to-migrate">
180+
<span class="fa-li"><fa-icon [icon]="'check-double'"></fa-icon></span>
181+
<input matInput placeholder="{{'migration-process.history.branch-for-master' | translate}}" formControlName="branchForMaster">
182+
</mat-form-field>
183+
</li>
177184
</form>
178185
</ul>
179186
<mat-divider style="margin-bottom: 10px"></mat-divider>

src/main/webapp/app/migration/migration-stepper.component.ts

+23-8
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ export class MigrationStepperComponent implements OnInit {
158158

159159
this.historyFormGroup = this._formBuilder.group({
160160
branchesToMigrate: [''],
161-
tagsToMigrate: ['']
161+
tagsToMigrate: [''],
162+
branchForMaster: ['']
162163
});
163164
this.historySelection = new SelectionModel<string>(this.allowMultiSelect, ['trunk']);
164165

@@ -409,7 +410,7 @@ export class MigrationStepperComponent implements OnInit {
409410
if (this.historySelection !== undefined && !this.historySelection.isEmpty()) {
410411
this.historySelection.selected.forEach(hst => {
411412
if (hst === 'trunk') {
412-
this.mig.trunk = '*';
413+
this.mig.trunk = 'trunk';
413414
} else if (hst === 'branches') {
414415
this.mig.branches = '*';
415416
} else if (hst === 'tags') {
@@ -437,6 +438,14 @@ export class MigrationStepperComponent implements OnInit {
437438
}
438439
this.mig.svnHistory = this.historyOption;
439440

441+
// Branch for master
442+
if (
443+
this.historyFormGroup.controls['branchForMaster'] !== undefined &&
444+
this.historyFormGroup.controls['branchForMaster'].value !== ''
445+
) {
446+
this.mig.trunk = this.historyFormGroup.controls['branchForMaster'].value;
447+
}
448+
440449
// Mappings
441450
// Note : selectionSvnDirectoryDelete can be empty
442451
if (this.selectionMapping !== undefined && !this.selectionMapping.isEmpty() && this.selectionSvnDirectoryDelete !== undefined) {
@@ -455,14 +464,10 @@ export class MigrationStepperComponent implements OnInit {
455464
// this.mig.mappings = this.selectionMapping.selected
456465
// .filter(mapping => mapping.gitDirectory !== undefined);
457466
this.mig.mappings = this.mappings.filter(row => {
458-
if (
467+
return (
459468
(this.isRealMappingRow(row) && this.selectionMapping.isSelected(row)) ||
460469
this.selectionSvnDirectoryDelete.isSelected(row)
461-
) {
462-
return true;
463-
} else {
464-
return false;
465-
}
470+
);
466471
});
467472
}
468473

@@ -879,6 +884,9 @@ export class MigrationStepperComponent implements OnInit {
879884
* @param directory
880885
*/
881886
historyChecked(directory: string) {
887+
if (directory === 'trunk') {
888+
return this.historySelection.isSelected(directory) && !this.noTrunk();
889+
}
882890
return this.historySelection.isSelected(directory);
883891
}
884892

@@ -927,4 +935,11 @@ export class MigrationStepperComponent implements OnInit {
927935
return false;
928936
}
929937
}
938+
939+
noTrunk() {
940+
return (
941+
this.historyFormGroup.controls['branchForMaster'] !== undefined &&
942+
this.historyFormGroup.controls['branchForMaster'].value !== ''
943+
);
944+
}
930945
}

src/main/webapp/i18n/en/migrationProcess.json

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"no" : "Nothing",
4747
"option" : "History option",
4848
"options" : "History options",
49+
"branch-for-master": "Branch to use for master if not trunk",
4950
"tags-to-migrate" : "Tags To Keep",
5051
"branches-to-migrate" : "Branches To Keep",
5152
"tags-to-migrate-placeholder" : "Tags To Keep (Comma Separated)",

src/main/webapp/i18n/fr/migrationProcess.json

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"no" : "Rien",
4747
"option" : "Choix de conservation de l'historique",
4848
"options" : "Options d'historique",
49+
"branch-for-master": "Branche à utiliser comme master si différente de trunk",
4950
"tags-to-migrate" : "Tags à garder",
5051
"branches-to-migrate" : "Branches à garder",
5152
"tags-to-migrate-placeholder" : "Tags à garder (Séparées par des virgules)",

0 commit comments

Comments
 (0)