Ejemplo n.º 1
0
        public virtual void TestFindRemoteRefUpdatesTwoRefSpecs()
        {
            transport = NGit.Transport.Transport.Open(db, remoteConfig);
            RefSpec specA = new RefSpec("+refs/heads/a:refs/heads/b");
            RefSpec specC = new RefSpec("+refs/heads/c:refs/heads/d");
            ICollection <RefSpec>         specs  = Arrays.AsList(specA, specC);
            ICollection <RemoteRefUpdate> result = transport.FindRemoteRefUpdatesFor(specs);

            NUnit.Framework.Assert.AreEqual(2, result.Count);
            bool foundA = false;
            bool foundC = false;

            foreach (RemoteRefUpdate rru in result)
            {
                if ("refs/heads/a".Equals(rru.GetSrcRef()) && "refs/heads/b".Equals(rru.GetRemoteName
                                                                                        ()))
                {
                    foundA = true;
                }
                if ("refs/heads/c".Equals(rru.GetSrcRef()) && "refs/heads/d".Equals(rru.GetRemoteName
                                                                                        ()))
                {
                    foundC = true;
                }
            }
            NUnit.Framework.Assert.IsTrue(foundA);
            NUnit.Framework.Assert.IsTrue(foundC);
        }
Ejemplo n.º 2
0
        public virtual void TestFindRemoteRefUpdatesWildcardNoTracking()
        {
            transport = NGit.Transport.Transport.Open(db, remoteConfig);
            ICollection <RemoteRefUpdate> result = transport.FindRemoteRefUpdatesFor(Sharpen.Collections
                                                                                     .NCopies(1, new RefSpec("+refs/heads/*:refs/heads/test/*")));

            NUnit.Framework.Assert.AreEqual(12, result.Count);
            bool foundA = false;
            bool foundB = false;

            foreach (RemoteRefUpdate rru in result)
            {
                if ("refs/heads/a".Equals(rru.GetSrcRef()) && "refs/heads/test/a".Equals(rru.GetRemoteName
                                                                                             ()))
                {
                    foundA = true;
                }
                if ("refs/heads/b".Equals(rru.GetSrcRef()) && "refs/heads/test/b".Equals(rru.GetRemoteName
                                                                                             ()))
                {
                    foundB = true;
                }
            }
            NUnit.Framework.Assert.IsTrue(foundA);
            NUnit.Framework.Assert.IsTrue(foundB);
        }
Ejemplo n.º 3
0
        public virtual void TestFindRemoteRefUpdatesTrackingRef()
        {
            remoteConfig.AddFetchRefSpec(new RefSpec("refs/heads/*:refs/remotes/test/*"));
            transport = NGit.Transport.Transport.Open(db, remoteConfig);
            ICollection <RemoteRefUpdate> result = transport.FindRemoteRefUpdatesFor(Sharpen.Collections
                                                                                     .NCopies(1, new RefSpec("+refs/heads/a:refs/heads/a")));

            NUnit.Framework.Assert.AreEqual(1, result.Count);
            TrackingRefUpdate tru = result.Iterator().Next().GetTrackingRefUpdate();

            NUnit.Framework.Assert.AreEqual("refs/remotes/test/a", tru.GetLocalName());
            NUnit.Framework.Assert.AreEqual("refs/heads/a", tru.GetRemoteName());
            NUnit.Framework.Assert.AreEqual(db.Resolve("refs/heads/a"), tru.GetNewObjectId());
            NUnit.Framework.Assert.AreEqual(ObjectId.ZeroId, tru.GetOldObjectId());
        }
Ejemplo n.º 4
0
        public virtual void TestFindRemoteRefUpdatesNoWildcardNoTracking()
        {
            transport = NGit.Transport.Transport.Open(db, remoteConfig);
            ICollection <RemoteRefUpdate> result = transport.FindRemoteRefUpdatesFor(Collections
                                                                                     .NCopies(1, new RefSpec("refs/heads/master:refs/heads/x")));

            NUnit.Framework.Assert.AreEqual(1, result.Count);
            RemoteRefUpdate rru = result.Iterator().Next();

            NUnit.Framework.Assert.IsNull(rru.GetExpectedOldObjectId());
            NUnit.Framework.Assert.IsFalse(rru.IsForceUpdate());
            NUnit.Framework.Assert.AreEqual("refs/heads/master", rru.GetSrcRef());
            NUnit.Framework.Assert.AreEqual(db.Resolve("refs/heads/master"), rru.GetNewObjectId
                                                ());
            NUnit.Framework.Assert.AreEqual("refs/heads/x", rru.GetRemoteName());
        }
Ejemplo n.º 5
0
 public virtual void TestFindRemoteRefUpdatesWildcardNoTracking()
 {
     transport = NGit.Transport.Transport.Open(db, remoteConfig);
     ICollection<RemoteRefUpdate> result = transport.FindRemoteRefUpdatesFor(Sharpen.Collections
         .NCopies(1, new RefSpec("+refs/heads/*:refs/heads/test/*")));
     NUnit.Framework.Assert.AreEqual(12, result.Count);
     bool foundA = false;
     bool foundB = false;
     foreach (RemoteRefUpdate rru in result)
     {
         if ("refs/heads/a".Equals(rru.GetSrcRef()) && "refs/heads/test/a".Equals(rru.GetRemoteName
             ()))
         {
             foundA = true;
         }
         if ("refs/heads/b".Equals(rru.GetSrcRef()) && "refs/heads/test/b".Equals(rru.GetRemoteName
             ()))
         {
             foundB = true;
         }
     }
     NUnit.Framework.Assert.IsTrue(foundA);
     NUnit.Framework.Assert.IsTrue(foundB);
 }
Ejemplo n.º 6
0
 public virtual void TestFindRemoteRefUpdatesTwoRefSpecs()
 {
     transport = NGit.Transport.Transport.Open(db, remoteConfig);
     RefSpec specA = new RefSpec("+refs/heads/a:refs/heads/b");
     RefSpec specC = new RefSpec("+refs/heads/c:refs/heads/d");
     ICollection<RefSpec> specs = Arrays.AsList(specA, specC);
     ICollection<RemoteRefUpdate> result = transport.FindRemoteRefUpdatesFor(specs);
     NUnit.Framework.Assert.AreEqual(2, result.Count);
     bool foundA = false;
     bool foundC = false;
     foreach (RemoteRefUpdate rru in result)
     {
         if ("refs/heads/a".Equals(rru.GetSrcRef()) && "refs/heads/b".Equals(rru.GetRemoteName
             ()))
         {
             foundA = true;
         }
         if ("refs/heads/c".Equals(rru.GetSrcRef()) && "refs/heads/d".Equals(rru.GetRemoteName
             ()))
         {
             foundC = true;
         }
     }
     NUnit.Framework.Assert.IsTrue(foundA);
     NUnit.Framework.Assert.IsTrue(foundC);
 }
Ejemplo n.º 7
0
 public virtual void TestFindRemoteRefUpdatesTrackingRef()
 {
     remoteConfig.AddFetchRefSpec(new RefSpec("refs/heads/*:refs/remotes/test/*"));
     transport = NGit.Transport.Transport.Open(db, remoteConfig);
     ICollection<RemoteRefUpdate> result = transport.FindRemoteRefUpdatesFor(Sharpen.Collections
         .NCopies(1, new RefSpec("+refs/heads/a:refs/heads/a")));
     NUnit.Framework.Assert.AreEqual(1, result.Count);
     TrackingRefUpdate tru = result.Iterator().Next().GetTrackingRefUpdate();
     NUnit.Framework.Assert.AreEqual("refs/remotes/test/a", tru.GetLocalName());
     NUnit.Framework.Assert.AreEqual("refs/heads/a", tru.GetRemoteName());
     NUnit.Framework.Assert.AreEqual(db.Resolve("refs/heads/a"), tru.GetNewObjectId());
     NUnit.Framework.Assert.AreEqual(ObjectId.ZeroId, tru.GetOldObjectId());
 }
Ejemplo n.º 8
0
 public virtual void TestFindRemoteRefUpdatesNoWildcardNoTracking()
 {
     transport = NGit.Transport.Transport.Open(db, remoteConfig);
     ICollection<RemoteRefUpdate> result = transport.FindRemoteRefUpdatesFor(Collections
         .NCopies(1, new RefSpec("refs/heads/master:refs/heads/x")));
     NUnit.Framework.Assert.AreEqual(1, result.Count);
     RemoteRefUpdate rru = result.Iterator().Next();
     NUnit.Framework.Assert.IsNull(rru.GetExpectedOldObjectId());
     NUnit.Framework.Assert.IsFalse(rru.IsForceUpdate());
     NUnit.Framework.Assert.AreEqual("refs/heads/master", rru.GetSrcRef());
     NUnit.Framework.Assert.AreEqual(db.Resolve("refs/heads/master"), rru.GetNewObjectId
         ());
     NUnit.Framework.Assert.AreEqual("refs/heads/x", rru.GetRemoteName());
 }