Exemplo n.º 1
0
 public void Clone(
     string sourceDir
     )
 {
     Clone(
         sourceDir,
         ConsoleArgumentFormatter.FixArgument(Environment.CurrentDirectory)
         );
 }
Exemplo n.º 2
0
        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) + "\"");
        }
Exemplo n.º 3
0
        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)
                );
        }
Exemplo n.º 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("");
        }
Exemplo n.º 5
0
 public void Move(string fromPath, string toPath)
 {
     GitProcess.Run("mv", ConsoleArgumentFormatter.FixArgument(fromPath), ConsoleArgumentFormatter.FixArgument(toPath));
 }