8000 Remove deprecated methods · libgit2/libgit2sharp@825c0e8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 825c0e8

Browse files
carlosmnEdward Thomson
authored and
Edward Thomson
committed
Remove deprecated methods
These were deprecated for the release of v0.23 so let's get rid of them for the next release.
1 parent c240ffe commit 825c0e8

11 files changed

+1
-881
lines changed

LibGit2Sharp.Tests/RepositoryOptionsFixture.cs

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void CanOpenABareRepoAsIfItWasAStandardOneWithANonExisitingIndexFile()
5555
[Fact]
5656
public void CanOpenABareRepoWithOptions()
5757
{
58-
var options = new RepositoryOptions { GlobalConfigurationLocation = null };
58+
var options = new RepositoryOptions { };
5959

6060
string path = SandboxBareTestRepo();
6161
using (var repo = new Repository(path, options))
@@ -153,45 +153,6 @@ private string MeanwhileInAnotherDimensionAnEvilMastermindIsAtWork(string workin
153153
}
154154
}
155155

156-
[Fact]
157-
public void CanProvideDifferentConfigurationFilesToARepository()
158-
{
159-
string globalLocation = Path.Combine(newWorkdir, "my-global-config");
160-
string xdgLocation = Path.Combine(newWorkdir, "my-xdg-config");
161-
string systemLocation = Path.Combine(newWorkdir, "my-system-config");
162-
163-
const string name = "Adam 'aroben' Roben";
164-
const string email = "adam@github.com";
165-
166-
StringBuilder sb = new StringBuilder()
167-
.AppendLine("[user]")
168-
.AppendFormat("name = {0}{1}", name, Environment.NewLine)
169-
.AppendFormat("email = {0}{1}", email, Environment.NewLine);
170-
171-
File.WriteAllText(globalLocation, sb.ToString());
172-
File.WriteAllText(systemLocation, string.Empty);
173-
File.WriteAllText(xdgLocation, string.Empty);
174-
175-
var options = new RepositoryOptions {
176-
GlobalConfigurationLocation = globalLocation,
177-
XdgConfigurationLocation = xdgLocation,
178-
SystemConfigurationLocation = systemLocation,
179-
};
180-
181-
string path = SandboxBareTestRepo();
182-
using (var repo = new Repository(path, options))
183-
{
184-
Assert.True(repo.Config.HasConfig(ConfigurationLevel.Global));
185-
Assert.Equal(name, repo.Config.Get<string>("user.name").Value);
186-
Assert.Equal(email, repo.Config.Get<string>("user.email").Value);
187-
188-
repo.Config.Set("xdg.setting", "https://twitter.com/libgit2sharp", ConfigurationLevel.Xdg);
189-
repo.Config.Set("help.link", "https://twitter.com/xpaulbettsx/status/205761932626636800", ConfigurationLevel.System);
190-
}
191-
192-
AssertValueInConfigFile(systemLocation, "xpaulbettsx");
193-
}
194-
195156
[Fact]
196157
public void CanCommitOnBareRepository()
197158
{

LibGit2Sharp/Branch.cs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -176,31 +176,6 @@ public virtual string RemoteName
176176
}
177177
}
178178

179-
/// <summary>
180-
/// Get the remote for the branch.
181-
/// <para>
182-
/// If this is a local branch, this will return the configured
183-
/// <see cref="Remote"/> to fetch from and push to. If this is a
184-
/// remote-tracking branch, this will return the remote containing
185-
/// the tracked branch.
186-
/// </para>
187-
/// </summary>
188-
[Obsolete("This property is deprecated. Use Repository.Network.Remotes[] using the RemoteName property")]
189-
public virtual Remote Remote
190-
{
191-
get
192-
{
193-
string remoteName = RemoteName;
194-
195-
if (remoteName == null)
196-
{
197-
return null;
198-
}
199-
200-
return repo.Network.Remotes[remoteName];
201-
}
202-
}
203-
204179
private string UpstreamBranchCanonicalNameFromLocalBranch()
205180
{
206181
ConfigurationEntry<string> mergeRefEntry = repo.Config.Get<string>("branch", FriendlyName, "merge");

LibGit2Sharp/CommitLog.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,6 @@ public IEnumerable<LogEntry> QueryBy(string path)
9191
return new FileHistory(repo, path);
9292
}
9393

94-
/// <summary>
95-
/// Returns the list of commits of the repository representing the history of a file beyond renames.
96-
/// </summary>
97-
/// <param name="path">The file's path.</param>
98-
/// <param name="filter">The options used to control which commits will be returned.</param>
99-
/// <returns>A list of file history entries, ready to be enumerated.</returns>
100-
[Obsolete("This method is deprecated. Please use the overload which take LibGit2Sharp.CommitFilter")]
101-
public IEnumerable<LogEntry> QueryBy(string path, FollowFilter filter)
102-
{
103-
Ensure.ArgumentNotNull(path, "path");
104-
Ensure.ArgumentNotNull(filter, "filter");
105-
106-
return QueryBy(path, new CommitFilter { SortBy = filter.SortBy });
107-
}
108-
10994
/// <summary>
11095
/// Returns the list of commits of the repository representing the history of a file beyond renames.
11196
/// </summary>

LibGit2Sharp/FollowFilter.cs

Lines changed: 0 additions & 57 deletions
This file was deleted.

LibGit2Sharp/IQueryableCommitLog.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,6 @@ public interface IQueryableCommitLog : ICommitLog
2222
/// <returns>A list of file history entries, ready to be enumerated.</returns>
2323
IEnumerable<LogEntry> QueryBy(string path);
2424

25-
/// <summary>
26-
/// Returns the list of commits of the repository representing the history of a file beyond renames.
27-
/// </summary>
28-
/// <param name="path">The file's path.</param>
29-
/// <param name="filter">The options used to control which commits will be returned.</param>
30-
/// <returns>A list of file history entries, ready to be enumerated.</returns>
31-
[Obsolete("This method is deprecated. Please use the overload which take LibGit2Sharp.CommitFilter")]
32-
IEnumerable<LogEntry> QueryBy(string path, FollowFilter filter);
33-
3425
/// <summary>
3526
/// Returns the list of commits of the repository representing the history of a file beyond renames.
3627
/// </summary>

LibGit2Sharp/IRepository.cs

Lines changed: 0 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -69,44 +69,6 @@ public interface IRepository : IDisposable
6969
/// </summary>
7070
SubmoduleCollection Submodules { get; }
7171

72-
/// <summary>
73-
/// Checkout the commit pointed at by the tip of the specified <see cref="Branch"/>.
74-
/// <para>
75-
/// If this commit is the current tip of the branch as it exists in the repository, the HEAD
76-
/// will point to this branch. Otherwise, the HEAD will be detached, pointing at the commit sha.
77-
/// </para>
78-
/// </summary>
79-
/// <param name="branch">The <see cref="Branch"/> to check out.</param>
80-
/// <param name="options"><see cref="CheckoutOptions"/> controlling checkout behavior.</param>
81-
/// <returns>The <see cref="Branch"/> that was checked out.</returns>
82-
[Obsolete("This method is deprecated. Please use LibGit2Sharp.Commands.Checkout()")]
83-
Branch Checkout(Branch branch, CheckoutOptions options);
84-
85-
/// <summary>
86-
/// Checkout the specified branch, reference or SHA.
87-
/// <para>
88-
/// If the committishOrBranchSpec parameter resolves to a branch name, then the checked out HEAD will
89-
/// will point to the branch. Otherwise, the HEAD will be detached, pointing at the commit sha.
90-
/// </para>
91-
/// </summary>
92-
/// <param name="committishOrBranchSpec">A revparse spec for the commit or branch to checkout.</param>
93-
/// <param name="options"><see cref="CheckoutOptions"/> controlling checkout behavior.</param>
94-
/// <returns>The <see cref="Branch"/> that was checked out.</returns>
95-
[Obsolete("This method is deprecated. Please use LibGit2Sharp.Commands.Checkout()")]
96-
Branch Checkout(string committishOrBranchSpec, CheckoutOptions options);
97-
98-
/// <summary>
99-
/// Checkout the specified <see cref="LibGit2Sharp.Commit"/>.
100-
/// <para>
101-
/// Will detach the HEAD and make it point to this commit sha.
102-
/// </para>
103-
/// </summary>
104-
/// <param name="commit">The <see cref="LibGit2Sharp.Commit"/> to check out.</param>
105-
/// <param name="options"><see cref="CheckoutOptions"/> controlling checkout behavior.</param>
106-
/// <returns>The <see cref="Branch"/> that was checked out.</returns>
107-
[Obsolete("This method is deprecated. Please use LibGit2Sharp.Commands.Checkout()")]
108-
Branch Checkout(Commit commit, CheckoutOptions options);
109-
11072
/// <summary>
11173
/// Checkout the specified tree.
11274
/// </summary>
@@ -275,112 +237,6 @@ public interface IRepository : IDisposable
275237
/// <returns>The blame for the file.</returns>
276238
BlameHunkCollection Blame(string path, BlameOptions options);
277239

278-
/// <summary>
279-
/// Promotes to the staging area the latest modifications of a file in the working directory (addition, updation or removal).
280-
///
281-
/// If this path is ignored by configuration then it will not be staged unless <see cref="StageOptions.IncludeIgnored"/> is unset.
282-
/// </summary>
283-
/// <param name="path">The path of the file within the working directory.</param>
284-
/// <param name="stageOptions">Determines how paths will be staged.</param>
285-
[Obsolete("This method is deprecated. Please use LibGit2Sharp.Commands.Stage()")]
286-
void Stage(string path, StageOptions stageOptions);
287-
288-
/// <summary>
289-
/// Promotes to the staging area the latest modifications of a collection of files in the working directory (addition, updation or removal).
290-
///
291-
/// Any paths (even those listed explicitly) that are ignored by configuration will not be staged unless <see cref="StageOptions.IncludeIgnored"/> is unset.
292-
/// </summary>
293-
/// <param name="paths">The collection of paths of the files within the working directory.</param>
294-
/// <param name="stageOptions">Determines how paths will be staged.</param>
295-
[Obsolete("This method is deprecated. Please use LibGit2Sharp.Commands.Stage()")]
296-
void Stage(IEnumerable<string> paths, StageOptions stageOptions);
297-
298-
/// <summary>
299-
/// Removes from the staging area all the modifications of a file since the latest commit (addition, updation or removal).
300-
/// </summary>
301-
/// <param name="path">The path of the file within the working directory.</param>
302-
/// <param name="explicitPathsOptions">
303-
/// The passed <paramref name="path"/> will be treated as explicit paths.
304-
/// Use these options to determine how unmatched explicit paths should be handled.
305-
/// </param>
306-
[Obsolete("This method is deprecated. Please use LibGit2Sharp.Commands.Unstage()")]
307-
void Unstage(string path, ExplicitPathsOptions explicitPathsOptions);
308-
309-
/// <summary>
310-
/// Removes from the staging area all the modifications of a collection of file since the latest commit (addition, updation or removal).
311-
/// </summary>
312-
/// <param name="paths">The collection of paths of the files within the working directory.</param>
313-
/// <param name="explicitPathsOptions">
314-
/// The passed <paramref name="paths"/> will be treated as explicit paths.
315-
/// Use these options to determine how unmatched explicit paths should be handled.
316-
/// </param>
317-
[Obsolete("This method is deprecated. Please use LibGit2Sharp.Commands.Unstage()")]
318-
void Unstage(IEnumerable<string> paths, ExplicitPathsOptions explicitPathsOptions);
319-
320-
/// <summary>
321-
/// Moves and/or renames a file in the working directory and promotes the change to the staging area.
322-
/// </summary>
323-
/// <param name="sourcePath">The path of the file within the working directory which has to be moved/renamed.</param>
324-
/// <param name="destinationPath">The target path of the file within the working directory.</param>
325-
[Obsolete("This method is deprecatd. Please use LibGit2Sharp.Commands.Move()")]
326-
void Move(string sourcePath, string destinationPath);
327-
328-
/// <summary>
329-
/// Moves and/or renames a collection of files in the working directory and promotes the changes to the staging area.
330-
/// </summary>
331-
/// <param name="sourcePaths">The paths of the files within the working directory which have to be moved/renamed.</param>
332-
/// <param name="destinationPaths">The target paths of the files within the working directory.</param>
333-
[Obsolete("This method is deprecatd. Please use LibGit2Sharp.Commands.Move()")]
334-
void Move(IEnumerable<string> sourcePaths, IEnumerable<string> destinationPaths);
335-
336-
/// <summary>
337-
/// Removes a file from the staging area, and optionally removes it from the working directory as well.
338-
/// <para>
339-
/// If the file has already been deleted from the working directory, this method will only deal
340-
/// with promoting the removal to the staging area.
341-
/// </para>
342-
/// <para>
343-
/// The default behavior is to remove the file from the working directory as well.
344-
/// </para>
345-
/// <para>
346-
/// When not passing a <paramref name="explicitPathsOptions"/>, the passed path will be treated as
347-
/// a pathspec. You can for example use it to pass the relative path to a folder inside the working directory,
348-
/// so that all files beneath this folders, and the folder itself, will be removed.
349-
/// </para>
350-
/// </summary>
351-
/// <param name="path">The path of the file within the working directory.</param>
352-
/// <param name="removeFromWorkingDirectory">True to remove the file from the working directory, False otherwise.</param>
353-
/// <param name="explicitPathsOptions">
354-
/// The passed <paramref name="path"/> will be treated as an explicit path.
355-
/// Use these options to determine how unmatched explicit paths should be handled.
356-
/// </param>
357-
[Obsolete("This method is deprecated. Please use LibGit2Sharp.Commands.Remove()")]
358-
void Remove(string path, bool removeFromWorkingDirectory, ExplicitPathsOptions explicitPathsOptions);
359-
360-
/// <summary>
361-
/// Removes a collection of fileS from the staging, and optionally removes them from the working directory as well.
362-
/// <para>
363-
/// If a file has already been deleted from the working directory, this method will only deal
364-
/// with promoting the removal to the staging area.
365-
/// </para>
366-
/// <para>
367-
/// The default behavior is to remove the files from the working directory as well.
368-
/// </para>
369-
/// <para>
370-
/// When not passing a <paramref name="explicitPathsOptions"/>, the passed paths will be treated as
371-
/// a pathspec. You can for example use it to pass the relative paths to folders inside the working directory,
372-
/// so that all files beneath these folders, and the folders themselves, will be removed.
373-
/// </para>
374-
/// </summary>
375-
/// <param name="paths">The collection of paths of the files within the working directory.</param>
376-
/// <param name="removeFromWorkingDirectory">True to remove the files from the working directory, False otherwise.</param>
377-
/// <param name="explicitPathsOptions">
378-
/// The passed <paramref name="paths"/> will be treated as explicit paths.
379-
/// Use these options to determine how unmatched explicit paths should be handled.
380-
/// </param>
381-
[Obsolete("This method is deprecated. Please use LibGit2Sharp.Commands.Unstage()")]
382-
void Remove(IEnumerable<string> paths, bool removeFromWorkingDirectory, ExplicitPathsOptions explicitPathsOptions);
383-
384240
/// <summary>
385241
/// Retrieves the state of a file in the working directory, comparing it against the staging area and the latest commit.
386242
/// </summary>

0 commit comments

Comments
 (0)
0