Exemplo n.º 1
0
 internal static bool CanRecommend(SVNLogEntry entry)
 {
     if (entry == null)
     {
         return false;
     }
     if (!entry.Source.Enabled)
     {
         return false;
     }
     if (entry.Source.IsURL)
     {
         return false;
     }
     if (entry.Recommended)
     {
         return false;
     }
     if (entry.Source.IsFileURL)
     {
         return false;
     }
     if (!entry.Source.EnableRecommendations)
     {
         return false;
     }
     return true;
 }
Exemplo n.º 2
0
 internal static bool CanCopyMessageToClipboard(SVNLogEntry entry)
 {
     if (entry == null)
     {
         return false;
     }
     return !string.IsNullOrEmpty(entry.Message);
 }
Exemplo n.º 3
0
 public virtual void RunTest()
 {
     List<SVNLogEntry> list = new List<SVNLogEntry>();
     Source tempLocal0 = new Source
     {
         Name = "SVNMonitor"
     };
     Source source = tempLocal0;
     SVNLogEntry entry = new SVNLogEntry(source, 0x4d2L, "Chuck", DateTime.Now, "Fixed all bugs in the world.");
     list.Add(entry);
     EventLog.LogInfo(string.Format("Testing '{0}'...", DisplayName), this);
     Run(list, null);
 }
Exemplo n.º 4
0
 internal static bool CanRollback(SVNLogEntry entry)
 {
     if (entry == null)
     {
         return false;
     }
     if (entry.Source.IsURL)
     {
         return false;
     }
     if (entry.Unread)
     {
         return false;
     }
     return true;
 }
 public static void ShowLogEntryDetails(ILogEntriesView view, SVNLogEntry entry)
 {
     LogEntryDetailsDialog dialog;
     var predicate = GetPredicate(entry);
     if (OpenDialogs.Any(predicate))
     {
         dialog = OpenDialogs.Where(predicate).First();
     }
     else
     {
         dialog = new LogEntryDetailsDialog(view, entry);
         OpenDialogs.Add(dialog);
     }
     if (dialog.WindowState == FormWindowState.Minimized)
     {
         dialog.WindowState = FormWindowState.Normal;
     }
     dialog.Show();
     dialog.Activate();
 }
Exemplo n.º 6
0
 internal static bool CanOpenSVNLog(SVNLogEntry entry)
 {
     return (entry != null);
 }
Exemplo n.º 7
0
 internal static bool CanDiff(SVNLogEntry entry)
 {
     return (entry != null);
 }
Exemplo n.º 8
0
 internal static bool CanCopyToClipboard(SVNLogEntry entry)
 {
     return (entry != null);
 }
Exemplo n.º 9
0
 internal static bool CanCopyPaths(SVNLogEntry entry)
 {
     return (entry != null);
 }
Exemplo n.º 10
0
 public SVNPath(SVNLogEntry logEntry, SVNAction action, string name)
 {
     LogEntry = logEntry;
     Action = action;
     Name = name;
 }
Exemplo n.º 11
0
 internal static bool CanSVNUpdate(SVNLogEntry entry)
 {
     if (entry == null)
     {
         return false;
     }
     if (entry.Source.IsURL)
     {
         return false;
     }
     return true;
 }
Exemplo n.º 12
0
 private static SVNLog SharpSVNToSVNLog(Source source, Collection<SvnLogEventArgs> collection, SVNInfo info, Collection<SvnStatusEventArgs> statusCollection)
 {
     SVNLog log = new SVNLog();
     Dictionary<string, SvnStatusEventArgs> statusMap = GetStatusMap(statusCollection);
     foreach (SvnLogEventArgs logItem in collection)
     {
         DateTime localTime = logItem.Time.ToLocalTime();
         SVNLogEntry entry = new SVNLogEntry(source, logItem.Revision, logItem.Author, localTime, logItem.LogMessage);
         SvnChangeItemCollection items = logItem.ChangedPaths;
         if (items != null)
         {
             List<SVNPath> paths = new List<SVNPath>();
             foreach (SvnChangeItem item in items)
             {
                 SVNPath path = new SVNPath(entry, SVNActionConverter.ToSVNAction(item.Action), item.Path);
                 string pathName = item.Path;
                 if (pathName.StartsWith("/"))
                 {
                     pathName = pathName.Substring(1);
                 }
                 string pathUri = info.RepositoryRoot + pathName;
                 path.Uri = pathUri;
                 if (statusMap.ContainsKey(pathUri))
                 {
                     SvnStatusEventArgs statusItem = statusMap[pathUri];
                     path.FilePath = statusItem.FullPath;
                 }
                 else
                 {
                     string filePath = SVNPath.GuessFilePath(entry, path.Name, info);
                     if (FileSystemHelper.Exists(filePath))
                     {
                         path.FilePath = filePath;
                     }
                     else
                     {
                         path.FilePath = pathUri;
                     }
                 }
                 paths.Add(path);
             }
             entry.Paths = paths;
             log.LogEntries.Add(entry);
         }
     }
     return log;
 }
Exemplo n.º 13
0
 public LogEntryDetailsDialog(ILogEntriesView view, SVNLogEntry entry)
     : this()
 {
     ParentView = view;
     LogEntry = entry;
 }
Exemplo n.º 14
0
 private static Func<LogEntryDetailsDialog, bool> GetPredicate(SVNLogEntry entry)
 {
     return d => (d.LogEntry == entry);
 }
Exemplo n.º 15
0
 internal static string GuessFilePath(SVNLogEntry logEntry, string name, SVNInfo info)
 {
     if (info == null)
     {
         return name;
     }
     if (logEntry.Source.IsURL)
     {
         return (info.RepositoryRoot + name);
     }
     if (FileSystemHelper.FileExists(info.Path))
     {
         return info.Path;
     }
     string sourcePath = logEntry.Source.Path;
     string target = null;
     string fileProtocol = "file:///";
     if (info.URL.Contains(fileProtocol))
     {
         target = name;
         if (target.StartsWith(fileProtocol))
         {
             target = target.Substring(fileProtocol.Length);
         }
         else
         {
             string rootBase = info.URL.Substring(info.RepositoryRoot.Length);
             if (rootBase.Length <= target.Length)
             {
                 target = target.Substring(rootBase.Length);
                 if (target.StartsWith("/"))
                 {
                     target = target.Substring(1, target.Length - 1);
                 }
                 target = Path.Combine(sourcePath, target);
             }
         }
     }
     if (target == null)
     {
         target = name.Trim().Replace('/', '\\');
         string rootBase = info.URL.Substring(info.RepositoryRoot.Length);
         if (string.IsNullOrEmpty(rootBase))
         {
             target = target.TrimStart(new[]
             {
                 '\\'
             });
             target = Path.Combine(sourcePath, target);
         }
         else if (name.Length > rootBase.Length)
         {
             target = sourcePath + name.Substring(rootBase.Length);
         }
     }
     try
     {
         target = FileSystemHelper.GetFullPath(target);
     }
     catch (Exception ex)
     {
         Logger.Log.Error(string.Format("Error in System.IO.Path.GetFullPath (source={0}, sourcePath={1}, target={2})", logEntry.Source, sourcePath, target), ex);
     }
     return target;
 }
Exemplo n.º 16
0
 internal static bool CanRunAuthorWizard(SVNLogEntry entry)
 {
     return (entry != null);
 }
Exemplo n.º 17
0
 internal static bool CanShowDetails(SVNLogEntry entry)
 {
     return (entry != null);
 }
Exemplo n.º 18
0
 private void CreateTipTextForSingleLogEntry(SVNLogEntry logEntry)
 {
     StringBuilder sb = new StringBuilder();
     sb.AppendFormat("{0} has updated {1}:{2}", logEntry.Author, logEntry.SourceName, Environment.NewLine);
     sb.AppendLine(logEntry.Message);
     int count = logEntry.Paths.Count;
     sb.AppendFormat("({0} item{1} updated)", count, (count == 1) ? string.Empty : "s");
     TipText = sb.ToString();
 }