mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 13:14:59 +00:00
style: add .editorconfig for code formatting. see issu #25
This commit is contained in:
parent
a8eeea4f78
commit
18aaa0a143
225 changed files with 7781 additions and 3911 deletions
|
@ -2,26 +2,32 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace SourceGit.Commands {
|
||||
public partial class QueryStashes : Command {
|
||||
|
||||
namespace SourceGit.Commands
|
||||
{
|
||||
public partial class QueryStashes : Command
|
||||
{
|
||||
|
||||
[GeneratedRegex(@"^Reflog: refs/(stash@\{\d+\}).*$")]
|
||||
private static partial Regex REG_STASH();
|
||||
|
||||
public QueryStashes(string repo) {
|
||||
|
||||
public QueryStashes(string repo)
|
||||
{
|
||||
WorkingDirectory = repo;
|
||||
Context = repo;
|
||||
Args = "stash list --pretty=raw";
|
||||
}
|
||||
|
||||
public List<Models.Stash> Result() {
|
||||
public List<Models.Stash> Result()
|
||||
{
|
||||
Exec();
|
||||
if (_current != null) _stashes.Add(_current);
|
||||
return _stashes;
|
||||
}
|
||||
|
||||
protected override void OnReadline(string line) {
|
||||
if (line.StartsWith("commit ", StringComparison.Ordinal)) {
|
||||
protected override void OnReadline(string line)
|
||||
{
|
||||
if (line.StartsWith("commit ", StringComparison.Ordinal))
|
||||
{
|
||||
if (_current != null && !string.IsNullOrEmpty(_current.Name)) _stashes.Add(_current);
|
||||
_current = new Models.Stash() { SHA = line.Substring(7, 8) };
|
||||
return;
|
||||
|
@ -29,12 +35,17 @@ namespace SourceGit.Commands {
|
|||
|
||||
if (_current == null) return;
|
||||
|
||||
if (line.StartsWith("Reflog: refs/stash@", StringComparison.Ordinal)) {
|
||||
if (line.StartsWith("Reflog: refs/stash@", StringComparison.Ordinal))
|
||||
{
|
||||
var match = REG_STASH().Match(line);
|
||||
if (match.Success) _current.Name = match.Groups[1].Value;
|
||||
} else if (line.StartsWith("Reflog message: ", StringComparison.Ordinal)) {
|
||||
}
|
||||
else if (line.StartsWith("Reflog message: ", StringComparison.Ordinal))
|
||||
{
|
||||
_current.Message = line.Substring(16);
|
||||
} else if (line.StartsWith("author ", StringComparison.Ordinal)) {
|
||||
}
|
||||
else if (line.StartsWith("author ", StringComparison.Ordinal))
|
||||
{
|
||||
Models.User user = Models.User.Invalid;
|
||||
ulong time = 0;
|
||||
Models.Commit.ParseUserAndTime(line.Substring(7), ref user, ref time);
|
||||
|
@ -43,7 +54,7 @@ namespace SourceGit.Commands {
|
|||
}
|
||||
}
|
||||
|
||||
private List<Models.Stash> _stashes = new List<Models.Stash>();
|
||||
private readonly List<Models.Stash> _stashes = new List<Models.Stash>();
|
||||
private Models.Stash _current = null;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue