• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# NGit.ProgressMonitor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中NGit.ProgressMonitor的典型用法代码示例。如果您正苦于以下问题:C# ProgressMonitor类的具体用法?C# ProgressMonitor怎么用?C# ProgressMonitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ProgressMonitor类属于NGit命名空间,在下文中一共展示了ProgressMonitor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ProgressReportingFilter

			public ProgressReportingFilter(ProgressMonitor monitor, int total)
			{
				this.monitor = monitor;
				this.total = total;
				stepSize = total / 100;
				if (stepSize == 0)
				{
					stepSize = 1000;
				}
			}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:10,代码来源:IndexDiff.cs


示例2: ProgressReportingFilter

			public ProgressReportingFilter(IndexDiff _enclosing, ProgressMonitor monitor, int
				 total)
			{
				this._enclosing = _enclosing;
				this.monitor = monitor;
				this.total = total;
				this.stepSize = total / 100;
				if (this.stepSize == 0)
				{
					this.stepSize = 1000;
				}
			}
开发者ID:stewartwhaley,项目名称:monodevelop,代码行数:12,代码来源:IndexDiff.cs


示例3: BaseSearch

		internal BaseSearch(ProgressMonitor countingMonitor, ICollection<RevTree> bases, 
			ObjectIdOwnerMap<ObjectToPack> objects, IList<ObjectToPack> edges, ObjectReader 
			or)
		{
			progress = countingMonitor;
			reader = or;
			baseTrees = Sharpen.Collections.ToArray(bases, new ObjectId[bases.Count]);
			objectsMap = objects;
			edgeObjects = edges;
			alreadyProcessed = new IntSet();
			treeCache = new ObjectIdOwnerMap<BaseSearch.TreeWithData>();
			parser = new CanonicalTreeParser();
			idBuf = new MutableObjectId();
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:14,代码来源:BaseSearch.cs


示例4: WriteFile

		/// <summary>Open a remote file for writing.</summary>
		/// <remarks>
		/// Open a remote file for writing.
		/// <p>
		/// Path may start with <code>../</code> to request writing of a file that
		/// resides in the repository itself.
		/// <p>
		/// The requested path may or may not exist. If the path already exists as a
		/// file the file should be truncated and completely replaced.
		/// <p>
		/// This method creates any missing parent directories, if necessary.
		/// </remarks>
		/// <param name="path">
		/// name of the file to write, relative to the current object
		/// database.
		/// </param>
		/// <returns>
		/// stream to write into this file. Caller must close the stream to
		/// complete the write request. The stream is not buffered and each
		/// write may cause a network request/response so callers should
		/// buffer to smooth out small writes.
		/// </returns>
		/// <param name="monitor">
		/// (optional) progress monitor to post write completion to during
		/// the stream's close method.
		/// </param>
		/// <param name="monitorTask">(optional) task name to display during the close method.
		/// 	</param>
		/// <exception cref="System.IO.IOException">
		/// writing is not supported, or attempting to write the file
		/// failed, possibly due to permissions or remote disk full, etc.
		/// </exception>
		internal virtual OutputStream WriteFile(string path, ProgressMonitor monitor, string
			 monitorTask)
		{
			throw new IOException(MessageFormat.Format(JGitText.Get().writingNotSupported, path
				));
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:38,代码来源:WalkRemoteObjectDatabase.cs


示例5: Search

        /// <exception cref="System.IO.IOException"></exception>
        internal virtual void Search(ProgressMonitor monitor, ObjectToPack[] toSearch, int
			 off, int cnt)
        {
            try
            {
                for (int end = off + cnt; off < end; off++)
                {
                    res = window[resSlot];
                    if (0 < maxMemory)
                    {
                        Clear(res);
                        int tail = Next(resSlot);
                        long need = EstimateSize(toSearch[off]);
                        while (maxMemory < loaded + need && tail != resSlot)
                        {
                            Clear(window[tail]);
                            tail = Next(tail);
                        }
                    }
                    res.Set(toSearch[off]);
                    if ([email protected]())
                    {
                        // We don't actually want to make a delta for
                        // them, just need to push them into the window
                        // so they can be read by other objects.
                        //
                        KeepInWindow();
                    }
                    else
                    {
                        // Search for a delta for the current window slot.
                        //
                        monitor.Update(1);
                        Search();
                    }
                }
            }
            finally
            {
                if (deflater != null)
                {
                    deflater.Finish();
                }
            }
        }
开发者ID:sharwell,项目名称:ngit,代码行数:46,代码来源:DeltaWindow.cs


示例6: ResolveDeltas

		/// <exception cref="System.IO.IOException"></exception>
		private void ResolveDeltas(PackParser.DeltaVisit visit, int type, PackParser.ObjectTypeAndSize
			 info, ProgressMonitor progress)
		{
			do
			{
				progress.Update(1);
				info = OpenDatabase(visit.delta, info);
				switch (info.type)
				{
					case Constants.OBJ_OFS_DELTA:
					case Constants.OBJ_REF_DELTA:
					{
						break;
					}

					default:
					{
						throw new IOException(MessageFormat.Format(JGitText.Get().unknownObjectType, Sharpen.Extensions.ValueOf
							(info.type)));
					}
				}
				byte[] delta = InflateAndReturn(PackParser.Source.DATABASE, info.size);
				CheckIfTooLarge(type, BinaryDelta.GetResultSize(delta));
				visit.data = BinaryDelta.Apply(visit.parent.data, delta);
				delta = null;
				if (!CheckCRC(visit.delta.crc))
				{
					throw new IOException(MessageFormat.Format(JGitText.Get().corruptionDetectedReReadingAt
						, Sharpen.Extensions.ValueOf(visit.delta.position)));
				}
				objectDigest.Update(Constants.EncodedTypeString(type));
				objectDigest.Update(unchecked((byte)' '));
				objectDigest.Update(Constants.EncodeASCII(visit.data.Length));
				objectDigest.Update(unchecked((byte)0));
				objectDigest.Update(visit.data);
				tempObjectId.FromRaw(objectDigest.Digest(), 0);
				VerifySafeObject(tempObjectId, type, visit.data);
				PackedObjectInfo oe;
				oe = NewInfo(tempObjectId, visit.delta, visit.parent.id);
				oe.SetOffset(visit.delta.position);
				OnInflatedObjectData(oe, type, visit.data);
				AddObjectAndTrack(oe);
				visit.id = oe;
				visit.nextChild = FirstChildOf(oe);
				visit = visit.Next();
			}
			while (visit != null);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:49,代码来源:PackParser.cs


示例7: Parse

		/// <summary>Parse the pack stream.</summary>
		/// <remarks>Parse the pack stream.</remarks>
		/// <param name="progress">
		/// callback to provide progress feedback during parsing. If null,
		/// <see cref="NGit.NullProgressMonitor">NGit.NullProgressMonitor</see>
		/// will be used.
		/// </param>
		/// <returns>
		/// the pack lock, if one was requested by setting
		/// <see cref="SetLockMessage(string)">SetLockMessage(string)</see>
		/// .
		/// </returns>
		/// <exception cref="System.IO.IOException">the stream is malformed, or contains corrupt objects.
		/// 	</exception>
		public PackLock Parse(ProgressMonitor progress)
		{
			return Parse(progress, progress);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:18,代码来源:PackParser.cs


示例8: Fetch

        /// <summary>Fetch objects and refs from the remote repository to the local one.</summary>
        /// <remarks>
        /// Fetch objects and refs from the remote repository to the local one.
        /// <p>
        /// This is a utility function providing standard fetch behavior. Local
        /// tracking refs associated with the remote repository are automatically
        /// updated if this transport was created from a
        /// <see cref="RemoteConfig">RemoteConfig</see>
        /// with
        /// fetch RefSpecs defined.
        /// </remarks>
        /// <param name="monitor">
        /// progress monitor to inform the user about our processing
        /// activity. Must not be null. Use
        /// <see cref="NGit.NullProgressMonitor">NGit.NullProgressMonitor</see>
        /// if
        /// progress updates are not interesting or necessary.
        /// </param>
        /// <param name="toFetch">
        /// specification of refs to fetch locally. May be null or the
        /// empty collection to use the specifications from the
        /// RemoteConfig. Source for each RefSpec can't be null.
        /// </param>
        /// <returns>information describing the tracking refs updated.</returns>
        /// <exception cref="System.NotSupportedException">
        /// this transport implementation does not support fetching
        /// objects.
        /// </exception>
        /// <exception cref="NGit.Errors.TransportException">
        /// the remote connection could not be established or object
        /// copying (if necessary) failed or update specification was
        /// incorrect.
        /// </exception>
        public virtual FetchResult Fetch(ProgressMonitor monitor, ICollection<RefSpec> toFetch
			)
        {
            if (toFetch == null || toFetch.IsEmpty())
            {
                // If the caller did not ask for anything use the defaults.
                //
                if (fetch.IsEmpty())
                {
                    throw new TransportException(JGitText.Get().nothingToFetch);
                }
                toFetch = fetch;
            }
            else
            {
                if (!fetch.IsEmpty())
                {
                    // If the caller asked for something specific without giving
                    // us the local tracking branch see if we can update any of
                    // the local tracking branches without incurring additional
                    // object transfer overheads.
                    //
                    ICollection<RefSpec> tmp = new AList<RefSpec>(toFetch);
                    foreach (RefSpec requested in toFetch)
                    {
                        string reqSrc = requested.GetSource();
                        foreach (RefSpec configured in fetch)
                        {
                            string cfgSrc = configured.GetSource();
                            string cfgDst = configured.GetDestination();
                            if (cfgSrc.Equals(reqSrc) && cfgDst != null)
                            {
                                tmp.AddItem(configured);
                                break;
                            }
                        }
                    }
                    toFetch = tmp;
                }
            }
            FetchResult result = new FetchResult();
            new FetchProcess(this, toFetch).Execute(monitor, result);
            return result;
        }
开发者ID:kenji-tan,项目名称:ngit,代码行数:77,代码来源:Transport.cs


示例9: DoFetch

		/// <exception cref="NGit.Errors.TransportException"></exception>
		protected internal override void DoFetch(ProgressMonitor monitor, ICollection<Ref
			> want, ICollection<ObjectId> have)
		{
			MarkLocalRefsComplete(have);
			QueueWants(want);
			while (!monitor.IsCancelled() && !workQueue.IsEmpty())
			{
				ObjectId id = workQueue.RemoveFirst();
				if (!(id is RevObject) || !((RevObject)id).Has(COMPLETE))
				{
					DownloadObject(monitor, id);
				}
				Process(id);
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:16,代码来源:WalkFetchConnection.cs


示例10: DownloadPack

			/// <exception cref="System.IO.IOException"></exception>
			internal virtual void DownloadPack(ProgressMonitor monitor)
			{
				string name = "pack/" + this.packName;
				WalkRemoteObjectDatabase.FileStream s = this.connection.Open(name);
				PackParser parser = this._enclosing.inserter.NewPackParser([email protected]);
				parser.SetAllowThin(false);
				parser.SetObjectChecker(this._enclosing.objCheck);
				parser.SetLockMessage(this._enclosing.lockMessage);
				PackLock Lock = parser.Parse(monitor);
				if (Lock != null)
				{
					this._enclosing.packLocks.AddItem(Lock);
				}
				this._enclosing.inserter.Flush();
			}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:16,代码来源:WalkFetchConnection.cs


示例11: OpenIndex

			/// <exception cref="System.IO.IOException"></exception>
			internal virtual void OpenIndex(ProgressMonitor pm)
			{
				if (this.index != null)
				{
					return;
				}
				if (this.tmpIdx == null)
				{
					this.tmpIdx = FilePath.CreateTempFile("jgit-walk-", ".idx");
				}
				else
				{
					if (this.tmpIdx.IsFile())
					{
						try
						{
							this.index = PackIndex.Open(this.tmpIdx);
							return;
						}
						catch (FileNotFoundException)
						{
						}
					}
				}
				// Fall through and get the file.
				WalkRemoteObjectDatabase.FileStream s;
				s = this.connection.Open("pack/" + this.idxName);
				pm.BeginTask("Get " + Sharpen.Runtime.Substring(this.idxName, 0, 12) + "..idx", s
					.length < 0 ? ProgressMonitor.UNKNOWN : (int)(s.length / 1024));
				try
				{
					FileOutputStream fos = new FileOutputStream(this.tmpIdx);
					try
					{
						byte[] buf = new byte[2048];
						int cnt;
						while (!pm.IsCancelled() && (cnt = [email protected](buf)) >= 0)
						{
							fos.Write(buf, 0, cnt);
							pm.Update(cnt / 1024);
						}
					}
					finally
					{
						fos.Close();
					}
				}
				catch (IOException err)
				{
					FileUtils.Delete(this.tmpIdx);
					throw;
				}
				finally
				{
					[email protected]();
				}
				pm.EndTask();
				if (pm.IsCancelled())
				{
					FileUtils.Delete(this.tmpIdx);
					return;
				}
				try
				{
					this.index = PackIndex.Open(this.tmpIdx);
				}
				catch (IOException e)
				{
					FileUtils.Delete(this.tmpIdx);
					throw;
				}
			}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:73,代码来源:WalkFetchConnection.cs


示例12: WriteFile

			/// <exception cref="System.IO.IOException"></exception>
			internal override OutputStream WriteFile(string path, ProgressMonitor monitor, string
				 monitorTask)
			{
				return this._enclosing.s3.BeginPut(this._enclosing.bucket, this.ResolveKey(path), 
					monitor, monitorTask);
			}
开发者ID:nickname100,项目名称:monodevelop,代码行数:7,代码来源:TransportAmazonS3.cs


示例13: ResolveDeltas

		// By default there is no locking.
		/// <exception cref="System.IO.IOException"></exception>
		private void ResolveDeltas(ProgressMonitor progress)
		{
			progress.BeginTask(JGitText.Get().resolvingDeltas, deltaCount);
			int last = entryCount;
			for (int i = 0; i < last; i++)
			{
				int before = entryCount;
				ResolveDeltas(entries[i]);
				progress.Update(entryCount - before);
				if (progress.IsCancelled())
				{
					throw new IOException(JGitText.Get().downloadCancelledDuringIndexing);
				}
			}
			progress.EndTask();
		}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:18,代码来源:PackParser.cs


示例14: SideBandInputStream

		internal SideBandInputStream(InputStream @in, ProgressMonitor progress, TextWriter
			 messageStream)
		{
			rawIn = @in;
			pckIn = new PacketLineIn(rawIn);
			monitor = progress;
			messages = messageStream;
			currentTask = string.Empty;
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:9,代码来源:SideBandInputStream.cs


示例15: Push

			// nothing here
			/// <exception cref="NGit.Errors.TransportException"></exception>
			public virtual void Push(ProgressMonitor monitor, IDictionary<string, RemoteRefUpdate
				> refsToUpdate)
			{
				foreach (RemoteRefUpdate rru in refsToUpdate.Values)
				{
					NUnit.Framework.Assert.AreEqual(RemoteRefUpdate.Status.NOT_ATTEMPTED, rru.GetStatus
						());
					rru.SetStatus(this._enclosing.connectionUpdateStatus);
				}
			}
开发者ID:shoff,项目名称:ngit,代码行数:12,代码来源:PushProcessTest.cs


示例16: Diff

		/// <summary>Run the diff operation.</summary>
		/// <remarks>
		/// Run the diff operation. Until this is called, all lists will be empty.
		/// <p>
		/// The operation may be aborted by the progress monitor. In that event it
		/// will report what was found before the cancel operation was detected.
		/// Callers should ignore the result if monitor.isCancelled() is true. If a
		/// progress monitor is not needed, callers should use
		/// <see cref="Diff()">Diff()</see>
		/// instead. Progress reporting is crude and approximate and only intended
		/// for informing the user.
		/// </remarks>
		/// <param name="monitor">for reporting progress, may be null</param>
		/// <param name="estWorkTreeSize">number or estimated files in the working tree</param>
		/// <param name="estIndexSize">number of estimated entries in the cache</param>
		/// <param name="title"></param>
		/// <returns>if anything is different between index, tree, and workdir</returns>
		/// <exception cref="System.IO.IOException">System.IO.IOException</exception>
		public virtual bool Diff(ProgressMonitor monitor, int estWorkTreeSize, int estIndexSize
			, string title)
		{
			dirCache = repository.ReadDirCache();
			TreeWalk treeWalk = new TreeWalk(repository);
			treeWalk.Recursive = true;
			// add the trees (tree, dirchache, workdir)
			if (tree != null)
			{
				treeWalk.AddTree(tree);
			}
			else
			{
				treeWalk.AddTree(new EmptyTreeIterator());
			}
			treeWalk.AddTree(new DirCacheIterator(dirCache));
			treeWalk.AddTree(initialWorkingTreeIterator);
			ICollection<TreeFilter> filters = new AList<TreeFilter>(4);
			if (monitor != null)
			{
				// Get the maximum size of the work tree and index
				// and add some (quite arbitrary)
				if (estIndexSize == 0)
				{
					estIndexSize = dirCache.GetEntryCount();
				}
				int total = Math.Max(estIndexSize * 10 / 9, estWorkTreeSize * 10 / 9);
				monitor.BeginTask(title, total);
				filters.AddItem(new IndexDiff.ProgressReportingFilter(monitor, total));
			}
			if (filter != null)
			{
				filters.AddItem(filter);
			}
			filters.AddItem(new SkipWorkTreeFilter(INDEX));
			filters.AddItem(new IndexDiffFilter(INDEX, WORKDIR));
			treeWalk.Filter = AndTreeFilter.Create(filters);
			while (treeWalk.Next())
			{
				AbstractTreeIterator treeIterator = treeWalk.GetTree<AbstractTreeIterator>(TREE);
				DirCacheIterator dirCacheIterator = treeWalk.GetTree<DirCacheIterator>(INDEX);
				WorkingTreeIterator workingTreeIterator = treeWalk.GetTree<WorkingTreeIterator>(WORKDIR
					);
				if (treeIterator != null)
				{
					if (dirCacheIterator != null)
					{
						if (!treeIterator.IdEqual(dirCacheIterator) || treeIterator.EntryRawMode != dirCacheIterator
							.EntryRawMode)
						{
							// in repo, in index, content diff => changed
							changed.AddItem(treeWalk.PathString);
						}
					}
					else
					{
						// in repo, not in index => removed
						removed.AddItem(treeWalk.PathString);
						if (workingTreeIterator != null)
						{
							untracked.AddItem(treeWalk.PathString);
						}
					}
				}
				else
				{
					if (dirCacheIterator != null)
					{
						// not in repo, in index => added
						added.AddItem(treeWalk.PathString);
					}
					else
					{
						// not in repo, not in index => untracked
						if (workingTreeIterator != null && !workingTreeIterator.IsEntryIgnored())
						{
							untracked.AddItem(treeWalk.PathString);
						}
					}
				}
				if (dirCacheIterator != null)
				{
//.........这里部分代码省略.........
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:101,代码来源:IndexDiff.cs


示例17: DownloadObject

		/// <exception cref="NGit.Errors.TransportException"></exception>
		private void DownloadObject(ProgressMonitor pm, AnyObjectId id)
		{
			if (AlreadyHave(id))
			{
				return;
			}
			for (; ; )
			{
				// Try a pack file we know about, but don't have yet. Odds are
				// that if it has this object, it has others related to it so
				// getting the pack is a good bet.
				//
				if (DownloadPackedObject(pm, id))
				{
					return;
				}
				// Search for a loose object over all alternates, starting
				// from the one we last successfully located an object through.
				//
				string idStr = id.Name;
				string subdir = Sharpen.Runtime.Substring(idStr, 0, 2);
				string file = Sharpen.Runtime.Substring(idStr, 2);
				string looseName = subdir + "/" + file;
				for (int i = lastRemoteIdx; i < remotes.Count; i++)
				{
					if (DownloadLooseObject(id, looseName, remotes[i]))
					{
						lastRemoteIdx = i;
						return;
					}
				}
				for (int i_1 = 0; i_1 < lastRemoteIdx; i_1++)
				{
					if (DownloadLooseObject(id, looseName, remotes[i_1]))
					{
						lastRemoteIdx = i_1;
						return;
					}
				}
				// Try to obtain more pack information and search those.
				//
				while (!noPacksYet.IsEmpty())
				{
					WalkRemoteObjectDatabase wrr = noPacksYet.RemoveFirst();
					ICollection<string> packNameList;
					try
					{
						pm.BeginTask("Listing packs", ProgressMonitor.UNKNOWN);
						packNameList = wrr.GetPackNames();
					}
					catch (IOException e)
					{
						// Try another repository.
						//
						RecordError(id, e);
						continue;
					}
					finally
					{
						pm.EndTask();
					}
					if (packNameList == null || packNameList.IsEmpty())
					{
						continue;
					}
					foreach (string packName in packNameList)
					{
						if (packsConsidered.AddItem(packName))
						{
							unfetchedPacks.AddItem(new WalkFetchConnection.RemotePack(this, wrr, packName));
						}
					}
					if (DownloadPackedObject(pm, id))
					{
						return;
					}
				}
				// Try to expand the first alternate we haven't expanded yet.
				//
				ICollection<WalkRemoteObjectDatabase> al = ExpandOneAlternate(id, pm);
				if (al != null && !al.IsEmpty())
				{
					foreach (WalkRemoteObjectDatabase alt in al)
					{
						remotes.AddItem(alt);
						noPacksYet.AddItem(alt);
						noAlternatesYet.AddItem(alt);
					}
					continue;
				}
				// We could not obtain the object. There may be reasons why.
				//
				IList<Exception> failures = fetchErrors.Get((ObjectId)id);
				TransportException te;
				te = new TransportException(MessageFormat.Format(JGitText.Get().cannotGet, id.Name
					));
				if (failures != null && !failures.IsEmpty())
				{
					if (failures.Count == 1)
//.........这里部分代码省略.........
开发者ID:yayanyang,项目名称:monodevelop,代码行数:101,代码来源:WalkFetchConnection.cs


示例18: Push

        /// <summary>Push objects and refs from the local repository to the remote one.</summary>
        /// <remarks>
        /// Push objects and refs from the local repository to the remote one.
        /// <p>
        /// This is a utility function providing standard push behavior. It updates
        /// remote refs and send there necessary objects according to remote ref
        /// update specification. After successful remote ref update, associated
        /// locally stored tracking branch is updated if set up accordingly. Detailed
        /// operation result is provided after execution.
        /// <p>
        /// For setting up remote ref update specification from ref spec, see helper
        /// method
        /// <see cref="FindRemoteRefUpdatesFor(System.Collections.Generic.ICollection{E})">FindRemoteRefUpdatesFor(System.Collections.Generic.ICollection&lt;E&gt;)
        /// 	</see>
        /// , predefined refspecs
        /// (
        /// <see cref="REFSPEC_TAGS">REFSPEC_TAGS</see>
        /// ,
        /// <see cref="REFSPEC_PUSH_ALL">REFSPEC_PUSH_ALL</see>
        /// ) or consider using
        /// directly
        /// <see cref="RemoteRefUpdate">RemoteRefUpdate</see>
        /// for more possibilities.
        /// <p>
        /// When
        /// <see cref="IsDryRun()">IsDryRun()</see>
        /// is true, result of this operation is just
        /// estimation of real operation result, no real action is performed.
        /// </remarks>
        /// <seealso cref="RemoteRefUpdate">RemoteRefUpdate</seealso>
        /// <param name="monitor">
        /// progress monitor to inform the user about our processing
        /// activity. Must not be null. Use
        /// <see cref="NGit.NullProgressMonitor">NGit.NullProgressMonitor</see>
        /// if
        /// progress updates are not interesting or necessary.
        /// </param>
        /// <param name="toPush">
        /// specification of refs to push. May be null or the empty
        /// collection to use the specifications from the RemoteConfig
        /// converted by
        /// <see cref="FindRemoteRefUpdatesFor(System.Collections.Generic.ICollection{E})">FindRemoteRefUpdatesFor(System.Collections.Generic.ICollection&lt;E&gt;)
        /// 	</see>
        /// . No
        /// more than 1 RemoteRefUpdate with the same remoteName is
        /// allowed. These objects are modified during this call.
        /// </param>
        /// <returns>
        /// information about results of remote refs updates, tracking refs
        /// updates and refs advertised by remote repository.
        /// </returns>
        /// <exception cref="System.NotSupportedException">
        /// this transport implementation does not support pushing
        /// objects.
        /// </exception>
        /// <exception cref="NGit.Errors.TransportException">
        /// the remote connection could not be established or object
        /// copying (if necessary) failed at I/O or protocol level or
        /// update specification was incorrect.
        /// </exception>
        public virtual PushResult Push(ProgressMonitor monitor, ICollection<RemoteRefUpdate
			> toPush)
        {
            if (toPush == null || toPush.IsEmpty())
            {
                // If the caller did not ask for anything use the defaults.
                try
                {
                    toPush = FindRemoteRefUpdatesFor(push);
                }
                catch (IOException e)
                {
                    throw new TransportException(MessageFormat.Format(JGitText.Get().problemWithResolvingPushRefSpecsLocally
                        , e.Message), e);
                }
                if (toPush.IsEmpty())
                {
                    throw new TransportException(JGitText.Get().nothingToPush);
                }
            }
            PushProcess pushProcess = new PushProcess(this, toPush);
            return pushProcess.Execute(monitor);
        }
开发者ID:kenji-tan,项目名称:ngit,代码行数:83,代码来源:Transport.cs


示例19: DownloadPackedObject

		/// <exception cref="NGit.Errors.TransportException"></exception>
		private bool DownloadPackedObject(ProgressMonitor monitor, AnyObjectId id)
		{
			// Search for the object in a remote pack whose index we have,
			// but whose pack we do not yet have.
			//
			Iterator<WalkFetchConnection.RemotePack> packItr = unfetchedPacks.Iterator();
			while (packItr.HasNext() && !monitor.IsCancelled())
			{
				WalkFetchConnection.RemotePack pack = packItr.Next();
				try
				{
					pack.OpenIndex(monitor);
				}
				catch (IOException err)
				{
					// If the index won't open its either not found or
					// its a format we don't recognize. In either case
					// we may still be able to obtain the object from
					// another source, so don't consider it a failure.
					//
					RecordError(id, err);
					packItr.Remove();
					continue;
				}
				if (monitor.IsCancelled())
				{
					// If we were cancelled while the index was opening
					// the open may have aborted. We can't search an
					// unopen index.
					//
					return false;
				}
				if (!pack.index.HasObject(id))
				{
					// Not in this pack? Try another.
					//
					continue;
				}
				// It should be in the associated pack. Download that
				// and attach it to the local repository so we can use
				// all of the contained objects.
				//
				try
				{
					pack.DownloadPack(monitor);
				}
				catch (IOException err)
				{
					// If the pack failed to download, index correctly,
					// or open in the local repository we may still be
					// able to obtain this object from another pack or
					// an alternate.
					//
					RecordError(id, err);
					continue;
				}
				finally
				{
					// If the pack was good its in the local repository
					// and Repository.hasObject(id) will succeed in the
					// future, so we do not need this data anymore. If
					// it failed the index and pack are unusable and we
					// shouldn't consult them again.
					//
					try
					{
						if (pack.tmpIdx != null)
						{
							FileUtils.Delete(pack.tmpIdx);
						}
					}
					catch (IOException e)
					{
						throw new TransportException(e.Message, e);
					}
					packItr.Remove();
				}
				if (!AlreadyHave(id))
				{
					// What the hell? This pack claimed to have
					// the object, but after indexing we didn't
					// actually find it in the pack.
					//
					RecordError(id, new FileNotFoundException(MessageFormat.Format(JGitText.Get().objectNotFoundIn
						, id.Name, pack.packName)));
					continue;
				}
				// Complete any other objects that we can.
				//
				Iterator<ObjectId> pending = SwapFetchQueue();
				while (pending.HasNext())
				{
					ObjectId p = pending.Next();
					if (pack.index.HasObject(p))
					{
						pending.Remove();
						Process(p);
					}
					else
//.........这里部分代码省略.........
开发者ID:yayanyang,项目名称:monodevelop,代码行数:101,代码来源:WalkFetchConnection.cs


示例20: Execute

		/// <summary>Execute this batch update.</summary>
		/// <remarks>
		/// Execute this batch update.
		/// <p>
		/// The default implementation of this method performs a sequential reference
		/// update over each reference.
		/// </remarks>
		/// <param name="walk">
		/// a RevWalk to parse tags in case the storage system wants to
		/// store them pre-peeled, a common performance optimization.
		/// </param>
		/// <param name="update">progress monitor to receive update status on.</param>
		/// <exception cref="System.IO.IOException">
		/// the database is unable to accept the update. Individual
		/// command status must be tested to determine if there is a
		/// partial failure, or a total failure.
		/// </exception>
		public virtual void Execute(RevWalk walk, ProgressMonitor update)
		{
			update.BeginTask(JGitText.Get().updatingReferences, commands.Count);
			foreach (ReceiveCommand cmd in commands)
			{
				try
				{
					update.Update(1);
					if (cmd.GetResult() == ReceiveCommand.Result.NOT_ATTEMPTED)
					{
						cmd.UpdateType(walk);
						RefUpdate ru = NewUpdate(cmd);
						switch (cmd.GetType())
						{
							case ReceiveCommand.Type.DELETE:
							{
								cmd.SetResult(ru.Delete(walk));
								continue;
								goto case ReceiveCommand.Type.CREATE;
							}

							case ReceiveCommand.Type.CREATE:
							case ReceiveCommand.Type.UPDATE:
							case ReceiveCommand.Type.UPDATE_NONFASTFORWARD:
							{
								cmd.SetResult(ru.Update(walk));
								continue;
							}
						}
					}
				}
				catch (IOException err)
				{
					cmd.SetResult(ReceiveCommand.Result.REJECTED_OTHER_REASON, MessageFormat.Format(JGitText
						.Get().lockError, err.Message));
				}
			}
			update.EndTask();
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:56,代码来源:BatchRefUpdate.cs



注:本文中的NGit.ProgressMonitor类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NGit.Tree类代码示例发布时间:2022-05-26
下一篇:
C# NGit.ObjectId类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap