various rearrangements and tweaks
This commit is contained in:
parent
d06de980c8
commit
aea3176846
|
@ -42,13 +42,10 @@ namespace SparkleLib.Git {
|
|||
SparkleGit git = new SparkleGit (TargetFolder, "ls-remote --heads");
|
||||
string branches = git.StartAndReadStandardOutput ();
|
||||
Regex salt_regex = new Regex ("refs/heads/salt-([0-9a-f]+)");
|
||||
|
||||
Match salt_match = salt_regex.Match (branches);
|
||||
|
||||
if (salt_match.Success) {
|
||||
if (salt_match.Success)
|
||||
this.cached_salt = salt_match.Groups [1].Value;
|
||||
SparkleLogger.LogInfo ("SALT", salt_match.Groups [1].Value);
|
||||
}
|
||||
|
||||
// ...if not, create a new salt for the repo
|
||||
if (string.IsNullOrEmpty (this.cached_salt)) {
|
||||
|
|
|
@ -46,7 +46,9 @@ namespace SparkleLib.Git {
|
|||
|
||||
private string branch {
|
||||
get {
|
||||
if (string.IsNullOrEmpty (this.cached_branch)) {
|
||||
if (!string.IsNullOrEmpty (this.cached_branch))
|
||||
return this.cached_branch;
|
||||
|
||||
string rebase_apply_path = new string [] { LocalPath, ".git", "rebase-apply" }.Combine ();
|
||||
|
||||
while (Directory.Exists (rebase_apply_path) && HasLocalChanges) {
|
||||
|
@ -54,13 +56,12 @@ namespace SparkleLib.Git {
|
|||
ResolveConflict ();
|
||||
|
||||
} catch (IOException e) {
|
||||
SparkleLogger.LogInfo ("Git", Name + " | Failed to resolve conflict, trying again... (" + e.Message + ")");
|
||||
SparkleLogger.LogInfo ("Git", Name + " | Failed to resolve conflict, trying again...", e);
|
||||
}
|
||||
}
|
||||
|
||||
SparkleGit git = new SparkleGit (LocalPath, "rev-parse --abbrev-ref HEAD");
|
||||
this.cached_branch = git.StartAndReadStandardOutput ();
|
||||
}
|
||||
|
||||
return this.cached_branch;
|
||||
}
|
||||
|
@ -480,7 +481,7 @@ namespace SparkleLib.Git {
|
|||
ResolveConflict ();
|
||||
|
||||
} catch (IOException e) {
|
||||
SparkleLogger.LogInfo ("Git", Name + " | Failed to resolve conflict, trying again... (" + e.Message + ")");
|
||||
SparkleLogger.LogInfo ("Git", Name + " | Failed to resolve conflict, trying again...", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -967,7 +968,7 @@ namespace SparkleLib.Git {
|
|||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
SparkleLogger.LogInfo ("Git", "Failed preparing directory: " + e.Message);
|
||||
SparkleLogger.LogInfo ("Git", "Failed preparing directory", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1043,7 +1044,7 @@ namespace SparkleLib.Git {
|
|||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
SparkleLogger.LogInfo ("Local", "Error calculating size: " + e.Message);
|
||||
SparkleLogger.LogInfo ("Local", "Error calculating size", e);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1053,7 +1054,7 @@ namespace SparkleLib.Git {
|
|||
size += CalculateSizes (directory);
|
||||
|
||||
} catch (Exception e) {
|
||||
SparkleLogger.LogInfo ("Local", "Error calculating size: " + e.Message);
|
||||
SparkleLogger.LogInfo ("Local", "Error calculating size", e);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -147,6 +147,8 @@ namespace SparkleLib {
|
|||
|
||||
public SparkleRepoBase (string path, SparkleConfig config)
|
||||
{
|
||||
SparkleLogger.LogInfo (path, "Initializing...");
|
||||
|
||||
Status = SyncStatus.Idle;
|
||||
Error = ErrorStatus.None;
|
||||
this.local_config = config;
|
||||
|
|
|
@ -386,13 +386,10 @@ namespace SparkleShare {
|
|||
try {
|
||||
repo = (SparkleRepoBase) Activator.CreateInstance (
|
||||
Type.GetType ("SparkleLib." + backend + ".SparkleRepo, SparkleLib." + backend),
|
||||
new object [] { folder_path, this.config }
|
||||
);
|
||||
new object [] { folder_path, this.config });
|
||||
|
||||
} catch (Exception e) {
|
||||
SparkleLogger.LogInfo ("Controller",
|
||||
"Failed to load '" + backend + "' backend for '" + folder_name + "': " + e.Message);
|
||||
|
||||
SparkleLogger.LogInfo ("Controller", "Failed to load backend '" + backend + "' for '" + folder_name + "': ", e);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,18 +93,18 @@ namespace SparkleShare {
|
|||
}
|
||||
}
|
||||
|
||||
public bool QuitItemEnabled {
|
||||
get {
|
||||
return (CurrentState == IconState.Idle || CurrentState == IconState.Error);
|
||||
}
|
||||
}
|
||||
|
||||
public bool RecentEventsItemEnabled {
|
||||
get {
|
||||
return (Program.Controller.Folders.Count > 0);
|
||||
}
|
||||
}
|
||||
|
||||
public bool QuitItemEnabled {
|
||||
get {
|
||||
return (CurrentState == IconState.Idle || CurrentState == IconState.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public SparkleStatusIconController ()
|
||||
{
|
||||
|
@ -138,8 +138,6 @@ namespace SparkleShare {
|
|||
StateText = "Projects up to date " + FolderSize;
|
||||
}
|
||||
|
||||
UpdateQuitItemEvent (QuitItemEnabled);
|
||||
UpdateStatusItemEvent (StateText);
|
||||
UpdateIconEvent (CurrentState);
|
||||
UpdateMenuEvent (CurrentState);
|
||||
};
|
||||
|
@ -185,8 +183,6 @@ namespace SparkleShare {
|
|||
|
||||
UpdateFolders ();
|
||||
|
||||
UpdateQuitItemEvent (QuitItemEnabled);
|
||||
UpdateStatusItemEvent (StateText);
|
||||
UpdateIconEvent (CurrentState);
|
||||
UpdateMenuEvent (CurrentState);
|
||||
};
|
||||
|
@ -207,6 +203,18 @@ namespace SparkleShare {
|
|||
}
|
||||
|
||||
|
||||
public EventHandler OpenFolderDelegate (string subfolder)
|
||||
{
|
||||
return delegate { SubfolderClicked (subfolder); };
|
||||
}
|
||||
|
||||
|
||||
public EventHandler TryAgainDelegate (string subfolder)
|
||||
{
|
||||
return delegate { TryAgainClicked (subfolder); };
|
||||
}
|
||||
|
||||
|
||||
public void RecentEventsClicked (object sender, EventArgs args)
|
||||
{
|
||||
new Thread (() => {
|
||||
|
@ -237,18 +245,6 @@ namespace SparkleShare {
|
|||
}
|
||||
|
||||
|
||||
public EventHandler OpenFolderDelegate (string subfolder)
|
||||
{
|
||||
return delegate { SubfolderClicked (subfolder); };
|
||||
}
|
||||
|
||||
|
||||
public EventHandler TryAgainDelegate (string subfolder)
|
||||
{
|
||||
return delegate { TryAgainClicked (subfolder); };
|
||||
}
|
||||
|
||||
|
||||
private void UpdateFolders ()
|
||||
{
|
||||
Folders = Program.Controller.Folders.ToArray ();
|
||||
|
|
Loading…
Reference in a new issue