Ejemplo n.º 1
0
        public static void UnrecordFeedback(Versionr.Status.StatusEntry entry, StatusCode code)
        {
            var    previous = Status.GetStatusText(entry);
            var    now      = Status.GetStatusText(code, false, entry.VersionControlRecord != null);
            string output   = "(#" + previous.Item1 + "#" + previous.Item2 + "## => #" + now.Item1 + "#" + now.Item2 + "##)#b# ";

            while (output.Length < 36)
            {
                output = " " + output;
            }
            Printer.PrintMessage(output + entry.CanonicalName);
        }
Ejemplo n.º 2
0
 private string GetStatus(Versionr.Status.StatusEntry x, bool flat = false)
 {
     if (!flat && x.Code == StatusCode.Unversioned)
     {
         return(new string(' ', s_FileLeadingSpaces));
     }
     else
     {
         var    info   = GetStatusText(x);
         string format = (flat) ? "    {0}{1, 12} " : "    {0}{1, -11} ";
         return(String.Format(format, "#" + info.Item1 + "#", info.Item2 + ":"));
     }
 }
Ejemplo n.º 3
0
        protected void RecordFeedback(Versionr.Status.StatusEntry entry, StatusCode code, bool auto)
        {
            string name  = Workspace.GetLocalCanonicalName(entry.CanonicalName);
            int    index = name.LastIndexOf('/');

            if (index != name.Length - 1)
            {
                name = name.Insert(index + 1, "#b#");
            }
            var    previous = Status.GetStatusText(entry);
            var    now      = Status.GetStatusText(code, true, entry.VersionControlRecord != null);
            string output   = "#" + now.Item1 + "#(" + now.Item2 + ")## ";

            while (output.Length < 20)
            {
                output = " " + output;
            }
            Printer.PrintMessage(output + " " + name + "##" + (auto ? " #q#(auto)##" : ""));
        }
Ejemplo n.º 4
0
 public static Tuple <char, string> GetStatusText(Versionr.Status.StatusEntry x)
 {
     return(GetStatusText(x.Code, x.Staged, x.VersionControlRecord != null));
 }
Ejemplo n.º 5
0
        private void PrintFile(Area ws, string localRestrictedPath, Versionr.Status.StatusEntry x, bool flat = false)
        {
            string name = ws.GetLocalCanonicalName(x.CanonicalName);

            if (FilterOptions.WindowsPaths)
            {
                name = name.Replace('/', '\\');
            }

            if (name != ".vrmeta" && localRestrictedPath != null)
            {
                name = name.Substring(localRestrictedPath.Length);
            }

            int index = name.LastIndexOf('/');

            if (index != name.Length - 1)
            {
                name = name.Insert(index + 1, "#b#");
            }
            if (name.Length == 0)
            {
                name = "#q#<parent directory>##";
            }
            if (x.IsSymlink)
            {
                name += " #q# -> " + (x.FilesystemEntry != null ? x.FilesystemEntry.SymlinkTarget : x.VersionControlRecord.Fingerprint);
            }
            string ro = string.Empty;

            if (x.FilesystemEntry != null && x.FilesystemEntry.Attributes.HasFlag(Versionr.Objects.Attributes.ReadOnly))
            {
                if (x.VersionControlRecord != null && !x.VersionControlRecord.Attributes.HasFlag(Versionr.Objects.Attributes.ReadOnly))
                {
                    ro = " #q#(#b#+#q# read only)##";
                }
                else
                {
                    ro = " #q#(read only)##";
                }
            }
            Printer.WriteLineMessage("{1}##{0}{2}", name, GetStatus(x, flat), ro);
            if (x.Code == StatusCode.Renamed || x.Code == StatusCode.Copied)
            {
                Printer.WriteLineMessage("                  #q#<== {0}", x.VersionControlRecord.CanonicalName);
            }
            if (LocalOptions.RecordInfo && !x.IsDirectory)
            {
                if (x.VersionControlRecord != null)
                {
                    if (x.Code == StatusCode.Unchanged)
                    {
                        Printer.WriteLineMessage(" Record ID: #c#{0}", x.VersionControlRecord.DataIdentifier);
                    }
                    else if (x.Code == StatusCode.Copied || x.Code == StatusCode.Renamed)
                    {
                        Printer.WriteLineMessage(" Record ID: #c#{0} (duplicated)", x.VersionControlRecord.DataIdentifier);
                    }
                    else
                    {
                        Printer.WriteLineMessage(" Record ID: #w#{0} (stale)", x.VersionControlRecord.DataIdentifier);
                    }
                }
                else
                {
                    Printer.WriteLineMessage(" Record ID: #w#(new - computed: {0}-{1})##", x.FilesystemEntry.Hash, x.FilesystemEntry.Length);
                }
            }
        }