示例#1
0
        protected void doFetch(ProgressMonitor monitor, List <Ref> want, List <ObjectId> have)
        {
            try
            {
                MarkRefsAdvertised();
                MarkReachable(have, MaxTimeWanted(want));

                if (SendWants(want))
                {
                    Negotiate(monitor);

                    _walk.Dispose();
                    _reachableCommits = null;

                    ReceivePack(monitor);
                }
            }
            catch (CancelledException)
            {
                Close();
                return;
            }
            catch (IOException err)
            {
                Close();
                throw new TransportException(err.Message, err);
            }
        }
        protected void doFetch(ProgressMonitor monitor, ICollection <Ref> want, IList <ObjectId> have)
        {
            try
            {
                MarkRefsAdvertised();
                MarkReachable(have, MaxTimeWanted(want));

                if (SendWants(want))
                {
                    Negotiate(monitor);

                    _walk.Dispose();
                    _reachableCommits = null;

                    ReceivePack(monitor);
                }
            }
            catch (CancelledException)
            {
                Dispose();
                return; // Caller should test (or just know) this themselves.
            }
            catch (IOException err)
            {
                Dispose();
                throw new TransportException(err.Message, err);
            }
            catch (Exception err)
            {
                Dispose();
                throw new TransportException(err.Message, err);
            }
        }
示例#3
0
		/// <exception cref="System.Exception"></exception>
		public virtual void Setup(int count)
		{
			Git git = new Git(db);
			for (int i = 0; i < count; i++)
			{
				git.Commit().SetCommitter(committer).SetAuthor(author).SetMessage("commit " + i).
					Call();
			}
			list = new RevCommitList<RevCommit>();
			RevWalk w = new RevWalk(db);
			w.MarkStart(w.LookupCommit(db.Resolve(Constants.HEAD)));
			list.Source(w);
		}
        public BasePackFetchConnection(IPackTransport packTransport) : base(packTransport)
        {
            RepositoryConfig cfg = local.Config;
            includeTags = transport.TagOpt != TagOpt.NO_TAGS;
            thinPack = transport.FetchThin;
            allowOfsDelta = cfg.GetBoolean("repack", "usedeltabaseoffset", true);

            walk = new RevWalk.RevWalk(local);
            reachableCommits = new RevCommitList<RevCommit>();
            REACHABLE = walk.newFlag("REACHABLE");
            COMMON = walk.newFlag("COMMON");
            ADVERTISED = walk.newFlag("ADVERTISED");

            walk.carry(COMMON);
            walk.carry(REACHABLE);
            walk.carry(ADVERTISED);
        }
示例#5
0
 /// <summary>Create a new connection to fetch using the native git transport.</summary>
 /// <remarks>Create a new connection to fetch using the native git transport.</remarks>
 /// <param name="packTransport">the transport.</param>
 internal BasePackFetchConnection(PackTransport packTransport) : base(packTransport
                                                                      )
 {
     BasePackFetchConnection.FetchConfig cfg = local.GetConfig().Get(BasePackFetchConnection.FetchConfig
                                                                     .KEY);
     includeTags      = transport.GetTagOpt() != TagOpt.NO_TAGS;
     thinPack         = transport.IsFetchThin();
     allowOfsDelta    = cfg.allowOfsDelta;
     walk             = new RevWalk(local);
     reachableCommits = new RevCommitList <RevCommit>();
     REACHABLE        = walk.NewFlag("REACHABLE");
     COMMON           = walk.NewFlag("COMMON");
     STATE            = walk.NewFlag("STATE");
     ADVERTISED       = walk.NewFlag("ADVERTISED");
     walk.Carry(COMMON);
     walk.Carry(REACHABLE);
     walk.Carry(ADVERTISED);
 }
示例#6
0
        public BasePackFetchConnection(IPackTransport packTransport)
            : base(packTransport)
        {
            RepositoryConfig cfg = local.Config;

            _includeTags   = transport.TagOpt != TagOpt.NO_TAGS;
            _thinPack      = transport.FetchThin;
            _allowOfsDelta = cfg.getBoolean("repack", "usedeltabaseoffset", true);

            _walk             = new RevWalk.RevWalk(local);
            _reachableCommits = new RevCommitList <RevCommit>();
            REACHABLE         = _walk.newFlag("REACHABLE");
            COMMON            = _walk.newFlag("COMMON");
            ADVERTISED        = _walk.newFlag("ADVERTISED");

            _walk.carry(COMMON);
            _walk.carry(REACHABLE);
            _walk.carry(ADVERTISED);
        }
        public BasePackFetchConnection(IPackTransport packTransport)
            : base(packTransport)
        {
            FetchConfig cfg = local.Config.get(FetchConfig.KEY);

            _includeTags   = transport.TagOpt != TagOpt.NO_TAGS;
            _thinPack      = transport.FetchThin;
            _allowOfsDelta = cfg.AllowOfsDelta;

            _walk             = new RevWalk.RevWalk(local);
            _reachableCommits = new RevCommitList <RevCommit>();
            REACHABLE         = _walk.newFlag("REACHABLE");
            COMMON            = _walk.newFlag("COMMON");
            ADVERTISED        = _walk.newFlag("ADVERTISED");

            _walk.carry(COMMON);
            _walk.carry(REACHABLE);
            _walk.carry(ADVERTISED);
        }
示例#8
0
 /// <summary>Execute common ancestor negotiation and fetch the objects.</summary>
 /// <remarks>Execute common ancestor negotiation and fetch the objects.</remarks>
 /// <param name="monitor">progress monitor to receive status updates.</param>
 /// <param name="want">the advertised remote references the caller wants to fetch.</param>
 /// <param name="have">
 /// additional objects to assume that already exist locally. This
 /// will be added to the set of objects reachable from the
 /// destination repository's references.
 /// </param>
 /// <exception cref="NGit.Errors.TransportException">if any exception occurs.</exception>
 protected internal virtual void DoFetch(ProgressMonitor monitor, ICollection <Ref>
                                         want, ICollection <ObjectId> have)
 {
     try
     {
         MarkRefsAdvertised();
         MarkReachable(have, MaxTimeWanted(want));
         if (statelessRPC)
         {
             state    = new TemporaryBuffer.Heap(int.MaxValue);
             pckState = new PacketLineOut(state);
         }
         if (SendWants(want))
         {
             Negotiate(monitor);
             walk.Dispose();
             reachableCommits = null;
             state            = null;
             pckState         = null;
             ReceivePack(monitor);
         }
     }
     catch (BasePackFetchConnection.CancelledException)
     {
         Close();
         return;
     }
     catch (IOException err)
     {
         // Caller should test (or just know) this themselves.
         Close();
         throw new TransportException(err.Message, err);
     }
     catch (RuntimeException err)
     {
         Close();
         throw new TransportException(err.Message, err);
     }
 }
        protected void doFetch(ProgressMonitor monitor, List<Ref> want, List<ObjectId> have)
        {
            try
            {
                markRefsAdvertised();
                markReachable(have, maxTimeWanted(want));

                if (sendWants(want))
                {
                    negotiate(monitor);

                    walk.dispose();
                    reachableCommits = null;

                    receivePack(monitor);
                }
            }
            catch (CancelledException ce)
            {
                Close();
                return;
            }
            catch (IOException err)
            {
                Close();
                throw new TransportException(err.Message, err);
            }
        }