本文整理汇总了C#中GitSharp.Repository类的典型用法代码示例。如果您正苦于以下问题:C# Repository类的具体用法?C# Repository怎么用?C# Repository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Repository类属于GitSharp命名空间,在下文中一共展示了Repository类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Index
public ActionResult Index()
{
var dirs = Directory.GetDirectories(_settings.RepositoryRootPath);
var viewModel = new RepositoriesViewModel { List = new List<RepositoryViewModel>() };
foreach (string path in dirs)
{
var isValid = Repository.IsValid(path);
if (isValid)
{
using (var repo = new Repository(path))
{
viewModel.List.Add(new RepositoryViewModel
{
Name = repo.IsBare ? Path.GetFileName(repo.Directory.TrimGit())
: Path.GetFileName(path.TrimGit()),
Description = repo.Directory,
Path = repo.Directory,
CurrentCommit = repo.Branches["master"].CurrentCommit
});
}
}
}
return View(viewModel);
}
开发者ID:robertwilczynski,项目名称:GitPrise,代码行数:26,代码来源:HomeController.cs
示例2: LoadBackupList
public void LoadBackupList(WorldSave save)
{
backupView.Items.Clear();
if (!Repository.IsValid(save.Path))
return;
using (Repository repo = new Repository(save.Path))
{
foreach (Commit commit in repo.CurrentBranch.CurrentCommit.Ancestors)
{
DateTime commitTime = commit.CommitDate.LocalDateTime;
ListViewItem item = new ListViewItem(commit.Message);
ListViewItem.ListViewSubItem dateItem = item.SubItems.Add(
commitTime.ToString());
dateItem.Name = "date";
ListViewItem.ListViewSubItem hashItem =
item.SubItems.Add(commit.ShortHash);
hashItem.Name = "shorthash";
ListViewItem.ListViewSubItem longHashItem =
item.SubItems.Add(commit.Hash);
longHashItem.Name = "hash";
backupView.Items.Add(item);
}
}
}
开发者ID:Glought,项目名称:MultiMC,代码行数:30,代码来源:RestoreBackupDialog.cs
示例3: ReflogReader
/// <summary>
/// Parsed reflog entry.
/// </summary>
public ReflogReader(Repository db, string refName)
{
_logName = new FileInfo(
Path.Combine(
db.Directory.FullName,
Path.Combine("logs", refName)).Replace('/', Path.DirectorySeparatorChar));
}
开发者ID:drothmaler,项目名称:GitSharp,代码行数:10,代码来源:ReflogReader.cs
示例4: LoadRepository
private void LoadRepository()
{
if (!Directory.Exists(Path.Combine(ResourceLocation, ".git"))) {
Git.Init(ResourceLocation);
}
Repo = new Repository(ResourceLocation);
}
开发者ID:CloneDeath,项目名称:FantasyScape,代码行数:7,代码来源:ResourceManager.cs
示例5: SetupContext
protected void SetupContext()
{
_nicolai = new Author("Nicolai Meltveit", "[email protected]");
_repositoryUrl = "git://github.com/flyrev/Smeedee_dummy.git";
_localDirectory = "C:\\ennå_nyare\\";
_repo = new Repository(_localDirectory);
}
开发者ID:flyrev,项目名称:Smeedee_git_plugin,代码行数:7,代码来源:ChangesetRepositorySpecs.cs
示例6: ObjectWriter
/// <summary>
/// Construct an object writer for the specified repository.
/// </summary>
/// <param name="repo"> </param>
public ObjectWriter(Repository repo)
{
_r = repo;
_buf = new byte[0x2000];
_md = new MessageDigest();
_def = new Deflater(_r.Config.getCore().getCompression());
}
开发者ID:drothmaler,项目名称:GitSharp,代码行数:11,代码来源:ObjectWriter.cs
示例7: ObjectWriter
public ObjectWriter(Repository repo)
{
this.r = repo;
buf = new byte[8192];
md = new MessageDigest(); // [henon] Sha1 hash digest generator
def = new Deflater(r.Config.Core.Compression);
}
开发者ID:ArildF,项目名称:GitSharp,代码行数:7,代码来源:ObjectWriter.cs
示例8: Index
public Index(Repository repo)
{
_repo = repo;
//GitIndex.FilenameEncoding = repo.PreferredEncoding;
//if (_repo.PreferredEncoding != Encoding.UTF8 && _repo.PreferredEncoding != Encoding.Default)
// GitIndex.FilenameEncoding = Encoding.Default;
}
开发者ID:deodelacruz,项目名称:GitSharp,代码行数:7,代码来源:Index.cs
示例9: GetGitDetail
/// <summary>
/// TODO: only get GitDetail on Project level?
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public static GitDetail GetGitDetail(string path)
{
GitDetail detail = null;
if (string.IsNullOrEmpty(path)) return detail;
try
{
var repoPath = Repository.FindRepository(path);
if (string.IsNullOrEmpty(repoPath)) return detail;
var repo = new Repository(repoPath);
detail = new GitDetail();
// Convert to forward slash
detail.LocalWorkingDirectory = repo.WorkingDirectory.BackSlashToForwardSlash();
if (repo.Head == null) return detail;
var branch = repo.CurrentBranch;
detail.RemoteRepositoryUrl = repo.Config["remote.origin.url"];
detail.RemoteBranch = branch.Name;
// detail.Description = repo.Head.CurrentCommit.ShortHash;
detail.RelativePath = PathUtility.MakeRelativePath(Path.GetDirectoryName(repoPath), path);
}
catch (Exception)
{
// SWALLOW exception?
// Console.Error.WriteLine(e.Message);
}
return detail;
}
开发者ID:yonglehou,项目名称:docfx,代码行数:35,代码来源:GitUtility.cs
示例10: RefDatabase
public RefDatabase(Repository repo)
{
Repository = repo;
_gitDir = repo.Directory;
_refsDir = PathUtil.CombineDirectoryPath(_gitDir, "refs");
_packedRefsFile = PathUtil.CombineFilePath(_gitDir, "packed-refs");
ClearCache();
}
开发者ID:Squelch,项目名称:GitSharp,代码行数:8,代码来源:RefDatabase.cs
示例11: PersonIdent
private readonly int tzOffset; // offset in minutes to UTC
#endregion Fields
#region Constructors
/// <summary>
/// Creates new PersonIdent from config info in repository, with current time.
/// This new PersonIdent gets the info from the default committer as available
/// from the configuration.
/// </summary>
/// <param name="repo"></param>
public PersonIdent(Repository repo)
{
RepositoryConfig config = repo.Config;
string username = config.getString("user", null, "name");
string email = config.getString("user", null, "email");
Name = username;
EmailAddress = email;
}
开发者ID:drothmaler,项目名称:GitSharp,代码行数:20,代码来源:PersonIdent.cs
示例12: WorkDirCheckout
/// <summary>
/// Create a checkout class for checking out one tree, merging with the index
/// </summary>
/// <param name="repo"> </param>
/// <param name="root"> workdir </param>
/// <param name="index"> current index </param>
/// <param name="merge"> tree to check out </param>
public WorkDirCheckout(Repository repo, FileSystemInfo root, GitIndex index, Tree merge)
: this()
{
this._repo = repo;
this._root = root;
this._index = index;
this._merge = merge;
}
开发者ID:HackerBaloo,项目名称:GitSharp,代码行数:15,代码来源:WorkDirCheckout.cs
示例13: Versioning
public Versioning(Data data, GitSharp.Repository repo)
{
GitDetails = null;
InitializeComponent();
VersionControlData = data;
_repo = repo;
LoadFileStructure();
}
开发者ID:naztrain,项目名称:vixen,代码行数:9,代码来源:Versioning.cs
示例14: RepositoryNavigationViewModelBase
public RepositoryNavigationViewModelBase(Repository repository, RepositoryNavigationRequest request)
: this()
{
RepositoryName = request.RepositoryName;
Treeish = request.Treeish;
Path = request.Path;
RepositoryLocation = request.RepositoryLocation;
FillFromRepository(repository, request);
}
开发者ID:robertwilczynski,项目名称:GitPrise,代码行数:9,代码来源:RepositoryNavigationViewModelBase.cs
示例15: PersonIdent
public PersonIdent(Repository repo)
{
RepositoryConfig config = repo.Config;
string username = config.GetString("user", null, "name");
string email = config.GetString("user", null, "email");
this.Name = username;
this.EmailAddress = email;
this.when_time = DateTimeOffset.Now;
}
开发者ID:ArildF,项目名称:GitSharp,代码行数:9,代码来源:PersonIdent.cs
示例16: GetChanges
public static IEnumerable<Change> GetChanges(string path, string firstIdentifier, string secondIdentifier, string repositoryPath = "Backend.git")
{
var repo = new Repository(repositoryPath);
var firstCommit = repo.Get<Commit>(firstIdentifier);
var secondCommit = repo.Get<Commit>(secondIdentifier);
if (firstCommit == null || secondCommit == null) return null;
return secondCommit.CompareAgainst(firstCommit).ToArray();
}
开发者ID:pdelvo,项目名称:MarkdownTemplateGitServer,代码行数:10,代码来源:GitBackend.cs
示例17: BlobBasedConfig
/// <summary> * The constructor from object identifier
/// </summary>
/// <param name="base">the base configuration file </param>
/// <param name="r">the repository</param>
/// <param name="objectid">the object identifier</param>
/// <exception cref="IOException">
/// the blob cannot be read from the repository. </exception>
/// <exception cref="ConfigInvalidException">
/// the blob is not a valid configuration format.
/// </exception>
public BlobBasedConfig(Config @base, Repository r, ObjectId objectid)
: base(@base)
{
ObjectLoader loader = r.OpenBlob(objectid);
if (loader == null)
{
throw new IOException("Blob not found: " + objectid);
}
fromText(RawParseUtils.decode(loader.Bytes));
}
开发者ID:HackerBaloo,项目名称:GitSharp,代码行数:20,代码来源:BlobBasedConfig.cs
示例18: MyTestInitialize
public void MyTestInitialize()
{
_tempFiles = new TempFiles();
_repoPath = _tempFiles.GetTemporaryDirectory();
_gitPath = Path.Combine(_repoPath, ".git");
Directory.CreateDirectory(_gitPath);
Program.Initialize();
_gitRepository = new GitRepository(ObjectFactory.GetInstance<TextWriter>(), _gitPath);
_csharpRepository = new Repository(_gitPath);
}
开发者ID:fschwiet,项目名称:git-tfs,代码行数:11,代码来源:GitRepositoryTest.cs
示例19: CommitViewModel
public CommitViewModel(Repository repository, RepositoryNavigationRequest request, Commit commit, bool fillParents)
: base(new RepositoryNavigationRequest(request) { Treeish = commit.Hash })
{
if (fillParents)
{
Parents = new List<CommitViewModel>(commit.Parents.Select(x =>
new CommitViewModel(repository, request, x, false)));
}
Tree = new TreeNodeViewModel(repository, request, commit.Tree);
Commit = commit;
}
开发者ID:robertwilczynski,项目名称:GitPrise,代码行数:11,代码来源:MainCommitViewModel.cs
示例20: PersonIdent
private readonly int tzOffset; // offset in minutes to UTC
#endregion Fields
#region Constructors
public PersonIdent(Repository repo)
{
RepositoryConfig config = repo.Config;
string username = config.getString("user", null, "name");
string email = config.getString("user", null, "email");
Name = username;
EmailAddress = email;
DateTimeOffset now = DateTimeOffset.Now;
When = now.Millisecond;
tzOffset = now.Offset.Minutes;
}
开发者ID:rzeng,项目名称:GitSharp,代码行数:17,代码来源:PersonIdent.cs
注:本文中的GitSharp.Repository类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论