private void core(AnyObjectId upstream) { Git git = new Git(CurrentRepository.getInstance().getRepository()); try { rebaseUpstream(git, upstream); } catch (NoHeadException e) { WriteToPane.getInstance().writeErr(e.getMessage()); e.printStackTrace(); } catch (WrongRepositoryStateException e) { WriteToPane.getInstance().writeErr(e.getMessage()); e.printStackTrace(); } catch (GitAPIException e) { WriteToPane.getInstance().writeErr(e.getMessage()); e.printStackTrace(); } }
@Override @Port(name = "files", method = "saveFile") public boolean saveFile(String relativePath, byte[] data) { boolean result = true; // super.saveFile(relativePath, data); File f = new File(baseFolder.getAbsolutePath() + relativePath); if (f.exists()) { result = save(relativePath, data); /*String relativePathClean = relativePath; if (relativePath.startsWith("/")) { relativePathClean = relativePath.substring(relativePath.indexOf("/") + 1); }*/ commitRepository( " File " + relativePath + " saved ", " from site ", " [email protected] "); // TODO fix name and email try { // addFileToRepository(f); git.pull().call(); /*} catch (Exception e) { logger.error("error while unlock and commit git ", e); }*/ } catch (DetachedHeadException e) { try { git.revert().call(); save(relativePath + ".bak_" + new Date(), data); commitRepository( " File " + relativePath + " saved with conflict ", " name ", " email "); // TODO fix name and email UsernamePasswordCredentialsProvider user = new UsernamePasswordCredentialsProvider( (String) this.getDictionary().get("login"), (String) this.getDictionary().get("pass")); git.push().setCredentialsProvider(user).call(); return false; } catch (GitAPIException e1) { e1.printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } e.printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } catch (NoHeadException e) { e.printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } catch (TransportException e) { e.printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } catch (InvalidConfigurationException e) { e.printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } catch (InvalidRemoteException e) { e.printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } catch (CanceledException e) { e.printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } catch (WrongRepositoryStateException e) { e.printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } catch (RefNotFoundException e) { e.printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } catch (GitAPIException e) { e.printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } try { UsernamePasswordCredentialsProvider user = new UsernamePasswordCredentialsProvider( (String) this.getDictionary().get("login"), (String) this.getDictionary().get("pass")); git.push().setCredentialsProvider(user).call(); return true; } catch (GitAPIException e) { e.printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } } return true; }