/** * When creating a branch with {@link #setCreateBranch(boolean)}, this can * be used to configure branch tracking. * * @param mode * corresponds to the --track/--no-track options; may be * <code>null</code> * @return this instance */ public CheckoutCommand setUpstreamMode( CreateBranchCommand.SetupUpstreamMode mode) { checkCallable(); this.upstreamMode = mode; return this; }
/** * Specify to force the ref update in case of a branch switch. * * @param force * if <code>true</code> and the branch with the given name * already exists, the start-point of an existing branch will be * set to a new start-point; if false, the existing branch will * not be changed * @return this instance */ public CheckoutCommand setForce(boolean force) { checkCallable(); this.force = force; return this; }
/** * Specify whether to create a new orphan branch. * <p> * If <code>true</code> is used, the name of the new orphan branch must be * set using {@link #setName(String)}. The commit at which to start the new * orphan branch can be set using {@link #setStartPoint(String)} or * {@link #setStartPoint(RevCommit)}; if not specified, HEAD is used. * * @param orphan * if <code>true</code> a orphan branch will be created as part * of the checkout to the specified start point * @return this instance * @since 3.3 */ public CheckoutCommand setOrphan(boolean orphan) { checkCallable(); this.orphan = orphan; return this; }
/** * Specify whether to create a new branch. * <p> * If <code>true</code> is used, the name of the new branch must be set * using {@link #setName(String)}. The commit at which to start the new * branch can be set using {@link #setStartPoint(String)} or * {@link #setStartPoint(RevCommit)}; if not specified, HEAD is used. Also * see {@link #setUpstreamMode} for setting up branch tracking. * * @param createBranch * if <code>true</code> a branch will be created as part of the * checkout and set to the specified start point * @return this instance */ public CheckoutCommand setCreateBranch(boolean createBranch) { checkCallable(); this.createBranch = createBranch; return this; }
/** * Specify the name of the branch or commit to check out, or the new branch * name. * <p> * When only checking out paths and not switching branches, use * {@link #setStartPoint(String)} or {@link #setStartPoint(RevCommit)} to * specify from which branch or commit to check out files. * <p> * When {@link #setCreateBranch(boolean)} is set to <code>true</code>, use * this method to set the name of the new branch to create and * {@link #setStartPoint(String)} or {@link #setStartPoint(RevCommit)} to * specify the start point of the branch. * * @param name * the name of the branch or commit * @return this instance */ public CheckoutCommand setName(String name) { checkCallable(); this.name = name; return this; }
/** * Add a single slash-separated path to the list of paths to check out. To * check out all paths, use {@link #setAllPaths(boolean)}. * <p> * If this option is set, neither the {@link #setCreateBranch(boolean)} nor * {@link #setName(String)} option is considered. In other words, these * options are exclusive. * * @param path * path to update in the working tree and index (with * <code>/</code> as separator) * @return {@code this} */ public CheckoutCommand addPath(String path) { checkCallable(); this.paths.add(path); return this; }
/** * Add multiple slash-separated paths to the list of paths to check out. To * check out all paths, use {@link #setAllPaths(boolean)}. * <p> * If this option is set, neither the {@link #setCreateBranch(boolean)} nor * {@link #setName(String)} option is considered. In other words, these * options are exclusive. * * @param p * paths to update in the working tree and index (with * <code>/</code> as separator) * @return {@code this} * @since 4.6 */ public CheckoutCommand addPaths(List<String> p) { checkCallable(); this.paths.addAll(p); return this; }
/** * When checking out the index, check out the specified stage (ours or * theirs) for unmerged paths. * <p> * This can not be used when checking out a branch, only when checking out * the index. * * @param stage * the stage to check out * @return this */ public CheckoutCommand setStage(Stage stage) { checkCallable(); this.checkoutStage = stage; checkOptions(); return this; }
/** * Set the commit that should be checked out. * <p> * When creating a new branch, this will be used as the start point. If not * specified or <code>null</code>, the current HEAD is used. * <p> * When checking out files and this is not specified or <code>null</code>, * the index is used. * * @param startCommit * commit to check out * @return this instance */ public CheckoutCommand setStartPoint(RevCommit startCommit) { checkCallable(); this.startCommit = startCommit; this.startPoint = null; checkOptions(); return this; }
/** * Set the name of the commit that should be checked out. * <p> * When checking out files and this is not specified or <code>null</code>, * the index is used. * <p> * When creating a new branch, this will be used as the start point. If not * specified or <code>null</code>, the current HEAD is used. * * @param startPoint * commit name to check out * @return this instance */ public CheckoutCommand setStartPoint(String startPoint) { checkCallable(); this.startPoint = startPoint; this.startCommit = null; checkOptions(); return this; }
/** * Specify to force the ref update in case of a branch switch. * * @param force * if <code>true</code> and the branch with the given name * already exists, the start-point of an existing branch will be * set to a new start-point; if false, the existing branch will * not be changed * @return this instance */ public CheckoutCommand setForce(boolean force) { checkCallable(); this.force = force; return this; }
/** * When creating a branch with {@link #setCreateBranch(boolean)}, this can * be used to configure branch tracking. * * @param mode * corresponds to the --track/--no-track options; may be * <code>null</code> * @return this instance */ public CheckoutCommand setUpstreamMode( CreateBranchCommand.SetupUpstreamMode mode) { checkCallable(); this.upstreamMode = mode; return this; }
/** * Specify to force the ref update in case of a branch switch. * * @param force * if <code>true</code> and the branch with the given name * already exists, the start-point of an existing branch will be * set to a new start-point; if false, the existing branch will * not be changed * @return this instance */ public CheckoutCommand setForce(boolean force) { checkCallable(); this.force = force; return this; }
/** * When creating a branch with {@link #setCreateBranch(boolean)}, this can * be used to configure branch tracking. * * @param mode * corresponds to the --track/--no-track options; may be * <code>null</code> * @return this instance */ public CheckoutCommand setUpstreamMode( CreateBranchCommand.SetupUpstreamMode mode) { checkCallable(); this.upstreamMode = mode; return this; }
/** * Add a single slash-separated path to the list of paths to check out. To * check out all paths, use {@link #setAllPaths(boolean)}. * <p> * If this option is set, neither the {@link #setCreateBranch(boolean)} nor * {@link #setName(String)} option is considered. In other words, these * options are exclusive. * * @param path * path to update in the working tree and index (with * <code>/</code> as separator) * @return {@code this} */ public CheckoutCommand addPath(String path) { checkCallable(); this.paths.add(path); return this; }
/** * Add multiple slash-separated paths to the list of paths to check out. To * check out all paths, use {@link #setAllPaths(boolean)}. * <p> * If this option is set, neither the {@link #setCreateBranch(boolean)} nor * {@link #setName(String)} option is considered. In other words, these * options are exclusive. * * @param p * paths to update in the working tree and index (with * <code>/</code> as separator) * @return {@code this} * @since 4.6 */ public CheckoutCommand addPaths(List<String> p) { checkCallable(); this.paths.addAll(p); return this; }
/** * Add a single slash-separated path to the list of paths to check out. To * check out all paths, use {@link #setAllPaths(boolean)}. * <p> * If this option is set, neither the {@link #setCreateBranch(boolean)} nor * {@link #setName(String)} option is considered. In other words, these * options are exclusive. * * @param path * path to update in the working tree and index (with * <code>/</code> as separator) * @return {@code this} */ public CheckoutCommand addPath(String path) { checkCallable(); this.paths.add(path); return this; }
RefNotFoundException, InvalidRefNameException, CheckoutConflictException { checkCallable(); try { processOptions();
/** * When checking out the index, check out the specified stage (ours or * theirs) for unmerged paths. * <p> * This can not be used when checking out a branch, only when checking out * the index. * * @param stage * the stage to check out * @return this */ public CheckoutCommand setStage(Stage stage) { checkCallable(); this.checkoutStage = stage; checkOptions(); return this; }
/** * When checking out the index, check out the specified stage (ours or * theirs) for unmerged paths. * <p> * This can not be used when checking out a branch, only when checking out * the index. * * @param stage * the stage to check out * @return this */ public CheckoutCommand setStage(Stage stage) { checkCallable(); this.checkoutStage = stage; checkOptions(); return this; }