Пример #1
0
        public CommitCommand(string[] files, string message, string workingDir)
        {
            if (workingDir == null)
            {
                return;
            }

            //add the files first to make sure untracked files can be committed
            var addArgs  = "add";
            var fileArgs = "";

            if (files != null)
            {
                foreach (var file in files)
                {
                    fileArgs += " \"" + VCHelper.GetRelativePath(file, workingDir) + "\"";
                }
            }

            addArgs         += fileArgs;
            commitArgs       = "commit" + fileArgs + " -m \"" + VCHelper.EscapeCommandLine(message) + "\"";
            workingDirectory = workingDir;

            if (files != null)
            {
                Run(addArgs, workingDir);
            }
            else
            {
                Run(commitArgs, workingDir);
            }
        }
Пример #2
0
        public CommitCommand(string[] files, string message, string workingDir)
        {
            if (workingDir == null)
            {
                return;
            }
            workingDirectory = workingDir;

            //add the files first to make sure untracked files can be committed
            var fileArgs = "";

            if (files != null)
            {
                foreach (var file in files)
                {
                    if (File.Exists(file) || Directory.Exists(file))
                    {
                        fileArgs += " \"" + VCHelper.GetRelativePath(file, workingDir) + "\"";
                    }
                }
            }

            commitArgs = "commit" + fileArgs + " -m \"" + VCHelper.EscapeCommandLine(message) + "\"";
            if (!string.IsNullOrEmpty(fileArgs))
            {
                Run("add" + fileArgs, workingDir);
            }
            else
            {
                Run(commitArgs, workingDir);
            }
        }
Пример #3
0
        public CommitCommand(string[] files, string message, string workingDir)
        {
            if (workingDir == null)
            {
                return;
            }

            var args = "commit";

            if (files != null)
            {
                foreach (var file in files)
                {
                    args += " \"" + VCHelper.GetRelativePath(file, workingDir) + "\"";
                }
            }

            args += " -m \"" + VCHelper.EscapeCommandLine(message) + "\"";

            Run(args, workingDir);
        }