public void CheckoutChangeset(ICheckoutChangesetArgs args) { var ab = new ArgBuilder(); ab.Add("checkout"); ab.Add(args.TargetRev); ab.AddIf(args.Force, "--force"); ab.AddIf(!String.IsNullOrEmpty(args.NewBranchName), $"-b \"{args.NewBranchName}\""); RunCommand(ab, args); }
public Changeset Commit(ICommitScmFileArgs args) { Reset(args.RepositoryPath); if (!args.All) { foreach (var file in args.Files) { AddFileToIndex(args.RepositoryPath, file); } } var ab = new ArgBuilder(); ab.Add("commit"); ab.AddIf(args.All, "--all"); using (var msgFile = new TempFile("msg")) { File.WriteAllText(msgFile.FilePath, args.Message); ab.Add($"--file=\"{msgFile}\""); RunCommand(ab, args); } return(null); // todo }
private void CreateBookmark(INewBranchArgs args) { var ab = new ArgBuilder(); ab.Add("bookmarks"); if (!String.IsNullOrEmpty(args.TargetChangeset)) { ab.Add($"--rev \"{args.TargetChangeset}\""); } ab.AddIf(args.Force, "--force"); ab.Add(args.Name); RunCommand(ab, args); }
private void CreatePermanentBranch(INewBranchArgs args) { if (!String.IsNullOrEmpty(args.TargetChangeset)) { throw new NotSupportedException($"'{nameof(args.TargetChangeset)}' is not supported for permanent branches."); } var ab = new ArgBuilder(); ab.Add("branch"); ab.Add($"\"{args.Name}\""); ab.AddIf(args.Force, "--force"); RunCommand(ab, args); if (args.Commit) { Commit(new CommitScmFileArgs { RepositoryPath = args.RepositoryPath, Message = $"Opened branch '{args.Name}'" }); } }