Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #52 from litetex/develop
Browse files Browse the repository at this point in the history
v0.3.0
  • Loading branch information
litetex authored Feb 5, 2021
2 parents 13e8256 + 7bd1138 commit 45226b6
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 21 deletions.
15 changes: 13 additions & 2 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
branches:
- master
- master-release-test
name-template: "v$NEXT_PATCH_VERSION"
tag-template: "v$NEXT_PATCH_VERSION"
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch
template: |
## Changes
Expand Down
10 changes: 5 additions & 5 deletions src/PullDetachedRemote/CMD/CmdOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,16 @@ public class CmdOption
public string UpstreamBranch { get; set; }

/// <summary>
/// <see cref="Config.Configuration.IgnoreUpstreamRepoProtocolInOriginUpdateBranch"/>
/// <see cref="Config.Configuration.IgnoreUpstreamRepoProtocolInUpdateBranch"/>
/// </summary>
[Option("ignoreprotocol")]
public bool IgnoreUpstreamRepoProtocolInOriginUpdateBranch { get; set; }
public string IgnoreUpstreamRepoProtocolInUpdateBranch { get; set; }

/// <summary>
/// <see cref="Config.Configuration.OriginUpdateBranch"/>
/// <see cref="Config.Configuration.UpdateBranch"/>
/// </summary>
[Option("nameoforiginupdatebranch")]
public string OriginUpdateBranch { get; set; }
[Option("updatebranch")]
public string UpdateBranch { get; set; }

/// <summary>
/// <see cref="Config.Configuration.UpstreamRepoUseGitHubCreds"/>
Expand Down
6 changes: 3 additions & 3 deletions src/PullDetachedRemote/Config/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ public class Configuration : YamlConfig
/// <remarks>
/// Optional; default is a auto generated name from the upstreamRepo + Branch
/// </remarks>
public string OriginUpdateBranch { get; set; }
public string UpdateBranch { get; set; }

/// <summary>
/// Ignores the protocol (http/https/...) when generating the <see cref="OriginUpdateBranch"/>
/// Ignores the protocol (http/https) when generating the <see cref="UpdateBranch"/>
/// </summary>
/// <remarks>
/// Optional;
/// </remarks>
public bool IgnoreUpstreamRepoProtocolInOriginUpdateBranch { get; set; } = false;
public bool IgnoreUpstreamRepoProtocolInUpdateBranch { get; set; } = false;

/// <summary>
/// GITHUB_TOKEN <para/>
Expand Down
12 changes: 6 additions & 6 deletions src/PullDetachedRemote/Runner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ private void ConfigureNameOfOriginUpdateBranch(GitWorkflow gitWorkflow)
Log.Info($"Got default upstream-branch[name='{Config.UpstreamBranch}'] of '{Config.UpstreamRepo}'");
}

if (string.IsNullOrWhiteSpace(Config.OriginUpdateBranch))
if (string.IsNullOrWhiteSpace(Config.UpdateBranch))
{
var repoName = Config.UpstreamRepo;
if (repoName.StartsWith("https:") || repoName.StartsWith("http:"))
Expand All @@ -238,14 +238,14 @@ private void ConfigureNameOfOriginUpdateBranch(GitWorkflow gitWorkflow)
repoName = newRepoName;
}

Config.OriginUpdateBranch = $"upstreamupdate/{repoName}/{Config.UpstreamBranch}";
Config.UpdateBranch = $"upstreamupdate/{repoName}/{Config.UpstreamBranch}";
}

Config.OriginUpdateBranch = GitBranchNormalizer.Fix(Config.OriginUpdateBranch);
if (string.IsNullOrWhiteSpace(Config.OriginUpdateBranch))
throw new ArgumentException($"{nameof(Config.OriginUpdateBranch)}[='{Config.OriginUpdateBranch}'] is invalid");
Config.UpdateBranch = GitBranchNormalizer.Fix(Config.UpdateBranch);
if (string.IsNullOrWhiteSpace(Config.UpdateBranch))
throw new ArgumentException($"{nameof(Config.UpdateBranch)}[='{Config.UpdateBranch}'] is invalid");

Log.Info($"{nameof(Config.OriginUpdateBranch)} is '{Config.OriginUpdateBranch}'");
Log.Info($"{nameof(Config.UpdateBranch)} is '{Config.UpdateBranch}'");
}


Expand Down
4 changes: 2 additions & 2 deletions src/PullDetachedRemote/StartUp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ protected void ReadCMDConfig()
cps.SetString(() => CmdOption.OriginBranch, v => Config.OriginBranch = v, nameof(Config.OriginBranch));
cps.SetString(() => CmdOption.UpstreamRepo, v => Config.UpstreamRepo = v, nameof(Config.UpstreamRepo));
cps.SetString(() => CmdOption.UpstreamBranch, v => Config.UpstreamBranch = v, nameof(Config.UpstreamBranch));
cps.Set(() => CmdOption.IgnoreUpstreamRepoProtocolInOriginUpdateBranch, v => Config.IgnoreUpstreamRepoProtocolInOriginUpdateBranch = v, nameof(Config.IgnoreUpstreamRepoProtocolInOriginUpdateBranch));
cps.SetString(() => CmdOption.OriginUpdateBranch, v => Config.OriginUpdateBranch = v, nameof(Config.OriginUpdateBranch));
cps.SetBool(() => CmdOption.IgnoreUpstreamRepoProtocolInUpdateBranch, v => Config.IgnoreUpstreamRepoProtocolInUpdateBranch = v, nameof(Config.IgnoreUpstreamRepoProtocolInUpdateBranch));
cps.SetString(() => CmdOption.UpdateBranch, v => Config.UpdateBranch = v, nameof(Config.UpdateBranch));
cps.SetEnum<UpstreamRepoCredentialsMode>(() => CmdOption.UpstreamCredMode, v => Config.UpstreamCredMode = v, nameof(Config.UpstreamCredMode));
}

Expand Down
6 changes: 3 additions & 3 deletions src/PullDetachedRemote/Workflow/GitWorkflow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@ protected string GenerateRemoteUpstreamName(IEnumerable<string> exisitingRemoteN

public bool CheckoutOriginUpdateBranch()
{
OriginUpdateBranch = Repo.Branches.FirstOrDefault(x => x.FriendlyName == Config.OriginUpdateBranch);
OriginUpdateBranch = Repo.Branches.FirstOrDefault(x => x.FriendlyName == Config.UpdateBranch);
if (OriginUpdateBranch == null)
{
Log.Info($"Creating origin-update branch '{Config.OriginUpdateBranch}' from '{UpstreamBranch.FriendlyName}'");
OriginUpdateBranch = Repo.CreateBranch(Config.OriginUpdateBranch, UpstreamBranch.Tip);
Log.Info($"Creating origin-update branch '{Config.UpdateBranch}' from '{UpstreamBranch.FriendlyName}'");
OriginUpdateBranch = Repo.CreateBranch(Config.UpdateBranch, UpstreamBranch.Tip);
Log.Info($"Created origin-update branch '{OriginUpdateBranch.FriendlyName}'[LatestCommit='{UpstreamBranch.Tip}']");

return true;
Expand Down

0 comments on commit 45226b6

Please sign in to comment.