-
Notifications
You must be signed in to change notification settings - Fork 204
/
Copy pathRebase.cs
63 lines (54 loc) · 1.43 KB
/
Rebase.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System.Threading.Tasks;
namespace SourceGit.ViewModels
{
public class Rebase : Popup
{
public Models.Branch Current
{
get;
private set;
}
public object On
{
get;
private set;
}
public bool AutoStash
{
get;
set;
}
public Rebase(Repository repo, Models.Branch current, Models.Branch on)
{
_repo = repo;
_revision = on.Head;
Current = current;
On = on;
AutoStash = true;
}
public Rebase(Repository repo, Models.Branch current, Models.Commit on)
{
_repo = repo;
_revision = on.SHA;
Current = current;
On = on;
AutoStash = true;
}
public override Task<bool> Sure()
{
_repo.SetWatcherEnabled(false);
ProgressDescription = "Rebasing ...";
var log = _repo.CreateLog("Rebase");
Use(log);
return Task.Run(() =>
{
new Commands.Rebase(_repo.FullPath, _revision, AutoStash).Use(log).Exec();
log.Complete();
CallUIThread(() => _repo.SetWatcherEnabled(true));
return true;
});
}
private readonly Repository _repo;
private readonly string _revision;
}
}