當前位置: 首頁>>代碼示例>>C#>>正文


C# AnyObjectId.ToObjectId方法代碼示例

本文整理匯總了C#中AnyObjectId.ToObjectId方法的典型用法代碼示例。如果您正苦於以下問題:C# AnyObjectId.ToObjectId方法的具體用法?C# AnyObjectId.ToObjectId怎麽用?C# AnyObjectId.ToObjectId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AnyObjectId的用法示例。


在下文中一共展示了AnyObjectId.ToObjectId方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: include

 public void include(string name, AnyObjectId id)
 {
     if (!Repository.IsValidRefName(name))
         throw new ArgumentException("Invalid ref name: " + name, "name");
     if (includeObjects.ContainsKey(name))
         throw new ApplicationException("Duplicate ref: " + name);
     includeObjects.Add(name, id.ToObjectId());
 }
開發者ID:mneedham,項目名稱:GitSharp,代碼行數:8,代碼來源:BundleWriter.cs

示例2: reset

 /**
  * Reset this parser to walk through the given tree.
  *
  * @param repo
  *            repository to load the tree data from.
  * @param id
  *            identity of the tree being parsed; used only in exception
  *            messages if data corruption is found.
  * @param curs
  *            window cursor to use during repository access.
  * @throws MissingObjectException
  *             the object supplied is not available from the repository.
  * @throws IncorrectObjectTypeException
  *             the object supplied as an argument is not actually a tree and
  *             cannot be parsed as though it were a tree.
  * @throws IOException
  *             a loose object or pack file could not be read.
  */
 public void reset(Repository repo, AnyObjectId id, WindowCursor curs)
 {
     ObjectLoader ldr = repo.openObject(curs, id);
     if (ldr == null)
     {
         ObjectId me = id.ToObjectId();
         throw new MissingObjectException(me, Constants.TYPE_TREE);
     }
     byte[] subtreeData = ldr.getCachedBytes();
     if (ldr.getType() != Constants.OBJ_TREE)
     {
         ObjectId me = id.ToObjectId();
         throw new IncorrectObjectTypeException(me, Constants.TYPE_TREE);
     }
     reset(subtreeData);
 }
開發者ID:ArildF,項目名稱:GitSharp,代碼行數:34,代碼來源:CanonicalTreeParser.cs

示例3: addTree

 /**
  * Recursively add an entire tree into this builder.
  * <p>
  * If pathPrefix is "a/b" and the tree contains file "c" then the resulting
  * DirCacheEntry will have the path "a/b/c".
  * <p>
  * All entries are inserted at stage 0, therefore assuming that the
  * application will not insert any other paths with the same pathPrefix.
  *
  * @param pathPrefix
  *            UTF-8 encoded prefix to mount the tree's entries at. If the
  *            path does not end with '/' one will be automatically inserted
  *            as necessary.
  * @param stage
  *            stage of the entries when adding them.
  * @param db
  *            repository the tree(s) will be read from during recursive
  *            traversal. This must be the same repository that the resulting
  *            DirCache would be written out to (or used in) otherwise the
  *            caller is simply asking for deferred MissingObjectExceptions.
  * @param tree
  *            the tree to recursively add. This tree's contents will appear
  *            under <code>pathPrefix</code>. The ObjectId must be that of a
  *            tree; the caller is responsible for dereferencing a tag or
  *            commit (if necessary).
  * @throws IOException
  *             a tree cannot be read to iterate through its entries.
  */
 public void addTree(byte[] pathPrefix, int stage, Repository db, AnyObjectId tree)
 {
     var tw = new TreeWalk.TreeWalk(db);
     tw.reset();
     var curs = new WindowCursor();
     try
     {
         tw.addTree(new CanonicalTreeParser(pathPrefix, db, tree.ToObjectId(), curs));
     }
     finally
     {
         curs.release();
     }
     tw.setRecursive(true);
     if (tw.next())
     {
         DirCacheEntry newEntry = toEntry(stage, tw);
         beforeAdd(newEntry);
         fastAdd(newEntry);
         while (tw.next())
             fastAdd(toEntry(stage, tw));
     }
 }
開發者ID:gilran,項目名稱:GitSharp,代碼行數:51,代碼來源:DirCacheBuilder.cs

示例4: include

        /// <summary>
        /// Include an object (and everything reachable from it) in the bundle.
        /// </summary>
        /// <param name="name">
        /// name the recipient can discover this object as from the
        /// bundle's list of advertised refs . The name must be a valid
        /// ref format and must not have already been included in this
        /// bundle writer.
        /// </param>
        /// <param name="id">
        /// object to pack. Multiple refs may point to the same object.
        /// </param>
        public void include(String name, AnyObjectId id)
        {
            if (id == null)
                throw new ArgumentNullException("id");
            if (!Repository.IsValidRefName(name))
            {
                throw new ArgumentException("Invalid ref name: " + name);
            }

            if (_include.ContainsKey(name))
            {
                throw new InvalidOperationException("Duplicate ref: " + name);
            }

            _include.put(name, id.ToObjectId());
        }
開發者ID:spraints,項目名稱:GitSharp,代碼行數:28,代碼來源:BundleWriter.cs

示例5: setOldObjectId

 public static void setOldObjectId(this RefUpdate refUpdate, AnyObjectId id)
 {
     refUpdate.OldObjectId = id != null ? id.ToObjectId() : null; ;
 }
開發者ID:cocytus,項目名稱:Git-Source-Control-Provider,代碼行數:4,代碼來源:RefUpdate.cs


注:本文中的AnyObjectId.ToObjectId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。