Skip to content

Commit

Permalink
[Rollout] Production rollout 2025-01-22 (#4356)
Browse files Browse the repository at this point in the history
  • Loading branch information
premun authored Jan 22, 2025
2 parents 5528392 + 4dd55c0 commit f1b6b9b
Show file tree
Hide file tree
Showing 34 changed files with 795 additions and 596 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Task<GitFileContentContainer> UpdateDependencyFiles(
IEnumerable<DependencyDetail> itemsToUpdate,
SourceDependency? sourceDependency,
string repoUri,
string branch,
string? branch,
IEnumerable<DependencyDetail> oldDependencies,
SemanticVersion? incomingDotNetSdkVersion);

Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.DotNet.Darc/DarcLib/Local.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public async Task AddDependencyAsync(DependencyDetail dependency)
/// Updates existing dependencies in the dependency files
/// </summary>
/// <param name="dependencies">Dependencies that need updates.</param>
public async Task UpdateDependenciesAsync(List<DependencyDetail> dependencies, IRemoteFactory remoteFactory, IGitRepoFactory gitRepoFactory, IBarApiClient barClient)
public async Task UpdateDependenciesAsync(List<DependencyDetail> dependencies, IRemoteFactory remoteFactory, IGitRepoFactory gitRepoFactory, IBasicBarClient barClient)
{
// Read the current dependency files and grab their locations so that nuget.config can be updated appropriately.
// Update the incoming dependencies with locations.
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.DotNet.Darc/DarcLib/LocalGitClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public LocalGitClient(
_logger = logger;
}

public async Task<string> GetFileContentsAsync(string relativeFilePath, string repoPath, string branch)
public async Task<string> GetFileContentsAsync(string relativeFilePath, string repoPath, string? branch)
{
// Load non-working-tree version
if (!string.IsNullOrEmpty(branch))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ protected async Task<ILocalGitRepo> PrepareCloneInternalAsync(
IReadOnlyCollection<string> remoteUris,
IReadOnlyCollection<string> requestedRefs,
string checkoutRef,
CancellationToken cancellationToken)
bool resetToRemote = false,
CancellationToken cancellationToken = default)
{
if (remoteUris.Count == 0)
{
Expand Down Expand Up @@ -104,6 +105,19 @@ protected async Task<ILocalGitRepo> PrepareCloneInternalAsync(

var repo = _localGitRepoFactory.Create(path);
await repo.CheckoutAsync(checkoutRef);

if (resetToRemote)
{
// get the upstream branch for the currently checked out branch
var result = await _localGitRepo.RunGitCommandAsync(path, ["for-each-ref", "--format=%(upstream:short)", $"refs/heads/{checkoutRef}"]);
result.ThrowIfFailed("Couldn't get upstream branch for the current branch");
var upstream = result.StandardOutput.Trim();

// reset the branch to the remote one
result = await _localGitRepo.RunGitCommandAsync(path, ["reset", "--hard", upstream]);
result.ThrowIfFailed($"Couldn't reset to remote ref {upstream}");
}

return repo;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ Task<bool> UpdateRepository(
bool reapplyVmrPatches,
bool lookUpBuilds,
CancellationToken cancellationToken,
bool amendReapplyCommit = false);
bool amendReapplyCommit = false,
bool resetToRemoteWhenCloningRepo = false);
}
Loading

0 comments on commit f1b6b9b

Please sign in to comment.