public void TestPush() { 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\n"); 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 changeset to child repo File.WriteAllText(Path.Combine(secondPath, "foo"), "1\na\n"); secondClient.Commit("a"); // Push to parent Assert.IsTrue(secondClient.Push(firstPath, null), "Nothing to push"); // Assert that the first repo now has two revisions in the log Assert.AreEqual(2, firstClient.Log(null, firstPath).Count, "Known commandserver bug: server is out of sync"); } finally { if (null != firstClient) { firstClient.Dispose(); } if (null != secondClient) { secondClient.Dispose(); } } }