Exemplo n.º 1
0
 TestFileResult BeforeCheckOutCreateFile(string vcsPath, string localPath, bool ignoreSharedFiles, TrackBranch branch)
 {
     if (!branch.IsTrackingVcsPath(vcsPath))
     {
         return(TestFileResult.Ignore);
     }
     return(PerformSimpleTestBeforeCheckout(vcsPath, ignoreSharedFiles, false, false));
 }
Exemplo n.º 2
0
        TestFileResult BeforeCheckOutMoveFile(string vcsPath, string newVcsPath, string localPath, string newLocalPath, bool ignoreSharedFiles, TrackBranch branch, TrackItem trackItem, TrackItem newTrackItem, ref SyncAction newAction)
        {
            if (trackItem.IsFile)
            {
                Log.Error($"Moving individually synchronized files is forbidden. Remove {trackItem.ProjectPath} from track config first or do it usimg vcs.");
                return(TestFileResult.Fail);
            }

            bool isOldPathTracking = branch.IsTrackingVcsPath(vcsPath);
            bool isNewPathTracking = branch.IsTrackingVcsPath(newVcsPath);

            if (isOldPathTracking && !PerformHasFileTestBeforeCheckout(vcsPath))
            {
                Log.Error($"Check move capability. Source file {vcsPath} is not found in vcs.");
                return(TestFileResult.Fail);
            }
            if (isNewPathTracking && PerformHasFileTestBeforeCheckout(newVcsPath))
            {
                Log.Error($"Check move capability. Target file {newVcsPath} is found in vcs.");
                return(TestFileResult.Fail);
            }

            if (!isNewPathTracking && !isOldPathTracking)
            {
                return(TestFileResult.Ignore);
            }
            if (isNewPathTracking && !isOldPathTracking)
            {
                newAction = SyncAction.New;
                return(BeforeCheckOutCreateFile(newVcsPath, localPath, ignoreSharedFiles, trackItem));
            }
            else if (!isNewPathTracking && isOldPathTracking)
            {
                newAction = SyncAction.Delete;
                return(BeforeCheckOutDeleteFile(vcsPath, localPath, ignoreSharedFiles, trackItem));
            }

            var oldPathResult = PerformSimpleTestBeforeCheckout(vcsPath, ignoreSharedFiles, false, false);

            if (oldPathResult != TestFileResult.Ok)
            {
                return(oldPathResult);
            }
            return(PerformSimpleTestBeforeCheckout(newVcsPath, ignoreSharedFiles, false, false));
        }
Exemplo n.º 3
0
 TestFileResult BeforeCheckOutModifyFile(string vcsPath, string localPath, bool ignoreSharedFiles, bool singleSharedFile, TrackBranch branch)
 {
     if (!branch.IsTrackingVcsPath(vcsPath))
     {
         return(TestFileResult.Ignore);
     }
     if (!PerformHasFileTestBeforeCheckout(vcsPath))
     {
         Log.Error($"Check modify capability. File {vcsPath} is not found in vcs.");
         return(TestFileResult.Fail);
     }
     return(PerformSimpleTestBeforeCheckout(vcsPath, ignoreSharedFiles, singleSharedFile, true));
 }
Exemplo n.º 4
0
        TestFileResult BeforeCheckOutMoveFile(string vcsPath, string newVcsPath, string localPath, string newLocalPath, bool ignoreSharedFiles, TrackBranch branch, ref SyncAction newAction)
        {
            bool isOldPathTracking = branch.IsTrackingVcsPath(vcsPath);
            bool isNewPathTracking = branch.IsTrackingVcsPath(newVcsPath);

            if (isOldPathTracking && !PerformHasFileTestBeforeCheckout(vcsPath))
            {
                Log.Error($"Check move capability. Source file {vcsPath} is not found in vcs.");
                return(TestFileResult.Fail);
            }
            if (isNewPathTracking && PerformHasFileTestBeforeCheckout(newVcsPath))
            {
                Log.Error($"Check move capability. Target file {newVcsPath} is found in vcs.");
                return(TestFileResult.Fail);
            }

            if (!isNewPathTracking && !isOldPathTracking)
            {
                return(TestFileResult.Ignore);
            }
            if (isNewPathTracking && !isOldPathTracking)
            {
                newAction = SyncAction.New;
                return(BeforeCheckOutCreateFile(newVcsPath, localPath, ignoreSharedFiles, branch));
            }
            else if (!isNewPathTracking && isOldPathTracking)
            {
                newAction = SyncAction.Delete;
                return(BeforeCheckOutDeleteFile(vcsPath, localPath, ignoreSharedFiles, branch));
            }

            var oldPathResult = PerformSimpleTestBeforeCheckout(vcsPath, ignoreSharedFiles, false, false);

            if (oldPathResult != TestFileResult.Ok)
            {
                return(oldPathResult);
            }
            return(PerformSimpleTestBeforeCheckout(newVcsPath, ignoreSharedFiles, false, false));
        }