public virtual void TestSuccess() { // Manually force a delta of an object so we reuse it later. // TemporaryBuffer.Heap pack = new TemporaryBuffer.Heap(1024); PackHeader(pack, 2); pack.Write((Constants.OBJ_BLOB) << 4 | 1); Deflate(pack, new byte[] { (byte)('a') }); pack.Write((Constants.OBJ_REF_DELTA) << 4 | 4); a.CopyRawTo(pack); Deflate(pack, new byte[] { unchecked ((int)(0x1)), unchecked ((int)(0x1)), unchecked ( (int)(0x1)), (byte)('b') }); Digest(pack); OpenPack(pack); // Verify the only storage of b is our packed delta above. // ObjectDirectory od = (ObjectDirectory)src.ObjectDatabase; NUnit.Framework.Assert.IsTrue(src.HasObject(b), "has b"); NUnit.Framework.Assert.IsFalse(od.FileFor(b).Exists(), "b not loose"); // Now use b but in a different commit than what is hidden. // TestRepository s = new TestRepository(src); RevCommit N = s.Commit().Parent(B).Add("q", b).Create(); s.Update(R_MASTER, N); // Push this new content to the remote, doing strict validation. // TransportLocal t = new _TransportLocal_209(this, src, UriOf(dst)); RemoteRefUpdate u = new RemoteRefUpdate(src, R_MASTER, R_MASTER, false, null, null ); // // // src name // dst name // do not force update // local tracking branch // expected id PushResult r; try { t.SetPushThin(true); r = t.Push(PM, Sharpen.Collections.Singleton(u)); } finally { t.Close(); } NUnit.Framework.Assert.IsNotNull(r, "have result"); NUnit.Framework.Assert.IsNull(r.GetAdvertisedRef(R_PRIVATE), "private not advertised" ); NUnit.Framework.Assert.AreEqual(RemoteRefUpdate.Status.OK, u.GetStatus(), "master updated" ); NUnit.Framework.Assert.AreEqual(N, dst.Resolve(R_MASTER)); }
public virtual void TestSuccess() { // Manually force a delta of an object so we reuse it later. // TemporaryBuffer.Heap pack = new TemporaryBuffer.Heap(1024); PackHeader(pack, 2); pack.Write((Constants.OBJ_BLOB) << 4 | 1); Deflate(pack, new byte[] { (byte)('a') }); pack.Write((Constants.OBJ_REF_DELTA) << 4 | 4); a.CopyRawTo(pack); Deflate(pack, new byte[] { unchecked((int)(0x1)), unchecked((int)(0x1)), unchecked( (int)(0x1)), (byte)('b') }); Digest(pack); OpenPack(pack); // Verify the only storage of b is our packed delta above. // ObjectDirectory od = (ObjectDirectory)src.ObjectDatabase; NUnit.Framework.Assert.IsTrue(src.HasObject(b), "has b"); NUnit.Framework.Assert.IsFalse(od.FileFor(b).Exists(), "b not loose"); // Now use b but in a different commit than what is hidden. // TestRepository s = new TestRepository(src); RevCommit N = s.Commit().Parent(B).Add("q", b).Create(); s.Update(R_MASTER, N); // Push this new content to the remote, doing strict validation. // TransportLocal t = new _TransportLocal_209(this, src, UriOf(dst)); RemoteRefUpdate u = new RemoteRefUpdate(src, R_MASTER, R_MASTER, false, null, null ); // // // src name // dst name // do not force update // local tracking branch // expected id PushResult r; try { t.SetPushThin(true); r = t.Push(PM, Sharpen.Collections.Singleton(u)); } finally { t.Close(); } NUnit.Framework.Assert.IsNotNull(r, "have result"); NUnit.Framework.Assert.IsNull(r.GetAdvertisedRef(R_PRIVATE), "private not advertised" ); NUnit.Framework.Assert.AreEqual(RemoteRefUpdate.Status.OK, u.GetStatus(), "master updated" ); NUnit.Framework.Assert.AreEqual(N, dst.Resolve(R_MASTER)); }