fetcher: Fix storage type detection and progress
This commit is contained in:
parent
3cbf97dff5
commit
a9cd7c825d
|
@ -230,12 +230,10 @@ namespace SparkleShare {
|
||||||
progress_speed = SparkleShare.Controller.ProgressSpeedDown.ToSize () + "/s ";
|
progress_speed = SparkleShare.Controller.ProgressSpeedDown.ToSize () + "/s ";
|
||||||
|
|
||||||
if (progress_percentage > 0)
|
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))
|
if (!string.IsNullOrEmpty (SparkleShare.Controller.ProgressInformation))
|
||||||
StateText += string.Format (" {0} – {1}", StateText, SparkleShare.Controller.ProgressInformation);
|
StateText += string.Format ("{0} – {1}", StateText, SparkleShare.Controller.ProgressInformation);
|
||||||
|
|
||||||
SparkleShare.Controller.ProgressInformation)
|
|
||||||
|
|
||||||
UpdateIconEvent (CurrentState);
|
UpdateIconEvent (CurrentState);
|
||||||
UpdateStatusItemEvent (StateText);
|
UpdateStatusItemEvent (StateText);
|
||||||
|
|
|
@ -176,6 +176,8 @@ namespace Sparkles {
|
||||||
|
|
||||||
public virtual string Complete (StorageType storage_type)
|
public virtual string Complete (StorageType storage_type)
|
||||||
{
|
{
|
||||||
|
FetchedRepoStorageType = storage_type;
|
||||||
|
|
||||||
if (IsFetchedRepoEmpty)
|
if (IsFetchedRepoEmpty)
|
||||||
CreateInitialChangeSet ();
|
CreateInitialChangeSet ();
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ namespace Sparkles.Git {
|
||||||
|
|
||||||
|
|
||||||
static Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled);
|
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);
|
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)
|
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);
|
match = progress_regex.Match (line);
|
||||||
|
|
||||||
if (!match.Success && !string.IsNullOrWhiteSpace (line)) {
|
if (!match.Success || string.IsNullOrWhiteSpace (line)) {
|
||||||
Logger.LogInfo ("Git", line);
|
Logger.LogInfo ("Git", line);
|
||||||
return FindError (line);
|
return FindError (line);
|
||||||
}
|
}
|
||||||
|
|
||||||
int number = int.Parse (match.Groups [1].Value);
|
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
|
// objects" stage which we count as 20% of the total progress, and
|
||||||
// the "Writing objects" stage which we count as the last 80%
|
// the "Writing objects" stage which we count as the last 80%
|
||||||
if (line.Contains ("Compressing objects")) {
|
if (line.Contains ("Compressing objects")) {
|
||||||
|
|
|
@ -168,15 +168,15 @@ namespace Sparkles.Git {
|
||||||
|
|
||||||
public override string Complete (StorageType selected_storage_type)
|
public override string Complete (StorageType selected_storage_type)
|
||||||
{
|
{
|
||||||
|
string identifier = base.Complete (selected_storage_type);
|
||||||
|
string identifier_path = Path.Combine (TargetFolder, ".sparkleshare");
|
||||||
|
|
||||||
InstallConfiguration ();
|
InstallConfiguration ();
|
||||||
InstallGitLFS ();
|
InstallGitLFS ();
|
||||||
|
|
||||||
InstallAttributeRules ();
|
InstallAttributeRules ();
|
||||||
InstallExcludeRules ();
|
InstallExcludeRules ();
|
||||||
|
|
||||||
string identifier = base.Complete (selected_storage_type);
|
|
||||||
string identifier_path = Path.Combine (TargetFolder, ".sparkleshare");
|
|
||||||
|
|
||||||
if (IsFetchedRepoEmpty) {
|
if (IsFetchedRepoEmpty) {
|
||||||
File.WriteAllText (identifier_path, identifier);
|
File.WriteAllText (identifier_path, identifier);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue