mirror of
https://bitbucket.org/projectswg/lightspeed.git
synced 2026-01-16 23:04:40 -05:00
Added rebase option to config
This commit is contained in:
@@ -61,12 +61,12 @@ public class GitInterface {
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean pullLastUpdate(String repository) throws IOException {
|
||||
public boolean pullLastUpdate(String repository, boolean rebase) throws IOException {
|
||||
try (Git git = new Git(FileRepositoryBuilder.create(new File(repository, ".git")))) {
|
||||
PullResult res = git.pull()
|
||||
.setRemote("origin")
|
||||
.setRemoteBranchName("quality_assurance")
|
||||
.setRebase(false)
|
||||
.setRebase(rebase)
|
||||
.setProgressMonitor(new CustomProgressMonitor()).call();
|
||||
return res.isSuccessful();
|
||||
} catch (GitAPIException e) {
|
||||
|
||||
@@ -38,6 +38,7 @@ import me.joshlarson.json.JSONObject;
|
||||
import com.projectswg.common.concurrency.PswgBasicScheduledThread;
|
||||
import com.projectswg.common.control.LightspeedService;
|
||||
import com.projectswg.common.debug.Log;
|
||||
import com.projectswg.common.info.ConfigFile;
|
||||
import com.projectswg.common.intents.PrepareStarshipIntent;
|
||||
import com.projectswg.common.intents.RegisterHttpListenerIntent;
|
||||
import com.projectswg.common.network.packets.PacketType;
|
||||
@@ -86,10 +87,12 @@ public class ServerService extends LightspeedService {
|
||||
for (ServerServerData server : servers) {
|
||||
try {
|
||||
String commit = git.getLastCommit(server.getDirectory());
|
||||
if (commit.isEmpty())
|
||||
commit = "?";
|
||||
String lastCommit = server.getLastCommit();
|
||||
server.setLastCommit(commit);
|
||||
if (!lastCommit.equals(commit) && !lastCommit.equalsIgnoreCase("?")) {
|
||||
if (!git.pullLastUpdate(server.getDirectory())) {
|
||||
if (!lastCommit.equals(commit) && !lastCommit.equals("?") && !commit.equals("?")) {
|
||||
if (!git.pullLastUpdate(server.getDirectory(), getConfig(ConfigFile.LIGHTSPEED).getBoolean("GIT-REBASE", false))) {
|
||||
Log.e("Failed to pull latest update from %s", server.getName());
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user