Beispiel #1
0
        public void TestIncoming()
        {
            string firstPath  = GetTemporaryPath();
            string secondPath = GetTemporaryPath();
            string file       = Path.Combine(firstPath, "foo");

            CommandClient.Initialize(firstPath, MercurialPath);
            CommandClient firstClient  = null,
                          secondClient = null;

            try {
                // Create repo with one commit
                firstClient = new CommandClient(firstPath, null, null, MercurialPath);
                File.WriteAllText(file, "1");
                firstClient.Add(file);
                firstClient.Commit("1");

                // Clone repo
                CommandClient.Clone(source: firstPath, destination: secondPath, mercurialPath: MercurialPath);
                secondClient = new CommandClient(secondPath, null, null, MercurialPath);
                Assert.AreEqual(1, secondClient.Log(null).Count, "Unexpected number of log entries");

                // Add changesets to original repo
                File.WriteAllText(file, "2");
                firstClient.Commit("2");
                File.WriteAllText(file, "3");
                firstClient.Commit("3");

                IList <Revision> incoming = secondClient.Incoming(null, null);
                Assert.AreEqual(2, incoming.Count, "Unexpected number of incoming changesets");
            } finally {
                if (null != firstClient)
                {
                    firstClient.Dispose();
                }
                if (null != secondClient)
                {
                    secondClient.Dispose();
                }
            }
        }