public virtual void TestFilterHidesPrivate()
        {
            IDictionary <string, Ref> refs;
            TransportLocal            t = new _TransportLocal_147(this, src, UriOf(dst), dst.Directory);

            try
            {
                PushConnection c = t.OpenPush();
                try
                {
                    refs = c.GetRefsMap();
                }
                finally
                {
                    c.Close();
                }
            }
            finally
            {
                t.Close();
            }
            NUnit.Framework.Assert.IsNotNull(refs);
            NUnit.Framework.Assert.IsNull(refs.Get(R_PRIVATE), "no private");
            NUnit.Framework.Assert.IsNull(refs.Get(Constants.HEAD), "no HEAD");
            NUnit.Framework.Assert.AreEqual(1, refs.Count);
            Ref master = refs.Get(R_MASTER);

            NUnit.Framework.Assert.IsNotNull(master, "has master");
            NUnit.Framework.Assert.AreEqual(B, master.GetObjectId());
        }
Beispiel #2
0
 /// <summary>
 /// Perform push operation between local and remote repository - set remote
 /// refs appropriately, send needed objects and update local tracking refs.
 /// </summary>
 /// <remarks>
 /// Perform push operation between local and remote repository - set remote
 /// refs appropriately, send needed objects and update local tracking refs.
 /// <p>
 /// When
 /// <see cref="Transport.IsDryRun()">Transport.IsDryRun()</see>
 /// is true, result of this operation is
 /// just estimation of real operation result, no real action is performed.
 /// </remarks>
 /// <param name="monitor">progress monitor used for feedback about operation.</param>
 /// <returns>result of push operation with complete status description.</returns>
 /// <exception cref="System.NotSupportedException">when push operation is not supported by provided transport.
 ///     </exception>
 /// <exception cref="NGit.Errors.TransportException">
 /// when some error occurred during operation, like I/O, protocol
 /// error, or local database consistency error.
 /// </exception>
 internal virtual PushResult Execute(ProgressMonitor monitor)
 {
     try
     {
         monitor.BeginTask(PROGRESS_OPENING_CONNECTION, ProgressMonitor.UNKNOWN);
         PushResult res = new PushResult();
         connection = transport.OpenPush();
         try
         {
             res.SetAdvertisedRefs(transport.GetURI(), connection.GetRefsMap());
             res.SetRemoteUpdates(toPush);
             monitor.EndTask();
             IDictionary <string, RemoteRefUpdate> preprocessed = PrepareRemoteUpdates();
             if (transport.IsDryRun())
             {
                 ModifyUpdatesForDryRun();
             }
             else
             {
                 if (!preprocessed.IsEmpty())
                 {
                     connection.Push(monitor, preprocessed);
                 }
             }
         }
         finally
         {
             connection.Close();
             res.AddMessages(connection.GetMessages());
         }
         if (!transport.IsDryRun())
         {
             UpdateTrackingRefs();
         }
         foreach (RemoteRefUpdate rru in toPush.Values)
         {
             TrackingRefUpdate tru = rru.GetTrackingRefUpdate();
             if (tru != null)
             {
                 res.Add(tru);
             }
         }
         return(res);
     }
     finally
     {
         walker.Release();
     }
 }
Beispiel #3
0
		/// <summary>
		/// Perform push operation between local and remote repository - set remote
		/// refs appropriately, send needed objects and update local tracking refs.
		/// </summary>
		/// <remarks>
		/// Perform push operation between local and remote repository - set remote
		/// refs appropriately, send needed objects and update local tracking refs.
		/// <p>
		/// When
		/// <see cref="Transport.IsDryRun()">Transport.IsDryRun()</see>
		/// is true, result of this operation is
		/// just estimation of real operation result, no real action is performed.
		/// </remarks>
		/// <param name="monitor">progress monitor used for feedback about operation.</param>
		/// <returns>result of push operation with complete status description.</returns>
		/// <exception cref="System.NotSupportedException">when push operation is not supported by provided transport.
		/// 	</exception>
		/// <exception cref="NGit.Errors.TransportException">
		/// when some error occurred during operation, like I/O, protocol
		/// error, or local database consistency error.
		/// </exception>
		internal virtual PushResult Execute(ProgressMonitor monitor)
		{
			try
			{
				monitor.BeginTask(PROGRESS_OPENING_CONNECTION, ProgressMonitor.UNKNOWN);
				PushResult res = new PushResult();
				connection = transport.OpenPush();
				try
				{
					res.SetAdvertisedRefs(transport.GetURI(), connection.GetRefsMap());
					res.SetRemoteUpdates(toPush);
					monitor.EndTask();
					IDictionary<string, RemoteRefUpdate> preprocessed = PrepareRemoteUpdates();
					if (transport.IsDryRun())
					{
						ModifyUpdatesForDryRun();
					}
					else
					{
						if (!preprocessed.IsEmpty())
						{
							connection.Push(monitor, preprocessed);
						}
					}
				}
				finally
				{
					connection.Close();
					res.AddMessages(connection.GetMessages());
				}
				if (!transport.IsDryRun())
				{
					UpdateTrackingRefs();
				}
				foreach (RemoteRefUpdate rru in toPush.Values)
				{
					TrackingRefUpdate tru = rru.GetTrackingRefUpdate();
					if (tru != null)
					{
						res.Add(tru);
					}
				}
				return res;
			}
			finally
			{
				walker.Release();
			}
		}