Exemplo n.º 1
0
        public void TestDirObstruction()
        {
            SvnSandBox sbox = new SvnSandBox(this);

            string          dir = sbox.GetTempDir();
            string          sd  = Path.Combine(dir, "NewDir");
            SvnUpdateResult ur;

            Client.CheckOut(sbox.CreateRepository(SandBoxRepository.Empty), dir, out ur);

            Client.CreateDirectory(sd);
            Client.Commit(dir);
            SvnUpdateArgs ua = new SvnUpdateArgs();

            ua.Revision = ur.Revision;
            Client.Update(dir, ua);
            Directory.CreateDirectory(sd);

            ua = new SvnUpdateArgs();
            bool gotIt       = false;
            bool gotConflict = false;

            ua.Notify += delegate(object sender, SvnNotifyEventArgs e)
            {
                if (e.Action == SvnNotifyAction.ConflictResolverStarting || e.Action == SvnNotifyAction.ConflictResolverDone)
                {
                    return;
                }
                if (e.FullPath != sd)
                {
                    return;
                }

                gotIt = true;
                Assert.That(e.Action, Is.EqualTo(SvnNotifyAction.TreeConflict));
                Assert.That(e.NodeKind, Is.EqualTo(SvnNodeKind.Directory));
            };
            ua.ThrowOnError = false;
            ua.AddExpectedError(SvnErrorCode.SVN_ERR_WC_OBSTRUCTED_UPDATE);
            ua.Conflict += delegate(object sender, SvnConflictEventArgs e)
            {
                gotConflict = true;
            };

            Assert.That(Client.Update(dir, ua), "Update failed");
            Assert.That(gotIt, "Got obstruction notification");
            Assert.That(gotConflict, "Got conflict event");

            Client.Status(sd,
                          delegate(object sender, SvnStatusEventArgs sa)
            {
                Assert.That(sa.Conflicted, Is.True, "Has tree conflict");
                Assert.That(sa.LocalNodeStatus, Is.EqualTo(SvnStatus.Deleted));
                Assert.That(sa.LocalTextStatus, Is.EqualTo(SvnStatus.Normal));
            });
        }
Exemplo n.º 2
0
        public void TestObstruction()
        {
            SvnSandBox sbox           = new SvnSandBox(this);
            Uri        CollabReposUri = sbox.CreateRepository(SandBoxRepository.MergeScenario);

            string tmp = sbox.Wc;

            Client.CheckOut(new SvnUriTarget(new Uri(CollabReposUri, "trunk/"), 2), tmp);
            File.WriteAllText(Path.Combine(tmp, "products/medium.html"), "q");
            SvnUpdateArgs ua = new SvnUpdateArgs();
            bool          obstructionFound = false;

            ua.Notify += delegate(object sender, SvnNotifyEventArgs e)
            {
                if (e.Action == SvnNotifyAction.TreeConflict)
                {
                    obstructionFound = true;
                }
            };
            ua.AddExpectedError(SvnErrorCode.SVN_ERR_WC_OBSTRUCTED_UPDATE);
            Assert.That(Client.Update(tmp, ua), "Update ok");

            Assert.That(obstructionFound, "Obstruction found");
        }