Beispiel #1
0
        public bool Rollback(string solutionDirectoryPath, RenameContext context)
        {
            using (SvnClient svnClient = new SvnClient())
            {
                // TODO NKO Do someting with the changelist
                Collection <SvnListChangeListEventArgs> changeList;
                svnClient.GetChangeList(solutionDirectoryPath, out changeList);

                SvnRevertArgs revertArgs = new SvnRevertArgs {
                    Depth = SvnDepth.Infinity
                };
                svnClient.Revert(solutionDirectoryPath, revertArgs);
            }

            // Now delete the folder that was created for the new project.
            // Note: Can not use svnclient.Delete because the folder and all containing files werent ever checked in.
            Directory.Delete(context.NewProject.ProjectDirectory, true);

            // And do an update to get a clean repository state again.
            UpdateWorkingCopy(solutionDirectoryPath);

            return(true);
        }
        public bool Rollback(string solutionDirectoryPath, RenameContext context)
        {
            using(SvnClient svnClient = new SvnClient())
            {
                // TODO NKO Do someting with the changelist
                Collection<SvnListChangeListEventArgs> changeList;
                svnClient.GetChangeList(solutionDirectoryPath, out changeList);

                SvnRevertArgs revertArgs = new SvnRevertArgs { Depth = SvnDepth.Infinity };
                svnClient.Revert(solutionDirectoryPath, revertArgs);
            }

            // Now delete the folder that was created for the new project.
            // Note: Can not use svnclient.Delete because the folder and all containing files werent ever checked in.
            Directory.Delete(context.NewProject.ProjectDirectory, true);

            // And do an update to get a clean repository state again.
            UpdateWorkingCopy(solutionDirectoryPath);

            return true;
        }
        public void TestChangeLists()
        {
            SvnSandBox sbox = new SvnSandBox(this);

            sbox.Create(SandBoxRepository.Default);

            string WcPath = sbox.Wc;
            Uri    WcUri  = sbox.Uri;

            string file1 = Path.Combine(WcPath, "ChangeListFile1");
            string file2 = Path.Combine(WcPath, "ChangeListFile2");
            string file3 = Path.Combine(WcPath, "ChangeListFile3");
            string file4 = Path.Combine(WcPath, "ChangeListFile4");

            using (SvnClient client = NewSvnClient(true, false))
            {
                SvnInfoArgs ia = new SvnInfoArgs();
                ia.ThrowOnError = false;
                SvnInfoEventArgs iea;
                Collection <SvnInfoEventArgs> ee;
                Assert.That(client.GetInfo(new Uri(WcUri, "ChangeListFile1"), ia, out ee), Is.False);
                Assert.That(client.GetInfo(new Uri(WcUri, "ChangeListFile2"), ia, out ee), Is.False);
                Assert.That(client.GetInfo(new Uri(WcUri, "ChangeListFile3"), ia, out ee), Is.False);
                Assert.That(client.GetInfo(new Uri(WcUri, "ChangeListFile4"), ia, out ee), Is.False);

                TouchFile(file1);
                TouchFile(file2);
                TouchFile(file3);
                TouchFile(file4);

                client.Add(file1);
                client.Commit(WcPath);

                client.GetInfo(new Uri(WcUri, "ChangeListFile1"), out iea);
                Assert.That(iea, Is.Not.Null);

                client.Add(file2);
                client.Add(file3);
                client.Add(file4);

                client.AddToChangeList(file2, "ChangeListTest-2");
                client.AddToChangeList(file3, "ChangeListTest-3");

                Collection <SvnListChangeListEventArgs> paths;
                SvnListChangeListArgs a = new SvnListChangeListArgs();
                a.ChangeLists.Add("ChangeListTest-2");

                client.GetChangeList(WcPath, a, out paths);

                Assert.That(paths, Is.Not.Null);
                Assert.That(paths.Count, Is.EqualTo(1));
                Assert.That(paths[0].Path, Is.EqualTo(Path.GetFullPath(file2)));

                a = new SvnListChangeListArgs();
                a.ChangeLists.Add("ChangeListTest-4");
                client.GetChangeList(WcPath, a, out paths);

                Assert.That(paths, Is.Not.Null);
                Assert.That(paths.Count, Is.EqualTo(0));

                SvnCommitArgs ca = new SvnCommitArgs();
                ca.ChangeLists.Add("ChangeListTest-2");

                client.Commit(WcPath, ca);

                Assert.That(client.GetInfo(new Uri(WcUri, "ChangeListFile2"), ia, out ee), Is.True);
                Assert.That(client.GetInfo(new Uri(WcUri, "ChangeListFile3"), ia, out ee), Is.False);
                Assert.That(client.GetInfo(new Uri(WcUri, "ChangeListFile4"), ia, out ee), Is.False);

                bool visited = false;
                a = new SvnListChangeListArgs();
                a.ChangeLists.Add("ChangeListTest-3");
                client.ListChangeList(WcPath, a, delegate(object sender, SvnListChangeListEventArgs e)
                {
                    Assert.That(e.Path, Is.EqualTo(file3));
                    visited = true;
                });
                Assert.That(visited, Is.True);

                visited = false;
                client.Status(file4, delegate(object sender, SvnStatusEventArgs e)
                {
                    Assert.That(e.FullPath, Is.EqualTo(file4));
                    Assert.That(e.LocalNodeStatus, Is.EqualTo(SvnStatus.Added));
                    Assert.That(e.IsRemoteUpdated, Is.False);
                    Assert.That(e.Path, Is.EqualTo(file4));
                    visited = true;
                });
                Assert.That(visited, Is.True);

                client.Commit(WcPath);

                Assert.That(client.GetInfo(new Uri(WcUri, "ChangeListFile3"), ia, out ee), Is.True);
                Assert.That(client.GetInfo(new Uri(WcUri, "ChangeListFile4"), ia, out ee), Is.True);
            }
        }