Esempio n. 1
0
        public void Commit(string commit_message, bool isAmend = false)
        {
            // Use temp file to commit with multiline message
            string temp_filename;

            try
            {
                temp_filename = Path.GetTempFileName();
            }
            catch (IOException)
            {
                UIService.ShowMessage("Cannot create temp file for commit");
                return;
            }
            using (var stream = File.CreateText(temp_filename))
            {
                stream.Write(commit_message);
            }
            string cmd = "commit --file=\"" + temp_filename + "\"";

            if (isAmend)
            {
                cmd += " --amend";
            }
            CreateGitRunner().Run(cmd);

            File.Delete(temp_filename);
        }
Esempio n. 2
0
 private void SetTitleToGitVersion()
 {
     try
     {
         string output = ProgramPathFinder.ExecuteAndGetOutput(ProgramPathFinder.GetGitBin(),
                                                               "--version");
         this.Title += " - " + output;
     }
     catch (System.IO.FileNotFoundException ex)
     {
         UIService.ShowMessage(ex.Message);
         System.Environment.Exit(1);
     }
 }
Esempio n. 3
0
        private void OnWindowDragDrop(object sender, System.Windows.DragEventArgs e)
        {
            string[] paths = (string[])e.Data.GetData(System.Windows.DataFormats.FileDrop);

            if (paths.Length != 1)
            {
                UIService.ShowMessage("Please drop one directory only");
                return;
            }
            string repository_path = paths[0];

            if (Util.IsValidGitDirectory(repository_path) == false)
            {
                if (UIService.AskAndGitInit(repository_path) == false)
                {
                    return;
                }
            }
            new NewRepositoryController(tab_control_).OpenRepository(repository_path);
        }