Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Belousov <pavel.mephi@gmail.com>2013-11-07 20:42:36 +0400
committerPavel Belousov <pavel.mephi@gmail.com>2013-11-08 07:20:07 +0400
commit2553c80114040517be2495ea081fa6384a60fbb4 (patch)
treefa03cec59959d76f4df42a2a607666f794c430e6 /LibGit2Sharp
parent5e62858541fcb6c0dd708cc61a1488a7fa48d47d (diff)
Deprecated ResetOptions in favor ResetMode.
Diffstat (limited to 'LibGit2Sharp')
-rw-r--r--LibGit2Sharp/Core/NativeMethods.cs2
-rw-r--r--LibGit2Sharp/Core/Proxy.cs2
-rw-r--r--LibGit2Sharp/IRepository.cs9
-rw-r--r--LibGit2Sharp/LibGit2Sharp.csproj1
-rw-r--r--LibGit2Sharp/Repository.cs14
-rw-r--r--LibGit2Sharp/RepositoryExtensions.cs15
-rw-r--r--LibGit2Sharp/ResetMode.cs26
-rw-r--r--LibGit2Sharp/ResetOptions.cs3
8 files changed, 68 insertions, 4 deletions
diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs
index 0f40b959..8fc74056 100644
--- a/LibGit2Sharp/Core/NativeMethods.cs
+++ b/LibGit2Sharp/Core/NativeMethods.cs
@@ -993,7 +993,7 @@ namespace LibGit2Sharp.Core
internal static extern int git_reset(
RepositorySafeHandle repo,
GitObjectSafeHandle target,
- ResetOptions reset_type);
+ ResetMode reset_type);
[DllImport(libgit2)]
internal static extern int git_revparse_ext(
diff --git a/LibGit2Sharp/Core/Proxy.cs b/LibGit2Sharp/Core/Proxy.cs
index da313c8b..1f46e574 100644
--- a/LibGit2Sharp/Core/Proxy.cs
+++ b/LibGit2Sharp/Core/Proxy.cs
@@ -1837,7 +1837,7 @@ namespace LibGit2Sharp.Core
public static void git_reset(
RepositorySafeHandle repo,
ObjectId committishId,
- ResetOptions resetKind)
+ ResetMode resetKind)
{
using (ThreadAffinity())
using (var osw = new ObjectSafeWrapper(committishId, repo))
diff --git a/LibGit2Sharp/IRepository.cs b/LibGit2Sharp/IRepository.cs
index d8350011..a4697949 100644
--- a/LibGit2Sharp/IRepository.cs
+++ b/LibGit2Sharp/IRepository.cs
@@ -170,9 +170,18 @@ namespace LibGit2Sharp
/// </summary>
/// <param name="resetOptions">Flavor of reset operation to perform.</param>
/// <param name="commit">The target commit object.</param>
+ [Obsolete("This method will be removed in the next release. Please use Reset(ResetMode, Commit) instead.")]
void Reset(ResetOptions resetOptions, Commit commit);
/// <summary>
+ /// Sets the current <see cref="Head"/> to the specified commit and optionally resets the <see cref="Index"/> and
+ /// the content of the working tree to match.
+ /// </summary>
+ /// <param name="resetMode">Flavor of reset operation to perform.</param>
+ /// <param name="commit">The target commit object.</param>
+ void Reset(ResetMode resetMode, Commit commit);
+
+ /// <summary>
/// Replaces entries in the <see cref="Repository.Index"/> with entries from the specified commit.
/// </summary>
/// <param name="commit">The target commit object.</param>
diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj
index c0501d55..02e44902 100644
--- a/LibGit2Sharp/LibGit2Sharp.csproj
+++ b/LibGit2Sharp/LibGit2Sharp.csproj
@@ -78,6 +78,7 @@
<Compile Include="PushOptions.cs" />
<Compile Include="Core\GitBuf.cs" />
<Compile Include="FilteringOptions.cs" />
+ <Compile Include="ResetMode.cs" />
<Compile Include="UnbornBranchException.cs" />
<Compile Include="LockedFileException.cs" />
<Compile Include="Core\GitRepositoryInitOptions.cs" />
diff --git a/LibGit2Sharp/Repository.cs b/LibGit2Sharp/Repository.cs
index e9914562..624a7eea 100644
--- a/LibGit2Sharp/Repository.cs
+++ b/LibGit2Sharp/Repository.cs
@@ -790,11 +790,23 @@ namespace LibGit2Sharp
/// </summary>
/// <param name="resetOptions">Flavor of reset operation to perform.</param>
/// <param name="commit">The target commit object.</param>
+ [Obsolete("This method will be removed in the next release. Please use Reset(ResetMode, Commit) instead.")]
public void Reset(ResetOptions resetOptions, Commit commit)
{
+ Reset((ResetMode)resetOptions, commit);
+ }
+
+ /// <summary>
+ /// Sets the current <see cref="Head"/> to the specified commit and optionally resets the <see cref="Index"/> and
+ /// the content of the working tree to match.
+ /// </summary>
+ /// <param name="resetMode">Flavor of reset operation to perform.</param>
+ /// <param name="commit">The target commit object.</param>
+ public void Reset(ResetMode resetMode, Commit commit)
+ {
Ensure.ArgumentNotNull(commit, "commit");
- Proxy.git_reset(handle, commit.Id, resetOptions);
+ Proxy.git_reset(handle, commit.Id, resetMode);
Refs.Log(Refs.Head).Append(commit.Id, string.Format("reset: moving to {0}", commit.Sha));
}
diff --git a/LibGit2Sharp/RepositoryExtensions.cs b/LibGit2Sharp/RepositoryExtensions.cs
index 30e8bb8f..a6f96aff 100644
--- a/LibGit2Sharp/RepositoryExtensions.cs
+++ b/LibGit2Sharp/RepositoryExtensions.cs
@@ -145,13 +145,26 @@ namespace LibGit2Sharp
/// <param name="repository">The <see cref="Repository"/> being worked with.</param>
/// <param name="resetOptions">Flavor of reset operation to perform.</param>
/// <param name="committish">A revparse spec for the target commit object.</param>
+ [Obsolete("This method will be removed in the next release. Please use Reset(this IRepository, ResetMode, string) instead.")]
public static void Reset(this IRepository repository, ResetOptions resetOptions, string committish = "HEAD")
{
+ repository.Reset((ResetMode) resetOptions, committish);
+ }
+
+ /// <summary>
+ /// Sets the current <see cref="Repository.Head"/> to the specified commit and optionally resets the <see cref="Index"/> and
+ /// the content of the working tree to match.
+ /// </summary>
+ /// <param name="repository">The <see cref="Repository"/> being worked with.</param>
+ /// <param name="resetMode">Flavor of reset operation to perform.</param>
+ /// <param name="committish">A revparse spec for the target commit object.</param>
+ public static void Reset(this IRepository repository, ResetMode resetMode, string committish = "HEAD")
+ {
Ensure.ArgumentNotNullOrEmptyString(committish, "committish");
Commit commit = LookUpCommit(repository, committish);
- repository.Reset(resetOptions, commit);
+ repository.Reset(resetMode, commit);
}
/// <summary>
diff --git a/LibGit2Sharp/ResetMode.cs b/LibGit2Sharp/ResetMode.cs
new file mode 100644
index 00000000..f1502891
--- /dev/null
+++ b/LibGit2Sharp/ResetMode.cs
@@ -0,0 +1,26 @@
+namespace LibGit2Sharp
+{
+ /// <summary>
+ /// Specifies the kind of operation that <see cref="IRepository.Reset(LibGit2Sharp.ResetMode, Commit)"/> should perform.
+ /// </summary>
+ public enum ResetMode
+ {
+ /// <summary>
+ /// Moves the branch pointed to by HEAD to the specified commit object.
+ /// </summary>
+ Soft = 1,
+
+ /// <summary>
+ /// Moves the branch pointed to by HEAD to the specified commit object and resets the index
+ /// to the tree recorded by the commit.
+ /// </summary>
+ Mixed,
+
+ /// <summary>
+ /// Moves the branch pointed to by HEAD to the specified commit object, resets the index
+ /// to the tree recorded by the commit and updates the working directory to match the content
+ /// of the index.
+ /// </summary>
+ Hard,
+ }
+}
diff --git a/LibGit2Sharp/ResetOptions.cs b/LibGit2Sharp/ResetOptions.cs
index 8ff26eff..d294adb1 100644
--- a/LibGit2Sharp/ResetOptions.cs
+++ b/LibGit2Sharp/ResetOptions.cs
@@ -1,8 +1,11 @@
+using System;
+
namespace LibGit2Sharp
{
/// <summary>
/// Specifies the kind of operation that <see cref="IRepository.Reset(LibGit2Sharp.ResetOptions, Commit)"/> should perform.
/// </summary>
+ [Obsolete("This enumeration will be removed in the next release. Please use ResetMode instead.")]
public enum ResetOptions
{
/// <summary>