private void RefreshChangesetList(object sender, EventArgs e)
        {
            string cmdResult = CmdRunner.ExecuteCommandWithStringResult(
                "cm find changeset --nototal --format=\"{changesetid}#{date}#{comment}\"",
                SampleHelper.GetWorkspace());

            ArrayList results = SampleHelper.GetListResults(cmdResult, true);

            changesetList.Items.Clear();
            foreach (string item in results)
            {
                Changeset cset = new Changeset(item);
                cmdResult = CmdRunner.ExecuteCommandWithStringResult(
                    string.Format("cm log {0} --csFormat=\"{{items}}\" --itemFormat=\"{{path}}#{{fullstatus}}#{{newline}}\"", cset.Id),
                    SampleHelper.GetWorkspace());

                results = SampleHelper.GetListResults(cmdResult, true);
                foreach (string changedItem in results)
                {
                    cset.Changes.Add(new Item(changedItem));
                }

                changesetList.Items.Add(cset);
            }
        }
        static void Main(string[] args)
        {
            string server           = "localhost:8084";
            string repository       = SampleHelper.GenerateRepositoryWithData(server);
            string secondRepository = SampleHelper.GenerateEmptyRepository(server);

            string cmdResult = CmdRunner.ExecuteCommandWithStringResult(
                string.Format("cm find branch on repositories '{0}' --format={{id}}#{{name}} --nototal", repository),
                Environment.CurrentDirectory);

            ArrayList     results  = SampleHelper.GetListResults(cmdResult, true);
            List <Branch> branches = GetBranchListFromCmdResult(results);

            List <ReplicationResult> resultList = new List <ReplicationResult>();

            foreach (Branch branch in branches)
            {
                resultList.Add(Replicate(branch, repository, secondRepository));
            }

            Console.WriteLine(Environment.NewLine + "Replication complete");
            PrintReplicationResult(resultList);

            Console.ReadLine();

            SampleHelper.RemoveSampleRepository(repository);
            SampleHelper.RemoveSampleRepository(secondRepository);
        }
        List <Branch> GetBranchesFromRepo(string repository)
        {
            string cmdResult = CmdRunner.ExecuteCommandWithStringResult(
                string.Format("cm find branch on repositories '{0}' --format={{id}}#{{name}} --nototal", repository),
                Environment.CurrentDirectory);

            ArrayList results = SampleHelper.GetListResults(cmdResult, true);

            return(GetBranchListFromCmdResult(results));
        }
        private static ReplicationResult Replicate(Branch branch, string repository,
                                                   string secondRepository)
        {
            Console.WriteLine("Replicating branch {0}", branch.Name);

            string cmdResult = CmdRunner.ExecuteCommandWithStringResult(
                string.Format("cm replicate \"br:{0}@{1}\" \"rep:{2}\"",
                              branch.Name, repository, secondRepository),
                Environment.CurrentDirectory);

            return(new ReplicationResult(SampleHelper.GetListResults(cmdResult, true), branch));
        }
Ejemplo n.º 5
0
        private List <Change> GetChanges()
        {
            List <Change> changes   = new List <Change>();
            string        cmdResult = CmdRunner.ExecuteCommandWithStringResult(
                string.Format("cm status --all --machinereadable"),
                SampleHelper.GetWorkspace());

            ArrayList results = SampleHelper.GetListResults(cmdResult, true);

            for (int i = 1; i < results.Count; i++)
            {
                changes.Add(new Change((string)results[i]));
            }

            return(changes);
        }
Ejemplo n.º 6
0
        private void ReloadSavedGames()
        {
            string cmdResult = CmdRunner.ExecuteCommandWithStringResult(
                string.Format("cm find changeset on repositories '{0}' --format={{comment}} --nototal",
                              textBox1.Text),
                Environment.CurrentDirectory);

            ArrayList results = SampleHelper.GetListResults(cmdResult, true);

            listBox1.Items.Clear();
            results.RemoveAt(0);
            foreach (string item in results)
            {
                listBox1.Items.Add(new SavedGame(item));
            }
        }
        private bool HasChangesInBranch(Branch branch)
        {
            string srcResult = CmdRunner.ExecuteCommandWithStringResult(
                string.Format("cm find changeset where branch = 'br:{0}' on repositories '{1}' --format={{id}} --nototal",
                              branch.Name, mSampleRep),
                Environment.CurrentDirectory);

            ArrayList srcResults = SampleHelper.GetListResults(srcResult, true);

            string dstResult = CmdRunner.ExecuteCommandWithStringResult(
                string.Format("cm find changeset where branch = 'br:{0}' on repositories '{1}' --format={{id}} --nototal",
                              branch.Name, mSecondRep),
                Environment.CurrentDirectory);

            ArrayList dstResults = SampleHelper.GetListResults(dstResult, true);

            return(srcResults.Count != dstResults.Count);
        }
        static void Main(string[] args)
        {
            string server     = "localhost:8084";
            string repository = SampleHelper.GenerateRepositoryWithData(server);

            Console.WriteLine("Created repository: {0}", repository);

            string cmdResult = CmdRunner.ExecuteCommandWithStringResult(
                string.Format("cm find branch on repositories '{0}' --format={{id}}#{{name}} --nototal", repository),
                Environment.CurrentDirectory);

            ArrayList     results  = SampleHelper.GetListResults(cmdResult, true);
            List <Branch> branches = GetBranchListFromCmdResult(results);

            foreach (Branch branch in branches)
            {
                Console.WriteLine(branch);
            }

            Console.ReadLine();

            SampleHelper.RemoveSampleRepository(repository);
        }