Beispiel #1
0
        /// <summary>
        /// If the repo exists in the foo\OtherRepositories\LIFT folder, then do nothing.
        /// If the repo or the entire folder structure does not yet exist,
        /// then ask FLEx Bridge to move the previous lift repo to the new home,
        /// it is exists.
        /// </summary>
        /// <remarks>
        /// <para>If the call to FLEx Bridge returns the pathname to the lift file (_liftPathname), we know the move took place,
        /// and we have the lift file that is in the repository. That lift file's name may or may not match the FW project name,
        /// but it ought not matter if it does or does not match.</para>
        /// <para>If the call returned null, we know the move did not take place.
        /// In this case the caller of this method will continue on and probably create a new repository,
        ///	thus doing the equivalent of the original Lift Bridge code where there FLEx user started a S/R lift system.</para>
        /// </remarks>
        /// <returns>'true' if the the move succeeded, or if there was no need to do the move. The caller code will continue its work.
        /// Return 'false', if the calling code should quit its work.</returns>
        private bool MoveOldLiftRepoIfNeeded()
        {
            var projectFolder  = Cache.ProjectId.ProjectFolder;
            var liftProjectDir = GetLiftRepositoryFolderFromFwProjectFolder(projectFolder);

            // It is fine to try the repo move if the liftProjectDir exists, but *only* if it is completely empty.
            // Mercurial can't do a clone into a folder that has contents of any sort.
            if (Directory.Exists(liftProjectDir) && (Directory.GetDirectories(liftProjectDir).Length > 0 || Directory.GetFiles(liftProjectDir).Length > 0))
            {
                return(true);
            }

            bool dummyDataChanged;
            // flexbridge -p <path to fwdata file> -u <username> -v move_lift -g Langprojguid
            var success = FLExBridgeHelper.LaunchFieldworksBridge(
                Path.Combine(projectFolder, Cache.ProjectId.Name + FwFileExtensions.ksFwDataXmlFileExtension),
                Environment.UserName,
                FLExBridgeHelper.MoveLift,
                Cache.LanguageProject.Guid.ToString().ToLowerInvariant(),
                out dummyDataChanged, out _liftPathname);                 // _liftPathname will be null, if no repo was moved.

            if (!success)
            {
                ChooseLangProjectDialog.ReportDuplicateBridge();
                _liftPathname = null;
                return(false);
            }

            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// Do the S/R. This *may* actually create the Lift repository, if it doesn't exist, or it may do a more normal S/R
        /// </summary>
        /// <returns>'true' if the S/R succeed, otherwise 'false'.</returns>
        private bool DoSendReceiveForLift(out bool dataChanged)
        {
            var projectFolder  = Cache.ProjectId.ProjectFolder;
            var liftProjectDir = GetLiftRepositoryFolderFromFwProjectFolder(projectFolder);

            if (!Directory.Exists(liftProjectDir))
            {
                Directory.CreateDirectory(liftProjectDir);
            }
            var    savedState = PrepareToDetectConflicts(liftProjectDir);
            string dummy;
            // flexbridge -p <path to fwdata file> -u <username> -v send_receive_lift
            var success = FLExBridgeHelper.LaunchFieldworksBridge(
                Path.Combine(projectFolder, Cache.ProjectId.Name + FwFileExtensions.ksFwDataXmlFileExtension),
                Environment.UserName,
                FLExBridgeHelper.SendReceiveLift,                 // May create a new lift repo in the process of doing the S/R. Or, it may just use the extant lift repo.
                null,
                out dataChanged, out dummy);

            if (!success)
            {
                ChooseLangProjectDialog.ReportDuplicateBridge();
                dataChanged   = false;
                _liftPathname = null;
                return(false);
            }

            _liftPathname = GetLiftPathname(liftProjectDir);

            if (_liftPathname == null)
            {
                dataChanged = false;                 // If there is no lift file, there cannot be any new data.
                return(false);
            }

            return(true);
        }
Beispiel #3
0
 private static void ReportDuplicateBridge()
 {
     ChooseLangProjectDialog.ReportDuplicateBridge();
 }