repo: add a property that shows the currenly unsynced paths (to hook up with the badger)
This commit is contained in:
parent
0b56e55067
commit
c498347931
|
@ -52,6 +52,34 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override string [] UnsyncedFilePaths {
|
||||||
|
get {
|
||||||
|
List<string> file_paths = new List<string> ();
|
||||||
|
|
||||||
|
SparkleGit git = new SparkleGit (LocalPath, "status --porcelain");
|
||||||
|
git.Start ();
|
||||||
|
|
||||||
|
// Reading the standard output HAS to go before
|
||||||
|
// WaitForExit, or it will hang forever on output > 4096 bytes
|
||||||
|
string output = git.StandardOutput.ReadToEnd ().TrimEnd ();
|
||||||
|
git.WaitForExit ();
|
||||||
|
|
||||||
|
string [] lines = output.Split ("\n".ToCharArray ());
|
||||||
|
foreach (string line in lines) {
|
||||||
|
if (line [1].ToString ().Equals ("M") ||
|
||||||
|
line [1].ToString ().Equals ("?") ||
|
||||||
|
line [1].ToString ().Equals ("A")) {
|
||||||
|
|
||||||
|
string path = line.Substring (3);
|
||||||
|
path = path.Trim ("\"".ToCharArray ());
|
||||||
|
file_paths.Add (path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return file_paths.ToArray ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override string CurrentRevision {
|
public override string CurrentRevision {
|
||||||
get {
|
get {
|
||||||
|
|
||||||
|
|
|
@ -145,6 +145,13 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public virtual string [] UnsyncedFilePaths {
|
||||||
|
get {
|
||||||
|
return new string [0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public string Domain {
|
public string Domain {
|
||||||
get {
|
get {
|
||||||
Regex regex = new Regex (@"(@|://)([a-z0-9\.-]+)(/|:)");
|
Regex regex = new Regex (@"(@|://)([a-z0-9\.-]+)(/|:)");
|
||||||
|
|
|
@ -555,6 +555,11 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
repo.SyncStatusChanged += delegate (SyncStatus status) {
|
repo.SyncStatusChanged += delegate (SyncStatus status) {
|
||||||
|
/* if (status == SyncStatus.SyncUp) {
|
||||||
|
foreach (string path in repo.UnsyncedFilePaths)
|
||||||
|
Console.WriteLine (path);
|
||||||
|
}
|
||||||
|
*/
|
||||||
if (status == SyncStatus.Idle ||
|
if (status == SyncStatus.Idle ||
|
||||||
status == SyncStatus.SyncUp ||
|
status == SyncStatus.SyncUp ||
|
||||||
status == SyncStatus.SyncDown ||
|
status == SyncStatus.SyncDown ||
|
||||||
|
|
Loading…
Reference in a new issue