Skip to content

Move to .NET 6.0 and upgrade dependencies. #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,4 @@ UpgradeLog*.htm

# Microsoft Fakes
FakesAssemblies/
.vs
51 changes: 23 additions & 28 deletions Mpdeimos.GitRepoZipper.sln
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio Version 17
VisualStudioVersion = 17.0.31919.166
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mpdeimos.GitRepoZipper", "src\Mpdeimos.GitRepoZipper.csproj", "{4520C23F-BF0A-4045-BC2E-4D3F720EB1BC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mpdeimos.GitRepoZipper_Test", "test-src\Mpdeimos.GitRepoZipper_Test.csproj", "{CD6489F9-7F08-4926-AEAD-E5204B20A316}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mpdeimos.GitRepoZipper.Tests", "test-src\Mpdeimos.GitRepoZipper.Tests.csproj", "{5E53040F-3A1D-4B74-8653-AB3CF0EC5B39}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4520C23F-BF0A-4045-BC2E-4D3F720EB1BC}.Debug|x86.ActiveCfg = Debug|x86
{4520C23F-BF0A-4045-BC2E-4D3F720EB1BC}.Debug|x86.Build.0 = Debug|x86
{4520C23F-BF0A-4045-BC2E-4D3F720EB1BC}.Release|x86.ActiveCfg = Release|x86
{4520C23F-BF0A-4045-BC2E-4D3F720EB1BC}.Release|x86.Build.0 = Release|x86
{CD6489F9-7F08-4926-AEAD-E5204B20A316}.Debug|x86.ActiveCfg = Debug|x86
{CD6489F9-7F08-4926-AEAD-E5204B20A316}.Debug|x86.Build.0 = Debug|x86
{CD6489F9-7F08-4926-AEAD-E5204B20A316}.Release|x86.ActiveCfg = Release|x86
{CD6489F9-7F08-4926-AEAD-E5204B20A316}.Release|x86.Build.0 = Release|x86
{4520C23F-BF0A-4045-BC2E-4D3F720EB1BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4520C23F-BF0A-4045-BC2E-4D3F720EB1BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4520C23F-BF0A-4045-BC2E-4D3F720EB1BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4520C23F-BF0A-4045-BC2E-4D3F720EB1BC}.Release|Any CPU.Build.0 = Release|Any CPU
{CD6489F9-7F08-4926-AEAD-E5204B20A316}.Debug|Any CPU.ActiveCfg = Debug|x86
{CD6489F9-7F08-4926-AEAD-E5204B20A316}.Release|Any CPU.ActiveCfg = Release|x86
{5E53040F-3A1D-4B74-8653-AB3CF0EC5B39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5E53040F-3A1D-4B74-8653-AB3CF0EC5B39}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E53040F-3A1D-4B74-8653-AB3CF0EC5B39}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5E53040F-3A1D-4B74-8653-AB3CF0EC5B39}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B79071DE-0390-4360-8846-6FEB45D27C49}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
Expand Down Expand Up @@ -62,21 +72,19 @@ Global
$4.IncludeInNewFiles = True
$0.NameConventionPolicy = $5
$5.Rules = $6
$6.NamingRule = $7
$6.NamingRule = $26
$7.Name = Namespaces
$7.AffectedEntity = Namespace
$7.VisibilityMask = VisibilityMask
$7.NamingStyle = PascalCase
$7.IncludeInstanceMembers = True
$7.IncludeStaticEntities = True
$6.NamingRule = $8
$8.Name = Types
$8.AffectedEntity = Class, Struct, Enum, Delegate
$8.VisibilityMask = Public
$8.NamingStyle = PascalCase
$8.IncludeInstanceMembers = True
$8.IncludeStaticEntities = True
$6.NamingRule = $9
$9.Name = Interfaces
$9.RequiredPrefixes = $10
$10.String = I
Expand All @@ -85,7 +93,6 @@ Global
$9.NamingStyle = PascalCase
$9.IncludeInstanceMembers = True
$9.IncludeStaticEntities = True
$6.NamingRule = $11
$11.Name = Attributes
$11.RequiredSuffixes = $12
$12.String = Attribute
Expand All @@ -94,7 +101,6 @@ Global
$11.NamingStyle = PascalCase
$11.IncludeInstanceMembers = True
$11.IncludeStaticEntities = True
$6.NamingRule = $13
$13.Name = Event Arguments
$13.RequiredSuffixes = $14
$14.String = EventArgs
Expand All @@ -103,7 +109,6 @@ Global
$13.NamingStyle = PascalCase
$13.IncludeInstanceMembers = True
$13.IncludeStaticEntities = True
$6.NamingRule = $15
$15.Name = Exceptions
$15.RequiredSuffixes = $16
$16.String = Exception
Expand All @@ -112,70 +117,60 @@ Global
$15.NamingStyle = PascalCase
$15.IncludeInstanceMembers = True
$15.IncludeStaticEntities = True
$6.NamingRule = $17
$17.Name = Methods
$17.AffectedEntity = Methods
$17.VisibilityMask = Protected, Public
$17.NamingStyle = PascalCase
$17.IncludeInstanceMembers = True
$17.IncludeStaticEntities = True
$6.NamingRule = $18
$18.Name = Static Readonly Fields
$18.AffectedEntity = ReadonlyField
$18.VisibilityMask = Protected, Public
$18.NamingStyle = PascalCase
$18.IncludeInstanceMembers = False
$18.IncludeStaticEntities = True
$6.NamingRule = $19
$19.Name = Fields
$19.AffectedEntity = Field
$19.VisibilityMask = Protected, Public
$19.NamingStyle = PascalCase
$19.IncludeInstanceMembers = True
$19.IncludeStaticEntities = True
$6.NamingRule = $20
$20.Name = ReadOnly Fields
$20.AffectedEntity = ReadonlyField
$20.VisibilityMask = Protected, Public
$20.NamingStyle = PascalCase
$20.IncludeInstanceMembers = True
$20.IncludeStaticEntities = False
$6.NamingRule = $21
$21.Name = Constant Fields
$21.AffectedEntity = ConstantField
$21.VisibilityMask = Protected, Public
$21.NamingStyle = PascalCase
$21.IncludeInstanceMembers = True
$21.IncludeStaticEntities = True
$6.NamingRule = $22
$22.Name = Properties
$22.AffectedEntity = Property
$22.VisibilityMask = Protected, Public
$22.NamingStyle = PascalCase
$22.IncludeInstanceMembers = True
$22.IncludeStaticEntities = True
$6.NamingRule = $23
$23.Name = Events
$23.AffectedEntity = Event
$23.VisibilityMask = Protected, Public
$23.NamingStyle = PascalCase
$23.IncludeInstanceMembers = True
$23.IncludeStaticEntities = True
$6.NamingRule = $24
$24.Name = Enum Members
$24.AffectedEntity = EnumMember
$24.VisibilityMask = VisibilityMask
$24.NamingStyle = PascalCase
$24.IncludeInstanceMembers = True
$24.IncludeStaticEntities = True
$6.NamingRule = $25
$25.Name = Parameters
$25.AffectedEntity = Parameter
$25.VisibilityMask = VisibilityMask
$25.NamingStyle = CamelCase
$25.IncludeInstanceMembers = True
$25.IncludeStaticEntities = True
$6.NamingRule = $26
$26.Name = Type Parameters
$26.RequiredPrefixes = $27
$27.String = T
Expand Down
30 changes: 0 additions & 30 deletions src/Main.cs

This file was deleted.

45 changes: 16 additions & 29 deletions src/Model/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,51 +13,38 @@ public class Config
[Option('o', "output", Required = true, HelpText = "The output repository to write to.")]
public string Target { get; set; }

[OptionArray('i', "input", HelpText = "The input repositories to read from.")]
public string[] Sources { get; set; }
[Option('i', "input", HelpText = "The input repositories to read from.")]
public IEnumerable<string> Sources { get; set; }

[OptionArray('b', "include", HelpText = "The branches to include (by friendly name, regex).")]
public string[] Include { get; set; }
[Option('b', "include", HelpText = "The branches to include (by friendly name, regex).")]
public IEnumerable<string> Include { get; set; }

[OptionArray('x', "exclude", HelpText = "The branches to exclude (by friendly name, regex).")]
public string[] Exclude { get; set; }
[Option('x', "exclude", HelpText = "The branches to exclude (by friendly name, regex).")]
public IEnumerable<string> Exclude { get; set; }

[Option("remote", HelpText = "Include remote branches.", DefaultValue = false)]
[Option("remote", HelpText = "Include remote branches.", Default = false)]
public bool Remote { get; set; }

[Option('g', "graft-merges", HelpText = "Graft merges instead of rewriting the history.", DefaultValue = false)]
[Option('g', "graft-merges", HelpText = "Graft merges instead of rewriting the history.", Default = false)]
public bool GraftMerges { get; set; }

[Option('f', "force", HelpText = "Forces overriding the output repository.", DefaultValue = false)]
[Option('f', "force", HelpText = "Forces overriding the output repository.", Default = false)]
public bool Force { get; set; }

[Option('s', "silent", HelpText = "Prevents printing to proggress information to the console.", DefaultValue = false)]
[Option('s', "silent", HelpText = "Prevents printing to proggress information to the console.", Default = false)]
public bool Silent { get; set; }

[Option('r', "retry", HelpText = "Allows resuming an operation if an error occurrs by manually modifying the workspace.", DefaultValue = false)]
[Option('r', "retry", HelpText = "Allows resuming an operation if an error occurrs by manually modifying the workspace.", Default = false)]
public bool Retry { get; set; }

[Option('n', "dry-run", HelpText = "Dry run of zipping the repositories (does not write anything to the specified output).", DefaultValue = false)]
[Option('n', "dry-run", HelpText = "Dry run of zipping the repositories (does not write anything to the specified output).", Default = false)]
public bool DryRun { get; set; }

/// <summary>
/// The usage help provided from annotated options.
/// </summary>
[HelpOption]
public string GetUsage()
{
return HelpText.AutoBuild(this, current => HelpText.DefaultParsingErrorsHandler(this, current));
}
[Option('k', "keep", HelpText = "Keeps the remotes to the input repositories.", Default = false)]
public bool Keep { get; set; }

/// <summary>
/// Constructor for parsing the commandline.
/// </summary>
public static Config FromCommandline(params string[] args)
{
var config = new Config();
Parser.Default.ParseArgumentsStrict(args, config);
return config;
}
[Option('t', "tags", HelpText = "Keep tags, they might not be correctly rewritten.", Default = false)]
public bool Tags { get; set; }

/// <summary>
/// Returns whether a branch is included by this configuration.
Expand Down
18 changes: 15 additions & 3 deletions src/Model/DryRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public Configuration Config
}
}

public Index Index
public LibGit2Sharp.Index Index
{
get
{
Expand Down Expand Up @@ -287,12 +287,24 @@ public void Dispose()

public BranchCollection Branches { get; } = new DryBranchCollection();

public Branch Checkout(Branch branch, CheckoutOptions options)
public WorktreeCollection Worktrees => throw new NotImplementedException();

public Branch Checkout(Branch branch, CheckoutOptions options)
{
return branch;
}

public class DryBranchCollection : BranchCollection
public void Checkout(Tree tree, IEnumerable<string> paths, CheckoutOptions opts)
{
throw new NotImplementedException();
}

public void RevParse(string revision, out Reference reference, out GitObject obj)
{
throw new NotImplementedException();
}

public class DryBranchCollection : BranchCollection
{
private Dictionary<string, Branch> branches = new Dictionary<string, Branch>();

Expand Down
5 changes: 5 additions & 0 deletions src/Model/ShallowCommit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public override int GetHashCode()

public static ShallowCommit FromCommit(Commit commit)
{
if (commit == null)
{
throw new ArgumentNullException(nameof(commit));
}

if (!Cache.ContainsKey(commit.Sha))
{
Cache[commit.Sha] = new ShallowCommit(commit);
Expand Down
Loading