本文整理汇总了C#中HgRepository.Push方法的典型用法代码示例。如果您正苦于以下问题:C# HgRepository.Push方法的具体用法?C# HgRepository.Push怎么用?C# HgRepository.Push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HgRepository
的用法示例。
在下文中一共展示了HgRepository.Push方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendToOneOther
private void SendToOneOther(RepositoryAddress address, Dictionary<RepositoryAddress, bool> connectionAttempt, HgRepository repo)
{
try
{
string resolvedUri = address.GetPotentialRepoUri(Repository.Identifier, RepoProjectName, _progress);
bool canConnect;
if (connectionAttempt.ContainsKey(address))
{
canConnect = connectionAttempt[address];
}
else
{
canConnect = address.CanConnect(repo, RepoProjectName, _progress);
connectionAttempt.Add(address, canConnect);
}
if (canConnect)
{
if(s_testingDoNotPush)
{
_progress.WriteWarning("**Skipping push because s_testingDoNotPush is true");
}
else
{
repo.Push(address, resolvedUri);
}
// For usb, it's safe and desireable to do an update (bring into the directory
// the latest files from the repo) for LAN, it could be... for now we assume it is.
// For me (RandyR) including the shared network folder
// failed to do the update and killed the process, which left a 'wlock' file
// in the shared folder's '.hg' folder. No more S/Rs could then be done,
// because the repo was locked.
// For now, at least, it is not a requirement to do the update on the shared folder.
// JDH Oct 2010: added this back in if it doesn't look like a shared folder
if (address is UsbKeyRepositorySource ||
(address is DirectoryRepositorySource && ((DirectoryRepositorySource)address).LooksLikeLocalDirectory))
{
var otherRepo = new HgRepository(resolvedUri, _progress);
otherRepo.Update();
}
}
else if (address is UsbKeyRepositorySource || address is DirectoryRepositorySource)
{
// If we cannot connect to a USB or Directory source (the repository doesn't exist),
// try to clone our repository onto the source
TryToMakeCloneForSource(address);
//nb: no need to push if we just made a clone
}
}
catch (UserCancelledException)
{
throw;
}
catch (Exception error)
{
ExplainAndThrow(error, "Failed to send to {0} ({1}).", address.Name, address.URI);
}
}
示例2: SendToOneOther
private void SendToOneOther(RepositoryAddress address, Dictionary<RepositoryAddress, bool> connectionAttempt, HgRepository repo)
{
try
{
string resolvedUri = address.GetPotentialRepoUri(Repository.Identifier, RepoProjectName, _progress);
bool canConnect;
if (connectionAttempt.ContainsKey(address))
{
canConnect = connectionAttempt[address];
}
else
{
canConnect = address.CanConnect(repo, RepoProjectName, _progress);
connectionAttempt.Add(address, canConnect);
}
if (canConnect)
{
if(s_testingDoNotPush)
{
_progress.WriteWarning("**Skipping push because s_testingDoNotPush is true");
}
else
{
repo.Push(address, resolvedUri);
}
// For USB, we do not wish to do an update, since it can cause problems if the working
// files are available to the user.
// The update is only done for tests, since only tests now use "DirectoryRepositorySource".
if (address is DirectoryRepositorySource && ((DirectoryRepositorySource) address).LooksLikeLocalDirectory)
{
// passes false to avoid updating the hgrc on a send to preserve backward compatibility
var otherRepo = new HgRepository(resolvedUri, false, _progress);
otherRepo.Update();
}
}
else if (address is UsbKeyRepositorySource || address is DirectoryRepositorySource)
{
// If we cannot connect to a USB or Directory source (the repository doesn't exist),
// try to clone our repository onto the source
TryToMakeCloneForSource(address);
//nb: no need to push if we just made a clone
}
}
catch (UserCancelledException)
{
throw;
}
catch (Exception error)
{
ExplainAndThrow(error, "Failed to send to {0} ({1}).", address.Name, address.URI);
}
}