当前位置: 首页>>代码示例>>C#>>正文


C# Repository.Dispose方法代码示例

本文整理汇总了C#中GitSharp.Core.Repository.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Repository.Dispose方法的具体用法?C# Repository.Dispose怎么用?C# Repository.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GitSharp.Core.Repository的用法示例。


在下文中一共展示了Repository.Dispose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

        /// <summary>
        /// Do it.
        /// </summary>
        public override void Execute()
        {
            if (Source.Length <= 0)
            {
                throw new ArgumentException("fatal: You must specify a repository to clone.");
            }

            if (Directory != null && GitDirectory != null)
            {
                throw new ArgumentException("conflicting usage of --git-dir and arguments");
            }

            var source = new URIish(Source);

            if (Directory == null)
            {
                try
                {
                    Directory = source.getHumanishName();
                }
                catch (InvalidOperationException e)
                {
                    throw new ArgumentException("cannot guess local name from " + source, e);
                }
            }

            if (GitDirectory == null)
            {
                GitDirectory = Path.Combine(Directory, Constants.DOT_GIT);
            }

            if (Mirror)
                Bare = true;
            if (Bare)
            {
                if (OriginName != null)
                    throw new ArgumentException("Bare+Origin", "--bare and --origin " + OriginName + " options are incompatible.");
                NoCheckout = true;
            }
            if (OriginName == null)
                OriginName = Constants.DEFAULT_REMOTE_NAME;

            if (System.IO.Directory.Exists(Directory) && System.IO.Directory.GetFileSystemEntries(Directory).Length != 0)
            {
                throw new InvalidOperationException(string.Format("destination path '{0}' already exists and is not an empty directory.", new DirectoryInfo(Directory).FullName));
            }

            var repo = new Core.Repository(new DirectoryInfo(GitDirectory));
            repo.Create(Bare);
            repo.Config.setBoolean("core", null, "bare", Bare);
            repo.Config.save();
            Repository = new Repository(repo);
            if (!Quiet)
            {
                OutputStream.WriteLine("Initialized empty Git repository in " + repo.Directory.FullName);
                OutputStream.Flush();
            }

            saveRemote(source);

            FetchResult r;
            try
            {
                r = runFetch();
            }
            catch (NoRemoteRepositoryException)
            {
                Repository.Dispose();
                throw;
            }
            GitSharp.Core.Ref branch = guessHEAD(r);
            if (!NoCheckout)
                doCheckout(branch);
        }
开发者ID:yolanother,项目名称:GitSharp,代码行数:77,代码来源:CloneCommand.cs

示例2: Execute

        /// <summary>
        /// Do it.
        /// </summary>
        public override void Execute()
        {
            if (Source.Length <= 0)
                throw new ArgumentNullException("Repository", "fatal: You must specify a repository to clone.");

            URIish source = new URIish(Source);

            if (Mirror)
                Bare = true;
            if (Bare)
            {
                if (OriginName != null)
                    throw new ArgumentException("Bare+Origin", "--bare and --origin " + OriginName + " options are incompatible.");
                NoCheckout = true;
            }
            if (OriginName == null)
                OriginName = Constants.DEFAULT_REMOTE_NAME;

            var repo = new GitSharp.Core.Repository(new DirectoryInfo(ActualDirectory));
            repo.Create(Bare);
            repo.Config.setBoolean("core", null, "bare", Bare);
            repo.Config.save();
            Repository = new Repository(repo);
            if (!Quiet)
            {
                OutputStream.WriteLine("Initialized empty Git repository in " + repo.Directory.FullName);
                OutputStream.Flush();
            }

            saveRemote(source);

            FetchResult r;
            try
            {
                r = runFetch();
            }
            catch (NoRemoteRepositoryException)
            {
                Repository.Dispose();
                throw;
            }
            GitSharp.Core.Ref branch = guessHEAD(r);
            if (!NoCheckout)
                doCheckout(branch);
        }
开发者ID:Flatlineato,项目名称:GitSharp,代码行数:48,代码来源:CloneCommand.cs


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