mirror of
https://github.com/gitpitch/gitpitch.git
synced 2024-04-18 07:30:55 +08:00
Added support for compounded [pre/post] branch names.
This commit is contained in:
parent
7a294929b0
commit
3593f5e3a0
|
@ -39,6 +39,7 @@ public class GRS {
|
|||
private final String apiToken;
|
||||
private final String apiTokenHeader;
|
||||
private final String rawBase;
|
||||
private final String branchDelim;
|
||||
private final boolean isDefault;
|
||||
|
||||
private GRS(String name,
|
||||
|
@ -48,6 +49,7 @@ public class GRS {
|
|||
String apiToken,
|
||||
String apiTokenHeader,
|
||||
String rawBase,
|
||||
String branchDelim,
|
||||
boolean isDefault) {
|
||||
|
||||
this.name = name;
|
||||
|
@ -57,6 +59,7 @@ public class GRS {
|
|||
this.apiToken = apiToken;
|
||||
this.apiTokenHeader = apiTokenHeader;
|
||||
this.rawBase = rawBase;
|
||||
this.branchDelim = branchDelim;
|
||||
this.isDefault = isDefault;
|
||||
}
|
||||
|
||||
|
@ -69,12 +72,13 @@ public class GRS {
|
|||
String apiToken = grsCfg.get("apitoken");
|
||||
String apiTokenHeader = grsCfg.get("apitokenheader");
|
||||
String rawBase = grsCfg.get("rawbase");
|
||||
String branchDelim = grsCfg.get("branchdelim");
|
||||
boolean isDefault = Boolean.parseBoolean(grsCfg.get("default"));
|
||||
|
||||
if(name != null && type != null && site != null &&
|
||||
apiBase != null && rawBase != null) {
|
||||
return new GRS(name, type, site, apiBase, apiToken,
|
||||
apiTokenHeader, rawBase, isDefault);
|
||||
apiTokenHeader, rawBase, branchDelim, isDefault);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -87,6 +91,13 @@ public class GRS {
|
|||
public String getApiToken() { return apiToken; }
|
||||
public String getApiTokenHeader() { return apiTokenHeader; }
|
||||
public String getRawBase() { return rawBase; }
|
||||
public String compoundBranch(String branch) {
|
||||
if(branch != null && branchDelim != null) {
|
||||
return branch.replaceAll(branchDelim, COMPOUNDED_BRANCH);
|
||||
} else {
|
||||
return branch;
|
||||
}
|
||||
}
|
||||
public boolean isDefault() { return isDefault; }
|
||||
|
||||
public Map<String,String> getHeaders() {
|
||||
|
@ -101,4 +112,6 @@ public class GRS {
|
|||
return "GRS[ " + name + " ][ " + type + " ]";
|
||||
}
|
||||
|
||||
private static final String COMPOUNDED_BRANCH = "/";
|
||||
|
||||
}
|
||||
|
|
2
app/com/gitpitch/git/vendors/BitBucket.java
vendored
2
app/com/gitpitch/git/vendors/BitBucket.java
vendored
|
@ -55,7 +55,7 @@ public class BitBucket extends GRSService {
|
|||
.append(SLASH)
|
||||
.append(pp.repo)
|
||||
.append(BITBUCKET_RAW)
|
||||
.append(pp.branch)
|
||||
.append(grs.compoundBranch(pp.branch))
|
||||
.append(SLASH)
|
||||
.toString();
|
||||
}
|
||||
|
|
2
app/com/gitpitch/git/vendors/GitBucket.java
vendored
2
app/com/gitpitch/git/vendors/GitBucket.java
vendored
|
@ -49,7 +49,7 @@ public class GitBucket extends GitHub {
|
|||
.append(pp.repo)
|
||||
.append(SLASH)
|
||||
.append(GITBUCKET_RAW_API)
|
||||
.append(pp.branch)
|
||||
.append(grs.compoundBranch(pp.branch))
|
||||
.append(SLASH)
|
||||
.toString();
|
||||
}
|
||||
|
|
2
app/com/gitpitch/git/vendors/GitHub.java
vendored
2
app/com/gitpitch/git/vendors/GitHub.java
vendored
|
@ -55,7 +55,7 @@ public class GitHub extends GRSService {
|
|||
.append(SLASH)
|
||||
.append(pp.repo)
|
||||
.append(SLASH)
|
||||
.append(pp.branch)
|
||||
.append(grs.compoundBranch(pp.branch))
|
||||
.append(SLASH)
|
||||
.toString();
|
||||
}
|
||||
|
|
2
app/com/gitpitch/git/vendors/GitLab.java
vendored
2
app/com/gitpitch/git/vendors/GitLab.java
vendored
|
@ -55,7 +55,7 @@ public class GitLab extends GRSService {
|
|||
.append(SLASH)
|
||||
.append(pp.repo)
|
||||
.append(GITLAB_RAW)
|
||||
.append(pp.branch)
|
||||
.append(grs.compoundBranch(pp.branch))
|
||||
.append(SLASH)
|
||||
.toString();
|
||||
}
|
||||
|
|
2
app/com/gitpitch/git/vendors/Gitea.java
vendored
2
app/com/gitpitch/git/vendors/Gitea.java
vendored
|
@ -55,7 +55,7 @@ public class Gitea extends GRSService {
|
|||
.append(SLASH)
|
||||
.append(pp.repo)
|
||||
.append(GITEA_RAW)
|
||||
.append(pp.branch)
|
||||
.append(grs.compoundBranch(pp.branch))
|
||||
.append(SLASH)
|
||||
.toString();
|
||||
}
|
||||
|
|
2
app/com/gitpitch/git/vendors/Gogs.java
vendored
2
app/com/gitpitch/git/vendors/Gogs.java
vendored
|
@ -55,7 +55,7 @@ public class Gogs extends GRSService {
|
|||
.append(SLASH)
|
||||
.append(pp.repo)
|
||||
.append(GOGS_RAW)
|
||||
.append(pp.branch)
|
||||
.append(grs.compoundBranch(pp.branch))
|
||||
.append(SLASH)
|
||||
.toString();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user