コード例 #1
0
        /// <summary>
        /// Start doing whatever is needed for the supported type of action.
        /// </summary>
        /// <returns>'true' if the caller expects the main window to be shown, otherwise 'false'.</returns>
        public void StartWorking(Dictionary <string, string> commandLineArgs)
        {
            // "obtain"; // -p <$fwroot>
            _pathToRepository = commandLineArgs[CommandLineProcessor.projDir];
            CloneResult result;

            using (var form = new Form())
            {
                var getSharedProjectModel = new GetSharedProjectModel();
                result = getSharedProjectModel.GetSharedProjectUsing(form, _pathToRepository, null, ProjectFilter,
                                                                     ChorusHubQuery, _pathToRepository, Utilities.OtherRepositories,
                                                                     CommonResources.kHowToSendReceiveExtantRepository);
            }

            if (result == null ||          // Not sure it can be null, but I (RBR) have a null ref crash report (LT-15094)
                string.IsNullOrWhiteSpace(result.ActualLocation) ||                  // Not sure it can be null, but I (RBR) have a null ref crash report (LT-15094)
                result.CloneStatus != CloneStatus.Created)
            {
                return;
            }

            _currentStrategy = GetCurrentStrategy(result.ActualLocation);
            //If the repository has 0 commits neither the Project or Lift filters will identify it and the strategy will be null
            if (_currentStrategy == null || _currentStrategy.IsRepositoryEmpty(result.ActualLocation))
            {
                Directory.Delete(result.ActualLocation, true);                 // Don't want the newly created empty folder to hang around and mess us up!
                MessageBox.Show(CommonResources.kEmptyRepoMsg, CommonResources.kRepoProblem);
                return;
            }

            _currentStrategy.FinishCloning(commandLineArgs, result.ActualLocation, null);
        }
コード例 #2
0
        /// <summary>
        /// Start doing whatever is needed for the supported type of action.
        /// </summary>
        public void StartWorking(Dictionary <string, string> commandLineArgs)
        {
            // -p <$fwroot>\foo where 'foo' is the project folder name
            var pOption       = commandLineArgs["-p"];
            var otherReposDir = Path.Combine(pOption, Utilities.OtherRepositories);

            if (!Directory.Exists(otherReposDir))
            {
                Directory.CreateDirectory(otherReposDir);
            }

            var         desiredCloneLocation = Utilities.LiftOffset(pOption);
            CloneResult result;

            using (var form = new Form())
            {
                var getSharedProjectModel = new GetSharedProjectModel();
                result = getSharedProjectModel.GetSharedProjectUsing(form,
                                                                     otherReposDir,                                      // Folder to put the clone in
                                                                     desiredCloneLocation,                               // Desired location for new clone
                                                                     ProjectFilter,                                      // Lift repo filter
                                                                     HubQuery,                                           // If it goes to Chorus Hub, use this filter
                                                                     commandLineArgs["-projDir"],                        // <$fwroot> main project folder, used to find all main project repo ids.
                                                                     Utilities.OtherRepositories,                        // subfolder of each FW project folder, in which to look for additional repo ids.
                                                                     CommonResources.kHowToSendReceiveExtantRepository); // Some message to use to let user know a repo exists.
            }

            if (result.CloneStatus != CloneStatus.Created)
            {
                return;
            }

            if (IsRepositoryEmpty(result.ActualLocation))
            {
                Directory.Delete(result.ActualLocation, true);                 // Don't want the newly created empty folder to hang around and mess us up!
                MessageBox.Show(CommonResources.kEmptyRepoMsg, CommonResources.kRepoProblem);
                return;
            }

            FinishCloning(commandLineArgs,
                          result.ActualLocation,
                          desiredCloneLocation);       // May, or may not, exist.
        }