use of org.eclipse.jgit.internal.storage.file.FileRepository in project Aspose.Imaging-for-Java by aspose-imaging.
the class GitHelper method syncRepository.
public static void syncRepository(String localPath, String remotePath) throws Exception {
Repository localRepo;
try {
localRepo = new FileRepository(localPath + "/.git");
Git git = new Git(localRepo);
AsposeConstants.println("Syncronizing Repository [" + remotePath + "]....");
// Pull the changes
try {
git.pull().call();
} catch (Exception exPull) {
// If pull failed. Throw this exception to caller
{
AsposeConstants.println("Pull failed.");
}
// throw it
throw exPull;
}
} catch (Exception ex) {
throw new Exception("Could not update Repository from Github. Error: " + ex.getMessage());
}
}
use of org.eclipse.jgit.internal.storage.file.FileRepository in project Aspose.BarCode-for-Java by aspose-barcode.
the class GitHelper method syncRepository.
public static void syncRepository(String localPath, String remotePath) throws Exception {
Repository localRepo;
try {
localRepo = new FileRepository(localPath + "/.git");
Git git = new Git(localRepo);
AsposeConstants.println("Syncronizing Repository [" + remotePath + "]....");
// Pull the changes
try {
git.pull().call();
} catch (Exception exPull) {
// If pull failed. Throw this exception to caller
{
AsposeConstants.println("Pull failed.");
}
// throw it
throw exPull;
}
} catch (Exception ex) {
throw new Exception("Could not update Repository from Github. Error: " + ex.getMessage());
}
}
use of org.eclipse.jgit.internal.storage.file.FileRepository in project Aspose.OCR-for-Java by aspose-ocr.
the class GitHelper method updateRepository.
public static void updateRepository(String localPath, String remotePath) throws Exception {
Repository localRepo;
try {
localRepo = new FileRepository(localPath + "/.git");
Git git = new Git(localRepo);
{
AsposeConstants.println("Cloning Repository [" + remotePath + "]....");
}
// First try to clone the repository
try {
Git.cloneRepository().setURI(remotePath).setDirectory(new File(localPath)).call();
} catch (Exception ex) {
// If clone fails, try to pull the changes
try {
git.pull().call();
} catch (Exception exPull) {
// Pull also failed. Throw this exception to caller
{
AsposeConstants.println("Pull also failed.");
}
// throw it
throw exPull;
}
}
} catch (Exception ex) {
throw new Exception("Could not download Repository from Github. Error: " + ex.getMessage());
}
}
use of org.eclipse.jgit.internal.storage.file.FileRepository in project Aspose.OCR-for-Java by aspose-ocr.
the class GitHelper method syncRepository.
public static void syncRepository(String localPath, String remotePath) throws Exception {
Repository localRepo;
try {
localRepo = new FileRepository(localPath + "/.git");
Git git = new Git(localRepo);
AsposeConstants.println("Syncronizing Repository [" + remotePath + "]....");
// Pull the changes
try {
git.pull().call();
} catch (Exception exPull) {
// If pull failed. Throw this exception to caller
{
AsposeConstants.println("Pull failed.");
}
// throw it
throw exPull;
}
} catch (Exception ex) {
throw new Exception("Could not update Repository from Github. Error: " + ex.getMessage());
}
}
use of org.eclipse.jgit.internal.storage.file.FileRepository in project Aspose.Cells-for-Java by aspose-cells.
the class GitHelper method updateRepository.
/**
* @param localPath
* @param remotePath
* @throws Exception
*/
public static void updateRepository(String localPath, String remotePath) throws Exception {
Repository localRepo;
try {
localRepo = new FileRepository(localPath + "/.git");
Git git = new Git(localRepo);
// First try to clone the repository
try {
Git.cloneRepository().setURI(remotePath).setDirectory(new File(localPath)).call();
} catch (Exception ex) {
// If clone fails, try to pull the changes
try {
git.pull().call();
} catch (Exception exPull) {
// throw it
throw exPull;
}
}
} catch (Exception ex) {
throw new Exception("Could not download Repository from Github. Error: " + ex.getMessage());
}
}
Aggregations