fetcher: Fix storage type detection and progress
This commit is contained in:
parent
3cbf97dff5
commit
a9cd7c825d
|
@ -230,13 +230,11 @@ namespace SparkleShare {
|
|||
progress_speed = SparkleShare.Controller.ProgressSpeedDown.ToSize () + "/s ";
|
||||
|
||||
if (progress_percentage > 0)
|
||||
StateText += string.Format (" {0}% {1} – {2}", progress_percentage, progress_speed);
|
||||
StateText += string.Format (" {0}% {1}", progress_percentage, progress_speed);
|
||||
|
||||
if (!string.IsNullOrEmpty (SparkleShare.Controller.ProgressInformation))
|
||||
StateText += string.Format ("{0} – {1}", StateText, SparkleShare.Controller.ProgressInformation);
|
||||
|
||||
SparkleShare.Controller.ProgressInformation)
|
||||
|
||||
UpdateIconEvent (CurrentState);
|
||||
UpdateStatusItemEvent (StateText);
|
||||
UpdateQuitItemEvent (QuitItemEnabled);
|
||||
|
|
|
@ -176,6 +176,8 @@ namespace Sparkles {
|
|||
|
||||
public virtual string Complete (StorageType storage_type)
|
||||
{
|
||||
FetchedRepoStorageType = storage_type;
|
||||
|
||||
if (IsFetchedRepoEmpty)
|
||||
CreateInitialChangeSet ();
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ namespace Sparkles.Git {
|
|||
|
||||
|
||||
static Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled);
|
||||
static Regex progress_regex_lfs = new Regex (@".*([0-9]+) of ([0-9]+).*", RegexOptions.Compiled);
|
||||
static Regex progress_regex_lfs = new Regex (@".*([0-9]+) of ([0-9]+) files.*", RegexOptions.Compiled);
|
||||
static Regex speed_regex = new Regex (@"([0-9\.]+) ([KM])iB/s", RegexOptions.Compiled);
|
||||
|
||||
public static ErrorStatus ParseProgress (string line, out double percentage, out double speed, out string information)
|
||||
|
@ -122,14 +122,14 @@ namespace Sparkles.Git {
|
|||
|
||||
match = progress_regex.Match (line);
|
||||
|
||||
if (!match.Success && !string.IsNullOrWhiteSpace (line)) {
|
||||
if (!match.Success || string.IsNullOrWhiteSpace (line)) {
|
||||
Logger.LogInfo ("Git", line);
|
||||
return FindError (line);
|
||||
}
|
||||
|
||||
int number = int.Parse (match.Groups [1].Value);
|
||||
|
||||
// The pushing progress consists of two stages: the "Compressing
|
||||
// The transfer process consists of two stages: the "Compressing
|
||||
// objects" stage which we count as 20% of the total progress, and
|
||||
// the "Writing objects" stage which we count as the last 80%
|
||||
if (line.Contains ("Compressing objects")) {
|
||||
|
|
|
@ -168,15 +168,15 @@ namespace Sparkles.Git {
|
|||
|
||||
public override string Complete (StorageType selected_storage_type)
|
||||
{
|
||||
string identifier = base.Complete (selected_storage_type);
|
||||
string identifier_path = Path.Combine (TargetFolder, ".sparkleshare");
|
||||
|
||||
InstallConfiguration ();
|
||||
InstallGitLFS ();
|
||||
|
||||
InstallAttributeRules ();
|
||||
InstallExcludeRules ();
|
||||
|
||||
string identifier = base.Complete (selected_storage_type);
|
||||
string identifier_path = Path.Combine (TargetFolder, ".sparkleshare");
|
||||
|
||||
if (IsFetchedRepoEmpty) {
|
||||
File.WriteAllText (identifier_path, identifier);
|
||||
|
||||
|
|
Loading…
Reference in a new issue