List of usage examples for org.eclipse.jgit.internal.storage.reftree Command Command
public Command(RevWalk rw, ReceiveCommand cmd) throws MissingObjectException, IOException
From source file:org.uberfire.java.nio.fs.jgit.util.commands.RefTreeUpdateCommand.java
License:Apache License
private void symRef(final Git git, final String name, final String dst) throws java.io.IOException { commit(git.getRepository(), null, (reader, tree) -> { Ref old = tree.exactRef(reader, name); Ref newx = tree.exactRef(reader, dst); final Command n; if (newx != null) { n = new Command(old, new SymbolicRef(name, newx)); } else {// ww w . ja v a2 s.c o m n = new Command(old, new SymbolicRef(name, new ObjectIdRef.Unpeeled(Ref.Storage.NEW, dst, null))); } return tree.apply(Collections.singleton(n)); }); }
From source file:org.uberfire.java.nio.fs.jgit.util.commands.RefTreeUpdateCommand.java
License:Apache License
private void update(final Repository _repo, final String _name, final RevCommit _commit) throws IOException { commit(_repo, _commit, (reader, refTree) -> { final Ref old = refTree.exactRef(reader, _name); final List<Command> n = new ArrayList<>(1); try (RevWalk rw = new RevWalk(_repo)) { n.add(new Command(old, toRef(rw, _commit, _name, true))); if (git.isKetchEnabled()) { proposeKetch(n, _commit); }/*from w w w . j a v a 2 s . co m*/ } catch (final IOException | InterruptedException e) { String msg = JGitText.get().transactionAborted; for (Command cmd : n) { if (cmd.getResult() == NOT_ATTEMPTED) { cmd.setResult(REJECTED_OTHER_REASON, msg); } } throw new GitException("Error"); //log.error(msg, e); } return refTree.apply(n); }); }