[repo] massive cleanup, use GitSharp and SparkleGit
This commit is contained in:
parent
de69954bc0
commit
53294eb351
|
@ -8,6 +8,7 @@ SOURCES = \
|
||||||
SparkleCommit.cs \
|
SparkleCommit.cs \
|
||||||
SparkleEvents.cs \
|
SparkleEvents.cs \
|
||||||
SparkleFetcher.cs \
|
SparkleFetcher.cs \
|
||||||
|
SparkleGit.cs \
|
||||||
SparkleHelpers.cs \
|
SparkleHelpers.cs \
|
||||||
SparkleListener.cs \
|
SparkleListener.cs \
|
||||||
SparkleOptions.cs \
|
SparkleOptions.cs \
|
||||||
|
|
40
SparkleLib/SparkleGit.cs
Normal file
40
SparkleLib/SparkleGit.cs
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
// SparkleShare, an instant update workflow to Git.
|
||||||
|
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace SparkleLib {
|
||||||
|
|
||||||
|
public class SparkleGit : Process {
|
||||||
|
|
||||||
|
public SparkleGit (string path, string args) : base ()
|
||||||
|
{
|
||||||
|
|
||||||
|
EnableRaisingEvents = true;
|
||||||
|
|
||||||
|
StartInfo.FileName = SparklePaths.GitPath;
|
||||||
|
StartInfo.Arguments = args;
|
||||||
|
StartInfo.RedirectStandardOutput = true;
|
||||||
|
StartInfo.UseShellExecute = false;
|
||||||
|
StartInfo.WorkingDirectory = path;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -76,6 +76,7 @@
|
||||||
<Compile Include="SparkleOptions.cs" />
|
<Compile Include="SparkleOptions.cs" />
|
||||||
<Compile Include="SparkleCommit.cs" />
|
<Compile Include="SparkleCommit.cs" />
|
||||||
<Compile Include="SparkleListener.cs" />
|
<Compile Include="SparkleListener.cs" />
|
||||||
|
<Compile Include="SparkleGit.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
using Meebey.SmartIrc4net;
|
using Meebey.SmartIrc4net;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -25,8 +26,7 @@ namespace SparkleLib {
|
||||||
|
|
||||||
// A persistent connection to the server that
|
// A persistent connection to the server that
|
||||||
// listens for change notifications
|
// listens for change notifications
|
||||||
public class SparkleListener
|
public class SparkleListener {
|
||||||
{
|
|
||||||
|
|
||||||
// FIXME: The IrcClient is a public property because
|
// FIXME: The IrcClient is a public property because
|
||||||
// extending it causes crashes
|
// extending it causes crashes
|
||||||
|
|
|
@ -252,37 +252,32 @@ namespace SparkleLib {
|
||||||
public SparkleRepo (string path) : base (path)
|
public SparkleRepo (string path) : base (path)
|
||||||
{
|
{
|
||||||
|
|
||||||
LocalPath = path;
|
LocalPath = path;
|
||||||
Name = Path.GetFileName (LocalPath);
|
Name = Path.GetFileName (LocalPath);
|
||||||
|
|
||||||
Process = new Process () {
|
RemoteName = Path.GetFileNameWithoutExtension (RemoteOriginUrl);
|
||||||
EnableRaisingEvents = true
|
RemoteOriginUrl = Config ["remote.origin.url"];
|
||||||
};
|
Domain = GetDomain (RemoteOriginUrl);
|
||||||
|
Description = GetDescription ();
|
||||||
Process.StartInfo.FileName = SparklePaths.GitPath;
|
UserName = Config ["user.name"];
|
||||||
Process.StartInfo.RedirectStandardOutput = true;
|
UserEmail = Config ["user.email"];
|
||||||
Process.StartInfo.UseShellExecute = false;
|
|
||||||
Process.StartInfo.WorkingDirectory = LocalPath;
|
|
||||||
|
|
||||||
RemoteName = Path.GetFileNameWithoutExtension (RemoteOriginUrl);
|
|
||||||
RemoteOriginUrl = Config ["remote.origin.url"];
|
|
||||||
Domain = GetDomain (RemoteOriginUrl);
|
|
||||||
Description = GetDescription ();
|
|
||||||
|
|
||||||
UserName = Config ["user.name"];
|
|
||||||
UserEmail = Config ["user.email"];
|
|
||||||
|
|
||||||
if (Head.CurrentCommit == null)
|
if (Head.CurrentCommit == null)
|
||||||
_CurrentHash = null;
|
_CurrentHash = null;
|
||||||
else
|
else
|
||||||
_CurrentHash = Head.CurrentCommit.Hash;
|
_CurrentHash = Head.CurrentCommit.Hash;
|
||||||
|
|
||||||
|
_IsSyncing = false;
|
||||||
|
_IsBuffering = false;
|
||||||
|
_IsPolling = true;
|
||||||
|
_IsFetching = false;
|
||||||
|
_IsPushing = false;
|
||||||
|
_ServerOnline = true;
|
||||||
|
|
||||||
|
HasChanged = false;
|
||||||
|
ChangeLock = new Object ();
|
||||||
|
FetchRequests = 0;
|
||||||
|
|
||||||
_IsSyncing = false;
|
|
||||||
_IsBuffering = false;
|
|
||||||
_IsPolling = true;
|
|
||||||
_IsFetching = false;
|
|
||||||
_IsPushing = false;
|
|
||||||
_ServerOnline = true;
|
|
||||||
|
|
||||||
string unsynced_file_path = SparkleHelpers.CombineMore (LocalPath ,
|
string unsynced_file_path = SparkleHelpers.CombineMore (LocalPath ,
|
||||||
".git", "has_unsynced_changes");
|
".git", "has_unsynced_changes");
|
||||||
|
@ -296,10 +291,6 @@ namespace SparkleLib {
|
||||||
if (_CurrentHash == null)
|
if (_CurrentHash == null)
|
||||||
CreateInitialCommit ();
|
CreateInitialCommit ();
|
||||||
|
|
||||||
HasChanged = false;
|
|
||||||
ChangeLock = new System.Object ();
|
|
||||||
FetchRequests = 0;
|
|
||||||
|
|
||||||
|
|
||||||
// Watch the repository's folder
|
// Watch the repository's folder
|
||||||
Watcher = new FileSystemWatcher (LocalPath) {
|
Watcher = new FileSystemWatcher (LocalPath) {
|
||||||
|
@ -313,15 +304,16 @@ namespace SparkleLib {
|
||||||
Watcher.Deleted += new FileSystemEventHandler (OnFileActivity);
|
Watcher.Deleted += new FileSystemEventHandler (OnFileActivity);
|
||||||
Watcher.Renamed += new RenamedEventHandler (OnFileActivity);
|
Watcher.Renamed += new RenamedEventHandler (OnFileActivity);
|
||||||
|
|
||||||
// Fetch remote changes every minute
|
|
||||||
|
// Listen to the irc channel on the server...
|
||||||
|
Listener = new SparkleListener (Domain, "#" + RemoteName, UserEmail);
|
||||||
|
|
||||||
|
// ...fetch remote changes every 90 seconds if that fails
|
||||||
RemoteTimer = new Timer () {
|
RemoteTimer = new Timer () {
|
||||||
Interval = 60000
|
Interval = 90000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Listen to the irc channel on the server
|
|
||||||
Listener = new SparkleListener (Domain, "#" + RemoteName, UserEmail);
|
|
||||||
|
|
||||||
RemoteTimer.Elapsed += delegate {
|
RemoteTimer.Elapsed += delegate {
|
||||||
|
|
||||||
if (_IsPolling)
|
if (_IsPolling)
|
||||||
|
@ -430,23 +422,14 @@ namespace SparkleLib {
|
||||||
{
|
{
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Checking for remote changes...");
|
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Checking for remote changes...");
|
||||||
|
SparkleGit git = new SparkleGit (LocalPath, "ls-remote origin master");
|
||||||
|
|
||||||
Process process = new Process () {
|
git.Exited += delegate {
|
||||||
EnableRaisingEvents = true
|
|
||||||
};
|
|
||||||
|
|
||||||
process.StartInfo.FileName = SparklePaths.GitPath;
|
if (git.ExitCode != 0)
|
||||||
process.StartInfo.RedirectStandardOutput = true;
|
|
||||||
process.StartInfo.UseShellExecute = false;
|
|
||||||
process.StartInfo.WorkingDirectory = LocalPath;
|
|
||||||
process.StartInfo.Arguments = "ls-remote origin master";
|
|
||||||
|
|
||||||
process.Exited += delegate {
|
|
||||||
|
|
||||||
if (process.ExitCode != 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string remote_hash = process.StandardOutput.ReadToEnd ();
|
string remote_hash = git.StandardOutput.ReadToEnd ();
|
||||||
|
|
||||||
if (!remote_hash.StartsWith (_CurrentHash)) {
|
if (!remote_hash.StartsWith (_CurrentHash)) {
|
||||||
|
|
||||||
|
@ -458,32 +441,8 @@ namespace SparkleLib {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
process.Start ();
|
|
||||||
|
|
||||||
/* FIXME: LsRemoteCommand is not yet implemented by GitSharp
|
git.Start ();
|
||||||
|
|
||||||
LsRemoteCommand ls_remote = new LsRemoteCommand () {
|
|
||||||
Repository = this
|
|
||||||
};
|
|
||||||
|
|
||||||
ls_remote.Execute ();
|
|
||||||
|
|
||||||
using (StreamReader reader = new StreamReader (ls_remote.OutputStream.BaseStream))
|
|
||||||
{
|
|
||||||
|
|
||||||
string remote_hash = reader.ReadLine ());
|
|
||||||
|
|
||||||
if (!remote_hash.StartsWith (_CurrentHash)) {
|
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Remote changes found.");
|
|
||||||
|
|
||||||
Fetch ();
|
|
||||||
Rebase ();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,9 +563,10 @@ namespace SparkleLib {
|
||||||
|
|
||||||
// FIXME: this GitSharp method seems to block...
|
// FIXME: this GitSharp method seems to block...
|
||||||
// Index.AddAll ();
|
// Index.AddAll ();
|
||||||
Process.StartInfo.Arguments = "add --all";
|
|
||||||
Process.Start ();
|
SparkleGit git = new SparkleGit (LocalPath, "add --all");
|
||||||
Process.WaitForExit ();
|
git.Start ();
|
||||||
|
git.WaitForExit ();
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Changes staged.");
|
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Changes staged.");
|
||||||
|
|
||||||
|
@ -624,9 +584,9 @@ namespace SparkleLib {
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Collecting garbage...");
|
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Collecting garbage...");
|
||||||
|
|
||||||
Process.StartInfo.Arguments = "gc";
|
SparkleGit git = new SparkleGit (LocalPath, "gc");
|
||||||
Process.Start ();
|
git.Start ();
|
||||||
Process.WaitForExit ();
|
git.WaitForExit ();
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Garbage collected..");
|
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Garbage collected..");
|
||||||
|
|
||||||
|
@ -667,32 +627,9 @@ namespace SparkleLib {
|
||||||
|
|
||||||
RemoteTimer.Stop ();
|
RemoteTimer.Stop ();
|
||||||
|
|
||||||
|
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Fetching changes...");
|
||||||
|
|
||||||
/* FIXME: SSH transport doesn't work with GitSharp
|
SparkleGit git = new SparkleGit (LocalPath, "fetch -v origin master");
|
||||||
try {
|
|
||||||
|
|
||||||
FetchCommand fetch_command = new FetchCommand () {
|
|
||||||
Remote = "origin",
|
|
||||||
Repository = this
|
|
||||||
};
|
|
||||||
|
|
||||||
fetch_command.Execute ();
|
|
||||||
|
|
||||||
} catch (GitSharp.Core.Exceptions.TransportException e) {
|
|
||||||
|
|
||||||
Console.WriteLine ("Nothing to fetch: " + e.Message);
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
Process process = new Process () {
|
|
||||||
EnableRaisingEvents = true
|
|
||||||
};
|
|
||||||
|
|
||||||
process.StartInfo.FileName = SparklePaths.GitPath;
|
|
||||||
process.StartInfo.RedirectStandardOutput = true;
|
|
||||||
process.StartInfo.UseShellExecute = false;
|
|
||||||
process.StartInfo.WorkingDirectory = LocalPath;
|
|
||||||
|
|
||||||
SparkleEventArgs args;
|
SparkleEventArgs args;
|
||||||
args = new SparkleEventArgs ("FetchingStarted");
|
args = new SparkleEventArgs ("FetchingStarted");
|
||||||
|
@ -700,28 +637,22 @@ namespace SparkleLib {
|
||||||
if (FetchingStarted != null)
|
if (FetchingStarted != null)
|
||||||
FetchingStarted (this, args);
|
FetchingStarted (this, args);
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Fetching changes...");
|
|
||||||
|
|
||||||
process.StartInfo.Arguments = "fetch -v origin master";
|
git.Exited += delegate {
|
||||||
|
|
||||||
process.Exited += delegate {
|
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Changes fetched.");
|
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Changes fetched.");
|
||||||
|
|
||||||
args = new SparkleEventArgs ("FetchingFinished");
|
|
||||||
|
|
||||||
_IsSyncing = false;
|
_IsSyncing = false;
|
||||||
_IsFetching = false;
|
_IsFetching = false;
|
||||||
|
|
||||||
if (_IsPolling)
|
|
||||||
RemoteTimer.Start ();
|
|
||||||
|
|
||||||
_CurrentHash = Head.CurrentCommit.Hash;
|
_CurrentHash = Head.CurrentCommit.Hash;
|
||||||
|
|
||||||
if (process.ExitCode != 0) {
|
if (git.ExitCode != 0) {
|
||||||
|
|
||||||
_ServerOnline = false;
|
_ServerOnline = false;
|
||||||
|
|
||||||
|
args = new SparkleEventArgs ("FetchingFailed");
|
||||||
|
|
||||||
if (FetchingFailed != null)
|
if (FetchingFailed != null)
|
||||||
FetchingFailed (this, args);
|
FetchingFailed (this, args);
|
||||||
|
|
||||||
|
@ -729,15 +660,22 @@ namespace SparkleLib {
|
||||||
|
|
||||||
_ServerOnline = true;
|
_ServerOnline = true;
|
||||||
|
|
||||||
|
args = new SparkleEventArgs ("FetchingFinished");
|
||||||
|
|
||||||
if (FetchingFinished != null)
|
if (FetchingFinished != null)
|
||||||
FetchingFinished (this, args);
|
FetchingFinished (this, args);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (_IsPolling)
|
||||||
|
RemoteTimer.Start ();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
process.Start ();
|
|
||||||
process.WaitForExit ();
|
git.Start ();
|
||||||
|
git.WaitForExit ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -758,59 +696,42 @@ namespace SparkleLib {
|
||||||
Watcher.EnableRaisingEvents = false;
|
Watcher.EnableRaisingEvents = false;
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Rebasing changes...");
|
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Rebasing changes...");
|
||||||
|
SparkleGit git = new SparkleGit (LocalPath, "rebase -v FETCH_HEAD");
|
||||||
|
|
||||||
Process.StartInfo.Arguments = "rebase -v FETCH_HEAD";
|
|
||||||
Process.WaitForExit ();
|
|
||||||
Process.Start ();
|
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Changes rebased.");
|
git.Exited += delegate {
|
||||||
|
|
||||||
string output = Process.StandardOutput.ReadToEnd ().Trim ();
|
if (Status.MergeConflict.Count > 0) {
|
||||||
|
|
||||||
if (!output.Contains ("up to date")) {
|
foreach (string problem_file_name in Status.MergeConflict) {
|
||||||
|
|
||||||
if (output.Contains ("Failed to merge")) {
|
SparkleGit git_ours = new SparkleGit (LocalPath,
|
||||||
|
"checkout --ours " + problem_file_name);
|
||||||
|
git_ours.Start ();
|
||||||
|
git_ours.WaitForExit ();
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Resolving conflict...");
|
string timestamp = DateTime.Now.ToString ("H:mm d MMM");
|
||||||
|
|
||||||
Process.StartInfo.Arguments = "status";
|
string new_file_name = problem_file_name + " (" + UserName + ", " + timestamp + ")";
|
||||||
Process.WaitForExit ();
|
File.Move (problem_file_name, new_file_name);
|
||||||
Process.Start ();
|
|
||||||
output = Process.StandardOutput.ReadToEnd ().Trim ();
|
|
||||||
string [] lines = Regex.Split (output, "\n");
|
|
||||||
|
|
||||||
foreach (string line in lines) {
|
SparkleGit git_theirs = new SparkleGit (LocalPath,
|
||||||
|
"checkout --theirs " + problem_file_name);
|
||||||
|
git_theirs.Start ();
|
||||||
|
git_theirs.WaitForExit ();
|
||||||
|
|
||||||
if (line.Contains ("needs merge")) {
|
SparkleEventArgs args = new SparkleEventArgs ("ConflictDetected");
|
||||||
|
|
||||||
string problem_file_name = line.Substring (line.IndexOf (": needs merge"));
|
if (ConflictDetected != null)
|
||||||
|
ConflictDetected (this, args);
|
||||||
Process.StartInfo.Arguments = "checkout --ours " + problem_file_name;
|
|
||||||
Process.WaitForExit ();
|
|
||||||
Process.Start ();
|
|
||||||
|
|
||||||
string timestamp = DateTime.Now.ToString ("H:mm d MMM yyyy");
|
|
||||||
|
|
||||||
File.Move (problem_file_name, problem_file_name + " (" + UserName + ", " + timestamp + ")");
|
|
||||||
|
|
||||||
Process.StartInfo.Arguments = "checkout --theirs " + problem_file_name;
|
|
||||||
Process.WaitForExit ();
|
|
||||||
Process.Start ();
|
|
||||||
|
|
||||||
SparkleEventArgs args = new SparkleEventArgs ("ConflictDetected");
|
|
||||||
|
|
||||||
if (ConflictDetected != null)
|
|
||||||
ConflictDetected (this, args);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Add ();
|
Add ();
|
||||||
|
|
||||||
Process.StartInfo.Arguments = "rebase --continue";
|
SparkleGit git_continue = new SparkleGit (LocalPath, "rebase --continue");
|
||||||
Process.WaitForExit ();
|
git_continue.Start ();
|
||||||
Process.Start ();
|
git_continue.WaitForExit ();
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Conflict resolved.");
|
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Conflict resolved.");
|
||||||
|
|
||||||
|
@ -819,12 +740,18 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List <SparkleCommit> commits = GetCommits (1);
|
_CurrentHash = Head.CurrentCommit.Hash;
|
||||||
|
|
||||||
if (NewCommit != null)
|
if (NewCommit != null)
|
||||||
NewCommit (commits [0], LocalPath);
|
NewCommit (GetCommits (1) [0], LocalPath);
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
|
git.Start ();
|
||||||
|
git.WaitForExit ();
|
||||||
|
|
||||||
|
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Changes rebased.");
|
||||||
|
|
||||||
Watcher.EnableRaisingEvents = true;
|
Watcher.EnableRaisingEvents = true;
|
||||||
|
|
||||||
|
@ -838,49 +765,22 @@ namespace SparkleLib {
|
||||||
_IsSyncing = true;
|
_IsSyncing = true;
|
||||||
_IsPushing = true;
|
_IsPushing = true;
|
||||||
|
|
||||||
|
SparkleGit git = new SparkleGit (LocalPath, "push origin master");
|
||||||
|
|
||||||
|
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Pushing changes...");
|
||||||
|
|
||||||
SparkleEventArgs args = new SparkleEventArgs ("PushingStarted");
|
SparkleEventArgs args = new SparkleEventArgs ("PushingStarted");
|
||||||
|
|
||||||
Process process = new Process () {
|
|
||||||
EnableRaisingEvents = true
|
|
||||||
};
|
|
||||||
|
|
||||||
process.StartInfo.FileName = SparklePaths.GitPath;
|
|
||||||
process.StartInfo.RedirectStandardOutput = true;
|
|
||||||
process.StartInfo.UseShellExecute = false;
|
|
||||||
process.StartInfo.WorkingDirectory = LocalPath;
|
|
||||||
|
|
||||||
if (PushingStarted != null)
|
if (PushingStarted != null)
|
||||||
PushingStarted (this, args);
|
PushingStarted (this, args);
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Pushing changes...");
|
|
||||||
|
|
||||||
/* FIXME: SSH transport doesn't work with GitSharp
|
git.Exited += delegate {
|
||||||
try {
|
|
||||||
|
|
||||||
PushCommand push_command = new PushCommand () {
|
|
||||||
Remote = "origin",
|
|
||||||
Repository = this
|
|
||||||
};
|
|
||||||
|
|
||||||
push_command.Execute ();
|
|
||||||
|
|
||||||
} catch (GitSharp.Core.Exceptions.TransportException e) {
|
|
||||||
|
|
||||||
Console.WriteLine (e.Message);
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
process.StartInfo.Arguments = "push origin master";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
process.Exited += delegate {
|
|
||||||
|
|
||||||
_IsSyncing = false;
|
_IsSyncing = false;
|
||||||
_IsPushing = false;
|
_IsPushing = false;
|
||||||
|
|
||||||
if (process.ExitCode != 0) {
|
if (git.ExitCode != 0) {
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Pushing failed.");
|
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Pushing failed.");
|
||||||
|
|
||||||
|
@ -918,8 +818,9 @@ namespace SparkleLib {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
process.Start ();
|
|
||||||
process.WaitForExit ();
|
git.Start ();
|
||||||
|
git.WaitForExit ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue