예제 #1
0
 public static bool IsInSourceControl(string fileName)
 {
     if (Commands.RegisterEventsCommand.CanBeVersionControlledFile(fileName))
     {
         StatusKind status = OverlayIconManager.GetStatus(fileName);
         return(status != StatusKind.None && status != StatusKind.Unversioned && status != StatusKind.Ignored);
     }
     else
     {
         return(false);
     }
 }
예제 #2
0
        bool Test(Condition condition, string fileName, bool isDirectory)
        {
            string[] allowedStatus = condition.Properties["state"].Split(';');
            if (allowedStatus.Length == 0 || (allowedStatus.Length == 1 && allowedStatus[0].Length == 0))
            {
                return(true);
            }
            string status;

            if (isDirectory ? RegisterEventsCommand.CanBeVersionControlledDirectory(fileName)
                            : RegisterEventsCommand.CanBeVersionControlledFile(fileName))
            {
                status = OverlayIconManager.GetStatus(fileName).ToString();
            }
            else
            {
                status = "Unversioned";
            }

            /*if (status == "Unversioned") {
             *      PropertyDictionary pd = SvnClient.Instance.Client.PropGet("svn:ignore", Path.GetDirectoryName(fileName), Revision.Working, Recurse.None);
             *      if (pd != null) {
             *              string shortFileName = Path.GetFileName(fileName);
             *              foreach (Property p in pd.Values) {
             *                      using (StreamReader r = new StreamReader(new MemoryStream(p.Data))) {
             *                              string line;
             *                              while ((line = r.ReadLine()) != null) {
             *                                      if (string.Equals(line, shortFileName, StringComparison.OrdinalIgnoreCase)) {
             *                                              status = "Ignored";
             *                                              break;
             *                                      }
             *                              }
             *                      }
             *              }
             *      }
             * }*/
            //LoggingService.Debug("Status of " + fileName + " is " + status);
            return(Array.IndexOf(allowedStatus, status) >= 0);
        }
예제 #3
0
        public bool CanAttachTo(ICSharpCode.SharpDevelop.Gui.IViewContent content)
        {
            if (!AddInOptions.UseHistoryDisplayBinding)
            {
                return(false);
            }
            OpenedFile file = content.PrimaryFile;

            if (file == null || file.IsUntitled || !File.Exists(file.FileName))
            {
                return(false);
            }
            if (Commands.RegisterEventsCommand.CanBeVersionControlledFile(file.FileName))
            {
                StatusKind status = OverlayIconManager.GetStatus(file.FileName);
                return(status != StatusKind.None && status != StatusKind.Unversioned && status != StatusKind.Ignored);
            }
            else
            {
                return(false);
            }
        }