当前位置: 首页>>代码示例>>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;未经允许,请勿转载。