Пример #1
0
        private void UpdateAllRecursive(String rootDir, String overrideDirectory)
        {
            CvsRoot          root    = new CvsRoot(this.settings.Config.Cvsroot);
            WorkingDirectory working =
                new WorkingDirectory(root,
                                     this.settings.Config.LocalPath,
                                     this.settings.Config.Module);

            working.OverrideDirectory = overrideDirectory;

            CVSServerConnection connection = new CVSServerConnection();

            Assert.IsNotNull(connection);

            ICommand command = new UpdateCommand2(working);

            Assert.IsNotNull(command);

            connection.Connect(working, this.settings.Config.ValidPassword);

            // Update all files...
            LOGGER.Debug("Fetching all files from rootDir=[" + rootDir + "]");
            working.FoldersToUpdate =
                this.manager.FetchFilesToUpdate(rootDir);

            command.Execute(connection);
            connection.Close();
        }
        public void UpdateNoCheckoutTest()
        {
            CvsRoot          root    = new CvsRoot(this.settings.Config.Cvsroot);
            WorkingDirectory working =
                new WorkingDirectory(root,
                                     this.settings.Config.LocalPath,
                                     CVSNT_MODULE);

            CVSServerConnection connection = new CVSServerConnection();

            Assert.IsNotNull(connection);

            ICommand command = new UpdateCommand2(working);

            Assert.IsNotNull(command);

            connection.Connect(working, this.settings.Config.ValidPassword);
        }
        private void PerformUpdate()
        {
            CvsRoot          root    = new CvsRoot(CVSNT_CVSROOT);
            WorkingDirectory working =
                new WorkingDirectory(root,
                                     this.settings.Config.LocalPath,
                                     CVSNT_MODULE);

            CVSServerConnection connection = new CVSServerConnection();

            Assert.IsNotNull(connection);

            ICommand command = new UpdateCommand2(working);

            Assert.IsNotNull(command);

            connection.Connect(working, this.settings.Config.ValidPassword);
        }
        /// <summary>
        /// Create the command object that will be used to act on the repository.
        /// </summary>
        /// <returns>The command object that will be used to act on the
        ///     repository.</returns>
        /// <exception cref="Exception">TODO: Make a more specific exception</exception>
        /// <exception cref="NotImplementedException">If the command argument
        ///     is not implemented currently.  TODO: Implement the argument.</exception>
        public override ICommand CreateCommand () {
            DirectoryInfo dir = 
                new DirectoryInfo(Path.Combine(Directory.GetCurrentDirectory(), "CVS"));

            UpdateCommand2 updateCommand;

            this.ParseOptions(this.unparsedOptions);
            // note the sandbox is actually above the CVS directory
            Manager manager = new Manager(dir.Parent);

            Repository repository = null;
            Root root = null;

            try {
                repository = Repository.Load(dir); 
                root = Root.Load(dir);
            } catch (NullReferenceException) {
                this.InvalidRepository();
            } catch (CvsFileNotFoundException) {
                this.InvalidRepository();
            }

            if (null == repository) {
                this.InvalidRepository();
            }

            try {
                this.cvsRootVar = new CvsRoot(root.FileContents);
            } catch (ICSharpCode.SharpCvsLib.Exceptions.CvsRootParseException) {
                this.InvalidRepository();
            }

            // If this fails error out and state the user
            //    is not in a CVS repository directory tree.
            if (localDirectory == null) {
                localDirectory = dir.Parent.FullName;
            }
            CurrentWorkingDirectory = new WorkingDirectory( this.CvsRootVar,
                localDirectory, repository.FileContents);
            if (revision != null) {
                CurrentWorkingDirectory.Revision = revision;
            }
            if (!date.Equals(DateTime.MinValue)) {
                CurrentWorkingDirectory.Date = date;
            }
            CurrentWorkingDirectory.FoldersToUpdate =
                manager.FetchFilesToUpdate (dir.FullName);
            // Create new UpdateCommand2 object
            updateCommand = new UpdateCommand2(CurrentWorkingDirectory);

            return updateCommand;
        }