本文整理汇总了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);
}
示例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);
}