Skip to content

Commit 7e05f7c

Browse files
committed
update
1 parent 1169d25 commit 7e05f7c

6 files changed

Lines changed: 101 additions & 3 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.test.codediff.exceptions;
2+
3+
4+
public class GitException extends Exception{
5+
6+
public GitException(){};
7+
public GitException(String msg){
8+
super(msg);
9+
}
10+
11+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.test.codediff.internal;
2+
3+
import com.test.codediff.entity.RepotInfo;
4+
import com.test.codediff.exceptions.GitException;
5+
import lombok.Builder;
6+
import lombok.Data;
7+
import lombok.extern.slf4j.Slf4j;
8+
import org.eclipse.jgit.api.Git;
9+
import org.eclipse.jgit.api.errors.GitAPIException;
10+
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
11+
12+
import java.io.File;
13+
14+
@Slf4j
15+
@Data
16+
@Builder
17+
public class GitRepository extends Repository{
18+
19+
public GitRepository(RepotInfo repotInfo){super(repotInfo);};
20+
21+
22+
@Override
23+
public void clone(String url, String project_local_path, String branch) throws GitException {
24+
try {
25+
Git.cloneRepository()
26+
.setURI(url)
27+
.setCredentialsProvider(new UsernamePasswordCredentialsProvider(super.getRepotInfo().getUserName(),
28+
super.getRepotInfo().getPasswd()))
29+
.setBranch(branch)
30+
.setDirectory(new File(project_local_path))
31+
.call();
32+
} catch (GitAPIException e) {
33+
log.error("clone project:{} is failed", url);
34+
e.printStackTrace();
35+
throw new GitException("clone is failed");
36+
}
37+
log.info("clone success: {}", url);
38+
}
39+
40+
@Override
41+
public void pull(String local_git_path, String branch) {
42+
43+
}
44+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.test.codediff.internal;
2+
3+
import com.test.codediff.entity.RepotInfo;
4+
import com.test.codediff.exceptions.GitException;
5+
import lombok.Data;
6+
7+
@Data
8+
abstract class Repository{
9+
10+
private RepotInfo repotInfo;
11+
12+
Repository(RepotInfo repotInfo){
13+
this.repotInfo = repotInfo;
14+
}
15+
16+
public abstract void clone(String url, String project_local_path, String branch) throws GitException;
17+
18+
public abstract void pull(String local_git_path, String branch);
19+
20+
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.test.codediff.internal;
2+
3+
import com.test.codediff.entity.RepotInfo;
4+
import com.test.codediff.exceptions.GitException;
5+
6+
public class SvnRepository extends Repository{
7+
8+
SvnRepository(RepotInfo repotInfo) {
9+
super(repotInfo);
10+
}
11+
12+
@Override
13+
public void clone(String url, String project_local_path, String branch) throws GitException {
14+
15+
}
16+
17+
@Override
18+
public void pull(String local_git_path, String branch) {
19+
20+
}
21+
}

src/main/java/com/test/codediff/vo/ClassInfoDiff.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
import lombok.Getter;
77
import lombok.Setter;
88

9+
import java.io.Serializable;
910
import java.util.List;
1011

1112
@Getter
1213
@Setter
1314
@Builder
14-
public class ClassInfoDiff {
15+
public class ClassInfoDiff implements Serializable {
1516

1617
private String className;
1718
private DiffTypeEnum diffType;
@@ -20,7 +21,7 @@ public class ClassInfoDiff {
2021
}
2122

2223
@Data
23-
class MethodInfoDiff {
24+
class MethodInfoDiff implements Serializable {
2425

2526
private String methodName;
2627
private DiffTypeEnum diffType;

src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ server.port=1990
33

44
spring.datasource.url=jdbc:mysql://192.168.100.158:3306/test_platform?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=false
55
spring.datasource.name=root
6-
spring.datasource.password=Rl123456
6+
spring.datasource.password=123456
77
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
88

99

0 commit comments

Comments
 (0)