Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.CreateBranchCommand


            String shortName = Repository.shortenRefName(startPoint);
            branchName = shortName.substring(shortName.indexOf("/") + 1); //$NON-NLS-1$
          }
        }

        CreateBranchCommand cc = new Git(db).branchCreate();
        cc.setName(branchName);

        if (startPoint != null && !startPoint.isEmpty()) {
          cc.setStartPoint(startPoint);
          cc.setUpstreamMode(SetupUpstreamMode.TRACK);
        }

        Ref ref = cc.call();

        URI cloneLocation = BaseToCloneConverter.getCloneLocation(getURI(request), BaseToCloneConverter.BRANCH_LIST);
        JSONObject result = new Branch(cloneLocation, db, ref).toJSON();
        OrionServlet.writeJSONResponse(request, response, result, JsonURIUnqualificationStrategy.ALL_NO_GIT);
        response.setHeader(ProtocolConstants.HEADER_LOCATION, result.getString(ProtocolConstants.KEY_LOCATION));
View Full Code Here


        }
    }

    public void createBranch(String name) {
        try {
            CreateBranchCommand command = git.branchCreate();
            command.setName(name);
            command.call();
        } catch (JGitInternalException e) {
            throw new IllegalStateException("Unable to create a new branch <" + name + ">.", e);
        } catch (RefAlreadyExistsException e) {
            throw new IllegalStateException("Unable to create a new branch <" + name + ">.", e);
        } catch (RefNotFoundException e) {
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.api.CreateBranchCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.