Skip to content

Commit

Permalink
Pull command execution fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamBien committed Oct 13, 2015
1 parent c0a6230 commit 683efb5
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/main/java/com/airhacks/airfield/TakeDown.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.PullCommand;
import org.eclipse.jgit.api.PullResult;
import org.eclipse.jgit.api.ResetCommand;
import org.eclipse.jgit.api.errors.GitAPIException;

Expand Down Expand Up @@ -39,12 +43,22 @@ void initialDownload() {
void update() {
try {
this.git.reset().setMode(ResetCommand.ResetType.HARD).call();

System.out.println("+Changed files removed");
} catch (GitAPIException ex) {
throw new IllegalStateException("Cannot reset local repository", ex);
}
this.git.pull();
System.out.println("+Files updated, ready to start!");
PullCommand command = this.git.pull();
try {
PullResult pullResult = command.call();
if (pullResult.isSuccessful()) {
System.out.println("+Files updated, ready to start!");
} else {
System.out.println("--Download was not successful " + pullResult.toString());
}
} catch (GitAPIException ex) {
Logger.getLogger(TakeDown.class.getName()).log(Level.SEVERE, null, ex);
}
}

boolean openLocal() {
Expand Down

0 comments on commit 683efb5

Please sign in to comment.