Beispiel #1
0
 public void Clone(
     string sourceDir
     )
 {
     Clone(
         sourceDir,
         ConsoleArgumentFormatter.FixArgument(Environment.CurrentDirectory)
         );
 }
        public void Add(string file)
        {
            // TODO: Reimplement or remove
            //var relativePath = PathUtility.EnsureRelative (file, Environment.CurrentDirectory);

            Console.WriteLine("");
            Console.WriteLine("Adding file to git:");
            Console.WriteLine("  " + file);
            Console.WriteLine("Working directory:");
            Console.WriteLine("  " + Location.WorkingDirectory);
            Console.WriteLine("");

            GitProcess.Run(Location.WorkingDirectory, "add", "\"" + ConsoleArgumentFormatter.FixArgument(file) + "\"");
        }
        public void AddRemote(string name, string path)
        {
            Console.WriteLine("");
            Console.WriteLine("Adding git remote...");
            Console.WriteLine("Current directory:" + name);
            Console.WriteLine("Name:" + name);
            Console.WriteLine("Path:" + path);
            Console.WriteLine("");

            GitProcess.Run(
                Location.WorkingDirectory,
                "remote",
                "add",
                name,
                ConsoleArgumentFormatter.FixArgument(path)
                );
        }
Beispiel #4
0
        public void Clone(
            string sourceDir,
            string branch,
            string destinationDir
            )
        {
            Console.WriteLine("");
            Console.WriteLine("Cloning...");
            Console.WriteLine("Source: " + sourceDir);
            Console.WriteLine("Destination: " + destinationDir);

            // Create a temporary directory path to clone to
            // (the temporary folder works around the issue of cloning into existing directory)
            var tmpDir = Path.Combine(destinationDir, "_tmpclone");

            var relativeSourceDir = ConsoleArgumentFormatter.FixArgument(sourceDir);

            var relativeTmpDir = ConsoleArgumentFormatter.FixArgument(tmpDir);

            var args = new List <string> ();

            args.Add("clone");
            if (!String.IsNullOrEmpty(branch))
            {
                args.Add("-b");
                args.Add(branch);
            }
            args.Add("\"" + relativeSourceDir + "\"");
            args.Add("\"" + relativeTmpDir + "\"");
            args.Add("--verbose");

            GitProcess.Run(Environment.CurrentDirectory, args.ToArray());

            DirectoryMover.Move(tmpDir, destinationDir, true);

            Console.WriteLine("");
            Console.WriteLine("Complete");
            Console.WriteLine("");
        }
 public void Move(string fromPath, string toPath)
 {
     GitProcess.Run("mv", ConsoleArgumentFormatter.FixArgument(fromPath), ConsoleArgumentFormatter.FixArgument(toPath));
 }