Beispiel #1
0
        private static List <string> AccuRevStatCommandToLocationList(string param)
        {
            XDocument xmlDoc = XDocument.Parse(ShellExec.SimpleExecOutput("accurev", $"stat -{param} -fx"));

            return(xmlDoc.Descendants()
                   .Attributes("location")
                   .Select(x => x.Value)
                   .ToList());
        }
Beispiel #2
0
        public int Do()
        {
            string files = "";

            foreach (var f in opts.InputFiles)
            {
                files += f + " ";
            }
            files = files.TrimEnd();
            var comment = string.IsNullOrEmpty(opts.Comment) ? "" : $"-c {opts.Comment}";

            return(ShellExec.SimpleExec("accurev", $"add {files} -R {comment}"));
        }
Beispiel #3
0
        internal static void PrintHistory(int numEntires)
        {
            XDocument xmlDoc = XDocument.Parse(ShellExec.SimpleExecOutput("accurev", $"hist -a -fvx -t now.{numEntires}"));
            var       list   = xmlDoc.Descendants()
                               .Elements("transaction")
                               .Select(x => new
            {
                Id         = x.Attribute("id").Value,
                Type       = x.Attribute("type").Value,
                User       = x.Attribute("user").Value,
                Time       = Converter.UnixTimeStampToDateTime(Convert.ToDouble(x.Attribute("time").Value)),
                StreamName = x.Element("stream")?.Attribute("name")?.Value,
                StreamType = x.Element("stream")?.Attribute("type")?.Value,
                Comment    = x.Element("comment")?.Value,
                //TODO add file status (change, defunct, ..?)
                Files = x.Elements("version")?.Select(f => f.Attribute("path").Value)
            })
                               .ToList();

            foreach (var e in list)
            {
                Console.Write("* ");
                ConsoleOutput.PrintColor(e.Id, -1);
                Console.Write(" : ");
                ConsoleOutput.PrintColor(e.Type, 2);
                if (!string.IsNullOrEmpty(e.Comment))
                {
                    Console.Write($" - {e.Comment}");
                }
                else if (!string.IsNullOrEmpty(e.StreamType))
                {
                    ConsoleOutput.PrintColor($" [{e.StreamType}]", 4);
                    if (!string.IsNullOrEmpty(e.StreamName))
                    {
                        Console.Write($" | {e.StreamName}");
                    }
                }
                Console.Write(" ");
                ConsoleOutput.PrintColor($"({e.Time})", 7);
                ConsoleOutput.PrintColor($" <{e.User}>", 3);
                Console.WriteLine("");
                foreach (var f in e.Files)
                {
                    ConsoleOutput.PrintColor("\tfile: ", 4);
                    ConsoleOutput.PrintColor($"{f}", 5);
                    Console.WriteLine("");
                }
                Console.WriteLine("");
            }
        }
Beispiel #4
0
        private void tslExportXls_Click(object sender, EventArgs e)
        {
            SaveFileDialog sf = new SaveFileDialog();

            sf.FileName = "*.xls";
            if (DefaultFileName != null)
            {
                sf.FileName = DefaultFileName;
            }
            if (sf.ShowDialog() == DialogResult.OK)
            {
                idg.Exportxls(sf.FileName, dict);
                if (MessageBox.Show("是否打開文件" + sf.FileName, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    ShellExec.ShellExecute(IntPtr.Zero, new StringBuilder("Open"), new StringBuilder(sf.FileName), new StringBuilder(""), new StringBuilder(""), 1);
                }
            }
        }
Beispiel #5
0
        public int Do()
        {
            string files = "";

            if (opts.AddAll)
            {
                files = "-m";
            }
            else
            {
                foreach (var f in opts.InputFiles)
                {
                    files += f + " ";
                }
                files += "-R";
            }
            var comment = string.IsNullOrEmpty(opts.Comment) ? "" : $"-c {opts.Comment}";

            return(ShellExec.SimpleExec("accurev", $"keep {files} {comment}"));
        }
Beispiel #6
0
        public int Do()
        {
            string files = "";

            if (opts.AddAll)
            {
                files = "-d";
            }
            else
            {
                foreach (var f in opts.InputFiles)
                {
                    files += f + " ";
                }
                files = files.TrimEnd();
            }
            var comment = string.IsNullOrEmpty(opts.Comment) ? "" : $"-c \"{opts.Comment}\"";

            return(ShellExec.SimpleExec("accurev", $"promote {files} {comment}"));
        }