本文整理汇总了C#中IRepository.GetChangeSet方法的典型用法代码示例。如果您正苦于以下问题:C# IRepository.GetChangeSet方法的具体用法?C# IRepository.GetChangeSet怎么用?C# IRepository.GetChangeSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRepository
的用法示例。
在下文中一共展示了IRepository.GetChangeSet方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Deploy
public static void Deploy(this IDeploymentManager deploymentManager, IRepository repository, string id, string deployer, bool clean)
{
ChangeSet changeSet = null;
if (id != null)
{
changeSet = repository.GetChangeSet(id);
}
deploymentManager.Deploy(repository, changeSet, deployer, clean);
}
示例2: DeployAsync
public async Task DeployAsync(IRepository repository, ChangeSet changeSet, string deployer, bool clean, bool needFileUpdate = true)
{
using (var deploymentAnalytics = new DeploymentAnalytics(_analytics, _settings))
{
Exception exception = null;
ITracer tracer = _traceFactory.GetTracer();
IDisposable deployStep = null;
ILogger innerLogger = null;
string targetBranch = null;
// If we don't get a changeset, find out what branch we should be deploying and get the commit ID from it
if (changeSet == null)
{
targetBranch = _settings.GetBranch();
changeSet = repository.GetChangeSet(targetBranch);
if (changeSet == null)
{
throw new InvalidOperationException(String.Format("The current deployment branch is '{0}', but nothing has been pushed to it", targetBranch));
}
}
string id = changeSet.Id;
IDeploymentStatusFile statusFile = null;
try
{
deployStep = tracer.Step("DeploymentManager.Deploy(id)");
// Remove the old log file for this deployment id
string logPath = GetLogPath(id);
FileSystemHelpers.DeleteFileSafe(logPath);
statusFile = GetOrCreateStatusFile(changeSet, tracer, deployer);
statusFile.MarkPending();
ILogger logger = GetLogger(changeSet.Id);
if (needFileUpdate)
{
using (tracer.Step("Updating to specific changeset"))
{
innerLogger = logger.Log(Resources.Log_UpdatingBranch, targetBranch ?? id);
using (var writer = new ProgressWriter())
{
// Update to the specific changeset or branch
repository.Update(targetBranch ?? id);
}
}
}
if (_settings.ShouldUpdateSubmodules())
{
using (tracer.Step("Updating submodules"))
{
innerLogger = logger.Log(Resources.Log_UpdatingSubmodules);
repository.UpdateSubmodules();
}
}
if (clean)
{
tracer.Trace("Cleaning {0} repository", repository.RepositoryType);
innerLogger = logger.Log(Resources.Log_CleaningRepository, repository.RepositoryType);
repository.Clean();
}
// set to null as Build() below takes over logging
innerLogger = null;
// Perform the build deployment of this changeset
await Build(changeSet, tracer, deployStep, repository, deploymentAnalytics);
}
catch (Exception ex)
{
exception = ex;
if (innerLogger != null)
{
innerLogger.Log(ex);
}
if (statusFile != null)
{
MarkStatusComplete(statusFile, success: false);
}
tracer.TraceError(ex);
deploymentAnalytics.Error = ex.ToString();
if (deployStep != null)
{
deployStep.Dispose();
}
}
//.........这里部分代码省略.........
示例3: ShouldDeploy
// For continuous integration, we will only build/deploy if fetch new changes
// The immediate goal is to address duplicated /deploy requests from Bitbucket (retry if taken > 20s)
private bool ShouldDeploy(IRepository repository, DeploymentInfo deploymentInfo, string targetBranch)
{
if (deploymentInfo.IsContinuous)
{
ChangeSet changeSet = repository.GetChangeSet(targetBranch);
return !String.Equals(_status.ActiveDeploymentId, changeSet.Id, StringComparison.OrdinalIgnoreCase);
}
return true;
}
示例4: Deploy
public void Deploy(IRepository repository, ChangeSet changeSet, string deployer, bool clean)
{
ITracer tracer = _traceFactory.GetTracer();
IDisposable deployStep = null;
ILogger innerLogger = null;
string targetBranch = null;
// If we don't get a changeset, find out what branch we should be deploying and get the commit ID from it
if (changeSet == null)
{
targetBranch = _settings.GetBranch();
changeSet = repository.GetChangeSet(targetBranch);
}
string id = changeSet.Id;
IDeploymentStatusFile statusFile = null;
try
{
deployStep = tracer.Step("DeploymentManager.Deploy(id)");
// Remove the old log file for this deployment id
string logPath = GetLogPath(id);
FileSystemHelpers.DeleteFileSafe(logPath);
statusFile = GetOrCreateStatusFile(changeSet, tracer, deployer);
statusFile.MarkPending();
ILogger logger = GetLogger(changeSet.Id);
using (tracer.Step("Updating to specific changeset"))
{
innerLogger = logger.Log(Resources.Log_UpdatingBranch, targetBranch ?? id);
using (var writer = new ProgressWriter())
{
// Update to the the specific changeset
repository.ClearLock();
repository.Update(id);
}
}
using (tracer.Step("Updating submodules"))
{
innerLogger = logger.Log(Resources.Log_UpdatingSubmodules);
repository.UpdateSubmodules();
}
if (clean)
{
tracer.Trace("Cleaning {0} repository", repository.RepositoryType);
innerLogger = logger.Log(Resources.Log_CleaningRepository, repository.RepositoryType);
repository.Clean();
}
// set to null as Build() below takes over logging
innerLogger = null;
// Perform the build deployment of this changeset
Build(id, tracer, deployStep);
}
catch (Exception ex)
{
if (innerLogger != null)
{
innerLogger.Log(ex);
}
if (statusFile != null)
{
statusFile.MarkFailed();
}
tracer.TraceError(ex);
if (deployStep != null)
{
deployStep.Dispose();
}
throw;
}
}
示例5: Sync
internal async Task<ChangeSet> Sync(DropboxInfo dropboxInfo, string branch, IRepository repository)
{
DropboxDeployInfo deployInfo = dropboxInfo.DeployInfo;
ResetStats();
if (_settings.GetValue(CursorKey) != deployInfo.OldCursor)
{
throw new InvalidOperationException(Resources.Error_MismatchDropboxCursor);
}
// initial sync, remove default content
// for simplicity, we do it blindly whether or not in-place
// given the end result is the same
if (String.IsNullOrEmpty(deployInfo.OldCursor) && DeploymentHelper.IsDefaultWebRootContent(_environment.WebRootPath))
{
string hoststarthtml = Path.Combine(_environment.WebRootPath, Constants.HostingStartHtml);
FileSystemHelpers.DeleteFileSafe(hoststarthtml);
}
if (!repository.IsEmpty())
{
// git checkout --force <branch>
repository.Update(branch);
}
ChangeSet changeSet = null;
string message = null;
try
{
using (_tracer.Step("Sync with Dropbox"))
{
if (dropboxInfo.OAuthVersion == 2)
{
// Fetch the deltas
await UpdateDropboxDeployInfo(deployInfo);
}
// Sync dropbox => repository directory
await ApplyChanges(dropboxInfo, useOAuth20: dropboxInfo.OAuthVersion == 2);
}
message = String.Format(CultureInfo.CurrentCulture,
Resources.Dropbox_Synchronized,
deployInfo.Deltas.Count);
}
catch (Exception)
{
message = String.Format(CultureInfo.CurrentCulture,
Resources.Dropbox_SynchronizedWithFailure,
_successCount,
deployInfo.Deltas.Count,
_failedCount);
throw;
}
finally
{
Logger.Log(message);
Logger.Log(String.Format("{0} downloaded files, {1} successful retries.", _fileCount, _retriedCount));
IDeploymentStatusFile statusFile = _status.Open(dropboxInfo.TargetChangeset.Id);
statusFile.UpdateMessage(message);
statusFile.UpdateProgress(String.Format(CultureInfo.CurrentCulture, Resources.Dropbox_Committing, _successCount));
// Commit anyway even partial change
if (repository.Commit(message, String.Format("{0} <{1}>", deployInfo.UserName, deployInfo.Email ?? deployInfo.UserName)))
{
changeSet = repository.GetChangeSet("HEAD");
}
}
// Save new dropboc cursor
LogInfo("Update dropbox cursor");
_settings.SetValue(CursorKey, deployInfo.NewCursor);
return changeSet;
}
示例6: Sync
internal async Task<ChangeSet> Sync(DropboxHandler.DropboxInfo deploymentInfo, string branch, IRepository repository)
{
DropboxDeployInfo info = deploymentInfo.DeployInfo;
_totals = 0;
_successCount = 0;
_fileCount = 0;
_failedCount = 0;
_retriedCount = 0;
if (_settings.GetValue(CursorKey) != info.OldCursor)
{
throw new InvalidOperationException(Resources.Error_MismatchDropboxCursor);
}
if (!repository.IsEmpty())
{
// git checkout --force <branch>
repository.ClearLock();
repository.Update(branch);
}
ChangeSet changeSet = null;
string message = null;
try
{
using (_tracer.Step("Sync with Dropbox"))
{
// Sync dropbox => repository directory
await ApplyChanges(deploymentInfo);
}
message = String.Format(CultureInfo.CurrentCulture,
Resources.Dropbox_Synchronized,
deploymentInfo.DeployInfo.Deltas.Count);
}
catch (Exception)
{
message = String.Format(CultureInfo.CurrentCulture,
Resources.Dropbox_SynchronizedWithFailure,
_successCount,
deploymentInfo.DeployInfo.Deltas.Count,
_failedCount);
throw;
}
finally
{
Logger.Log(message);
Logger.Log(String.Format("{0} downloaded files, {1} successful retries.", _fileCount, _retriedCount));
IDeploymentStatusFile statusFile = _status.Open(deploymentInfo.TargetChangeset.Id);
statusFile.UpdateMessage(message);
statusFile.UpdateProgress(String.Format(CultureInfo.CurrentCulture, Resources.Dropbox_Committing, _successCount));
// Commit anyway even partial change
if (repository.Commit(message, String.Format("{0} <{1}>", info.UserName, info.Email)))
{
changeSet = repository.GetChangeSet("HEAD");
}
}
// Save new dropboc cursor
LogInfo("Update dropbox cursor");
_settings.SetValue(CursorKey, info.NewCursor);
return changeSet;
}