Skip to content

Remove Obsolete #181

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

Closed
wants to merge 6 commits into from
Closed
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
24 changes: 0 additions & 24 deletions LibGit2Sharp/BranchCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,6 @@ public virtual Branch Add(string name, Commit commit, bool allowOverwrite = fals
return this[ShortToLocalName(name)];
}

/// <summary>
/// Create a new local branch with the specified name
/// </summary>
/// <param name = "name">The name of the branch.</param>
/// <param name = "committish">Revparse spec for the target commit.</param>
/// <param name = "allowOverwrite">True to allow silent overwriting a potentially existing branch, false otherwise.</param>
/// <returns></returns>
[Obsolete("This method will be removed in the next release. Please use Add() instead.")]
public virtual Branch Create(string name, string committish, bool allowOverwrite = false)
{
return this.Add(name, committish, allowOverwrite);
}

/// <summary>
/// Deletes the specified branch.
/// </summary>
Expand All @@ -151,17 +138,6 @@ public virtual void Remove(Branch branch)
}
}

/// <summary>
/// Deletes the branch with the specified name.
/// </summary>
/// <param name = "name">The name of the branch to delete.</param>
/// <param name = "isRemote">True if the provided <paramref name="name"/> is the name of a remote branch, false otherwise.</param>
[Obsolete("This method will be removed in the next release. Please use Remove() instead.")]
public virtual void Delete(string name, bool isRemote = false)
{
this.Remove(name, isRemote);
}

/// <summary>
/// Renames an existing local branch with a new name.
/// </summary>
Expand Down
6 changes: 0 additions & 6 deletions LibGit2Sharp/Commit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@ public virtual TreeEntry this[string relativePath]
/// </summary>
public virtual IEnumerable<Commit> Parents { get { return parents; } }

/// <summary>
/// Gets The count of parent commits.
/// </summary>
[Obsolete("This property will be removed in the next release. Please use Parents.Count() instead.")]
public virtual int ParentsCount { get { return Parents.Count(); } }

/// <summary>
/// Gets the notes of this commit.
/// </summary>
Expand Down
16 changes: 0 additions & 16 deletions LibGit2Sharp/CommitLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,6 @@ public virtual Commit FindCommonAncestor(IEnumerable<Commit> commits)
return ret;
}

/// <summary>
/// Stores the content of the <see cref = "Repository.Index" /> as a new <see cref = "Commit" /> into the repository.
/// The tip of the <see cref = "Repository.Head"/> will be used as the parent of this new Commit.
/// Once the commit is created, the <see cref = "Repository.Head"/> will move forward to point at it.
/// </summary>
/// <param name = "message">The description of why a change was made to the repository.</param>
/// <param name = "author">The <see cref = "Signature" /> of who made the change.</param>
/// <param name = "committer">The <see cref = "Signature" /> of who added the change to the repository.</param>
/// <param name = "amendPreviousCommit">True to amend the current <see cref = "Commit"/> pointed at by <see cref = "Repository.Head"/>, false otherwise.</param>
/// <returns>The generated <see cref = "Commit" />.</returns>
[Obsolete("This method will be removed in the next release. Please use Repository.Commit() instead.")]
public Commit Create(string message, Signature author, Signature committer, bool amendPreviousCommit)
{
return repo.Commit(message, author, committer, amendPreviousCommit);
}

private class CommitEnumerator : IEnumerator<Commit>
{
private readonly Repository repo;
Expand Down
34 changes: 4 additions & 30 deletions LibGit2Sharp/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using LibGit2Sharp.Core;
using LibGit2Sharp.Core.Handles;
Expand All @@ -13,7 +12,6 @@ namespace LibGit2Sharp
/// Provides access to configuration variables for a repository.
/// </summary>
public class Configuration : IDisposable,
IEnumerable<ConfigurationEntry>,
IEnumerable<ConfigurationEntry<string>>
{
private readonly FilePath globalConfigPath;
Expand Down Expand Up @@ -85,24 +83,6 @@ public Configuration(string globalConfigurationFileLocation = null, string xdgCo
{
}

/// <summary>
/// Determines if a Git configuration file specific to the current interactive user has been found.
/// </summary>
[Obsolete("This property will be removed in the next release. Please use HasConfig() instead.")]
public virtual bool HasGlobalConfig
{
get { return HasConfig(ConfigurationLevel.Global); }
}

/// <summary>
/// Determines if a system-wide Git configuration file has been found.
/// </summary>
[Obsolete("This property will be removed in the next release. Please use HasConfig() instead.")]
public virtual bool HasSystemConfig
{
get { return HasConfig(ConfigurationLevel.System); }
}

/// <summary>
/// Determines which configuration file has been found.
/// </summary>
Expand Down Expand Up @@ -287,12 +267,6 @@ private static Action<string, object, ConfigurationSafeHandle> GetUpdater<T>(Act
};

IEnumerator<ConfigurationEntry<string>> IEnumerable<ConfigurationEntry<String>>.GetEnumerator()
{
return BuildConfigEntries().Cast<ConfigurationEntry<string>>().GetEnumerator();
}

[Obsolete("This method will be removed in the next release. Please use a different overload instead.")]
IEnumerator<ConfigurationEntry> IEnumerable<ConfigurationEntry>.GetEnumerator()
{
return BuildConfigEntries().GetEnumerator();
}
Expand All @@ -302,15 +276,15 @@ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
return ((IEnumerable<ConfigurationEntry<string>>)this).GetEnumerator();
}

private ICollection<ConfigurationEntry> BuildConfigEntries()
private IEnumerable<ConfigurationEntry<string>> BuildConfigEntries()
{
return Proxy.git_config_foreach(configHandle, entryPtr =>
{
var entry = (GitConfigEntry)Marshal.PtrToStructure(entryPtr, typeof(GitConfigEntry));

return new ConfigurationEntry(Utf8Marshaler.FromNative(entry.namePtr),
Utf8Marshaler.FromNative(entry.valuePtr),
(ConfigurationLevel)entry.level);
return new ConfigurationEntry<string>(Utf8Marshaler.FromNative(entry.namePtr),
Utf8Marshaler.FromNative(entry.valuePtr),
(ConfigurationLevel)entry.level);
});
}
}
Expand Down
25 changes: 1 addition & 24 deletions LibGit2Sharp/ConfigurationEntry.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Diagnostics;
using System.Diagnostics;
using System.Globalization;

namespace LibGit2Sharp
Expand Down Expand Up @@ -54,26 +53,4 @@ private string DebuggerDisplay
}
}
}

/// <summary>
/// Enumerated config option
/// </summary>
[Obsolete("This class will be removed in the next release. Please use ConfigurationEntry<T> instead.")]
public class ConfigurationEntry : ConfigurationEntry<string>
{
/// <summary>
/// Initializes a new instance of the <see cref="ConfigurationEntry{T}"/> class with a given key and value
/// </summary>
/// <param name="key">The option name</param>
/// <param name="value">The option value</param>
/// <param name="level">The origin store</param>
internal ConfigurationEntry(string key, string value, ConfigurationLevel level) : base(key, value, level)
{ }

/// <summary>
/// Needed for mocking purposes.
/// </summary>
protected ConfigurationEntry()
{ }
}
}
144 changes: 0 additions & 144 deletions LibGit2Sharp/ConfigurationExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using LibGit2Sharp.Core;

namespace LibGit2Sharp
Expand All @@ -8,149 +7,6 @@ namespace LibGit2Sharp
/// </summary>
public static class ConfigurationExtensions
{
/// <summary>
/// Delete a configuration variable (key and value).
/// </summary>
/// <param name = "config">The configuration being worked with.</param>
/// <param name = "key">The key to delete.</param>
/// <param name = "level">The configuration file which should be considered as the target of this operation</param>
[Obsolete("This method will be removed in the next release. Please use Unset() instead.")]
public static void Delete(this Configuration config, string key,
ConfigurationLevel level = ConfigurationLevel.Local)
{
Ensure.ArgumentNotNullOrEmptyString(key, "key");

config.Unset(key, level);
}

/// <summary>
/// Get a configuration value for a key. Keys are in the form 'section.name'.
/// <para>
/// For example in order to get the value for this in a .git\config file:
///
/// <code>
/// [core]
/// bare = true
/// </code>
///
/// You would call:
///
/// <code>
/// bool isBare = repo.Config.Get&lt;bool&gt;("core.bare", false);
/// </code>
/// </para>
/// </summary>
/// <typeparam name = "T">The configuration value type</typeparam>
/// <param name = "config">The configuration being worked with.</param>
/// <param name = "key">The key</param>
/// <param name = "defaultValue">The default value</param>
/// <returns>The configuration value, or <c>defaultValue</c> if not set</returns>
[Obsolete("This method will be removed in the next release. Please use a different overload instead.")]
public static T Get<T>(this Configuration config, string key, T defaultValue)
{
Ensure.ArgumentNotNullOrEmptyString(key, "key");

var val = config.Get<T>(key);

return val == null ? defaultValue : val.Value;
}

/// <summary>
/// Get a configuration value for a key. Keys are in the form 'section.name'.
/// <para>
/// For example in order to get the value for this in a .git\config file:
///
/// <code>
/// [core]
/// bare = true
/// </code>
///
/// You would call:
///
/// <code>
/// bool isBare = repo.Config.Get&lt;bool&gt;("core", "bare", false);
/// </code>
/// </para>
/// </summary>
/// <typeparam name = "T">The configuration value type</typeparam>
/// <param name = "config">The configuration being worked with.</param>
/// <param name = "firstKeyPart">The first key part</param>
/// <param name = "secondKeyPart">The second key part</param>
/// <param name = "defaultValue">The default value</param>
/// <returns>The configuration value, or <c>defaultValue</c> if not set</returns>
[Obsolete("This method will be removed in the next release. Please use a different overload instead.")]
public static T Get<T>(this Configuration config, string firstKeyPart, string secondKeyPart, T defaultValue)
{
Ensure.ArgumentNotNullOrEmptyString(firstKeyPart, "firstKeyPart");
Ensure.ArgumentNotNullOrEmptyString(secondKeyPart, "secondKeyPart");

return config.Get(new[] { firstKeyPart, secondKeyPart }, defaultValue);
}

/// <summary>
/// Get a configuration value for the given key parts.
/// <para>
/// For example in order to get the value for this in a .git\config file:
///
/// <code>
/// [difftool "kdiff3"]
/// path = c:/Program Files/KDiff3/kdiff3.exe
/// </code>
///
/// You would call:
///
/// <code>
/// string where = repo.Config.Get&lt;string&gt;("difftool", "kdiff3", "path", null);
/// </code>
/// </para>
/// </summary>
/// <typeparam name = "T">The configuration value type</typeparam>
/// <param name = "config">The configuration being worked with.</param>
/// <param name = "firstKeyPart">The first key part</param>
/// <param name = "secondKeyPart">The second key part</param>
/// <param name = "thirdKeyPart">The third key part</param>
/// <param name = "defaultValue">The default value</param>
/// <returns>The configuration value, or <c>defaultValue</c> if not set</returns>
[Obsolete("This method will be removed in the next release. Please use a different overload instead.")]
public static T Get<T>(this Configuration config, string firstKeyPart, string secondKeyPart, string thirdKeyPart, T defaultValue)
{
Ensure.ArgumentNotNullOrEmptyString(firstKeyPart, "firstKeyPart");
Ensure.ArgumentNotNullOrEmptyString(secondKeyPart, "secondKeyPart");
Ensure.ArgumentNotNullOrEmptyString(thirdKeyPart, "secondKeyPart");

return config.Get(new[] { firstKeyPart, secondKeyPart, thirdKeyPart }, defaultValue);
}

/// <summary>
/// Get a configuration value for the given key parts.
/// <para>
/// For example in order to get the value for this in a .git\config file:
///
/// <code>
/// [core]
/// bare = true
/// </code>
///
/// You would call:
///
/// <code>
/// bool isBare = repo.Config.Get&lt;bool&gt;(new []{ "core", "bare" }, false);
/// </code>
/// </para>
/// </summary>
/// <typeparam name = "T">The configuration value type</typeparam>
/// <param name = "config">The configuration being worked with.</param>
/// <param name = "keyParts">The key parts</param>
/// <param name = "defaultValue">The default value</param>
/// <returns>The configuration value, or <c>defaultValue</c> if not set</returns>
[Obsolete("This method will be removed in the next release. Please use a different overload instead.")]
public static T Get<T>(this Configuration config, string[] keyParts, T defaultValue)
{
Ensure.ArgumentNotNull(keyParts, "keyParts");

return config.Get(string.Join(".", keyParts), defaultValue);
}

/// <summary>
/// Get a configuration value for the given key parts.
/// <para>
Expand Down
30 changes: 0 additions & 30 deletions LibGit2Sharp/Diff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,36 +122,6 @@ private static IDictionary<DiffTargets, Func<Repository, TreeComparisonHandleRet
};
}

/// <summary>
/// Show changes between a <see cref = "Tree"/> and a selectable target.
/// </summary>
/// <param name = "oldTree">The <see cref = "Tree"/> to compare from.</param>
/// <param name = "diffTarget">The target to compare to.</param>
/// <param name = "paths">The list of paths (either files or directories) that should be compared.</param>
/// <returns>A <see cref = "TreeChanges"/> containing the changes between the <see cref="Tree"/> and the selected target.</returns>
[Obsolete("This method will be removed in the next release. Please use Compare(Tree, DiffTargets, IEnumerable<string>) instead.")]
public virtual TreeChanges Compare(Tree oldTree, DiffTarget diffTarget, IEnumerable<string> paths = null)
{
DiffTargets targets;

switch (diffTarget)
{
case DiffTarget.Index:
targets = DiffTargets.Index;
break;

case DiffTarget.WorkingDirectory:
targets = DiffTargets.WorkingDirectory;
break;

default:
targets = DiffTargets.Index | DiffTargets.WorkingDirectory;
break;
}

return Compare(oldTree, targets, paths);
}

/// <summary>
/// Show changes between a <see cref = "Tree"/> and the Index, the Working Directory, or both.
/// </summary>
Expand Down
Loading