Exemplo n.º 1
0
        /// <summary>
        /// Execute the commit command
        /// </summary>
        /// <param name="connection">Cvs server connection</param>
        public void Execute(ICommandConnection connection)
        {
            connection.SubmitRequest(new ArgumentRequest("-m"));
            connection.SubmitRequest(new ArgumentRequest("LOG MESSAGE"));
            connection.SubmitRequest(new ArgumentRequest(ArgumentRequest.Options.DASH));
            foreach (DictionaryEntry folderEntry in workingdirectory.Folders)
            {
                Folder folder = (Folder)folderEntry.Value;
                this.SetDirectory(connection, folder);
                foreach (DictionaryEntry entryEntry  in folder.Entries)
                {
                    Entry entry = (Entry)entryEntry.Value;
                    if (!entry.IsDirectory)
                    {
                        this.SendFileRequest(connection, entry);
                    }
                }

                this.SetDirectory(connection, folder);

                foreach (DictionaryEntry entryEntry in folder.Entries)
                {
                    Entry entry = (Entry)entryEntry.Value;
                    if (!entry.IsDirectory)
                    {
                        connection.SubmitRequest(new ArgumentRequest(entry.Name));
                    }
                }
            }
            connection.SubmitRequest(new CommitRequest());
        }
Exemplo n.º 2
0
        private void SendEntryRequest(ICommandConnection connection,
                                      Entry entry)
        {
            bool     fileExists;
            DateTime old = entry.TimeStamp;

            entry.TimeStamp = entry.TimeStamp;
            try {
                fileExists = File.Exists(entry.Filename);
            }
            catch (Exception e) {
                LOGGER.Error(e);
                fileExists = false;
            }

            connection.SubmitRequest(new EntryRequest(entry));
            if (fileExists)
            {
                if (File.GetLastAccessTime(entry.Filename) !=
                    entry.TimeStamp.ToUniversalTime())
                {
                    connection.SubmitRequest(new ModifiedRequest(entry.Name));
                }
                else
                {
                    connection.SubmitRequest(new UnchangedRequest(entry.Name));
                }
            }

            entry.TimeStamp = old;
        }
 /// <summary>
 /// Do the dirty work.
 /// </summary>
 /// <param name="connection"></param>
 public void Execute(ICommandConnection connection)
 {
     connection.SubmitRequest(new ArgumentRequest("-s"));
     connection.SubmitRequest(new ArgumentRequest("-r"));
     connection.SubmitRequest(new ArgumentRequest("0"));
     connection.SubmitRequest(new ArgumentRequest("./"));
     connection.SubmitRequest(new RDiffRequest());
 }
 /// <summary>
 /// Do the dirty work.
 /// </summary>
 /// <param name="connection"></param>
 public void Execute(ICommandConnection connection)
 {
     connection.SubmitRequest(new ArgumentRequest("-s"));
     connection.SubmitRequest(new ArgumentRequest("-r"));
     connection.SubmitRequest(new ArgumentRequest("0"));
     connection.SubmitRequest(new ArgumentRequest("./"));
     connection.SubmitRequest(new RDiffRequest());
 }
Exemplo n.º 5
0
        /// <summary>
        /// Execute checkout module command.
        ///
        /// taken from: http://www.elegosoft.com/cvs/cvsclient.html
        /// add \n
        ///     Response expected: yes. Add a file or directory. This uses any
        ///     previous Argument, Directory, Entry, or Modified requests, if they
        ///     have been sent. The last Directory sent specifies the working
        ///     directory at the time of the operation. To add a directory, send the
        ///     directory to be added using Directory and Argument requests.
        ///
        /// </summary>
        /// <example>
        ///
        /// C: Root /u/cvsroot
        /// . . .
        /// C: Argument nsdir
        /// C: Directory nsdir
        /// C: /u/cvsroot/1dir/nsdir
        /// C: Directory .
        /// C: /u/cvsroot/1dir
        /// C: add
        /// S: M Directory /u/cvsroot/1dir/nsdir added to the repository
        /// S: ok
        ///
        /// You will notice that the server does not signal to the client in any
        /// particular way that the directory has been successfully added. The client
        /// is supposed to just assume that the directory has been added and update
        /// its records accordingly. Note also that adding a directory is immediate;
        /// it does not wait until a ci request as files do. To add a file, send the
        /// file to be added using a Modified request. For example:
        ///
        /// C: Argument nfile
        /// C: Directory .
        /// C: /u/cvsroot/1dir
        /// C: Modified nfile
        /// C: u=rw,g=r,o=r
        /// C: 6
        /// C: hello
        /// C: add
        /// S: E cvs server: scheduling file `nfile' for addition
        /// S: Mode u=rw,g=r,o=r
        /// S: Checked-in ./
        /// S: /u/cvsroot/1dir/nfile
        /// S: /nfile/0///
        /// S: E cvs server: use 'cvs commit' to add this file permanently
        /// S: ok
        ///
        /// Note that the file has not been added to the repository; the only effect
        /// of a successful add request, for a file, is to supply the client with a
        /// new entries line containing `0' to indicate an added file. In fact, the
        /// client probably could perform this operation without contacting the
        /// server, although using add does cause the server to perform a few more
        /// checks. The client sends a subsequent ci to actually add the file to the
        /// repository. Another quirk of the add request is that with CVS 1.9 and
        /// older, a pathname specified in an Argument request cannot contain `/'.
        /// There is no good reason for this restriction, and in fact more recent
        /// CVS servers don't have it. But the way to interoperate with the older
        /// servers is to ensure that all Directory requests for add (except those
        /// used to add directories, as described above), use `.' for local-directory.
        /// Specifying another string for local-directory may not get an error, but
        /// it will get you strange Checked-in responses from the buggy servers.
        /// </example>
        /// <param name="connection">Server connection</param>
        public void Execute(ICommandConnection connection)
        {
            connection.SubmitRequest(new ArgumentRequest(ArgumentRequest.Options.DASH));
            int loops = 0;

            foreach (DictionaryEntry folderEntry in this.Folders)
            {
                LOGGER.Debug("loops=[" + loops++ + "]");
                Folder folder = (Folder)folderEntry.Value;
                this.SetDirectory(connection, folder);

                // send each is-modified request
                foreach (DictionaryEntry entryEntry in folder.Entries)
                {
                    Entry entry = (Entry)entryEntry.Value;
                    //connection.SubmitRequest(new IsModifiedRequest(entry.Name));

                    //String fileName = Path.Combine(entry.Path, entry.Name);
                    this.SendFileRequest(connection, entry);

                    // Add the file to the cvs entries file
                    Manager manager = new Manager(connection.Repository.WorkingPath);
                    manager.Add(entry);
                    if (LOGGER.IsDebugEnabled)
                    {
                        LOGGER.Debug("AddCommand.  Entry=[" + entry + "]");
                    }
                }

                // send each argument request
                foreach (DictionaryEntry entryEntry in folder.Entries)
                {
                    Entry entry = (Entry)entryEntry.Value;
                    connection.SubmitRequest(new ArgumentRequest(entry.Name));

                    //String fileName = Path.Combine(entry.Path, entry.Name);
                    //this.SendFileRequest (connection, entry);

                    // Add the file to the cvs entries file
                    Manager manager = new Manager(connection.Repository.WorkingPath);
                    manager.Add(entry);
                    if (LOGGER.IsDebugEnabled)
                    {
                        LOGGER.Debug("AddCommand.  Entry=[" + entry + "]");
                        Entries entries = manager.FetchEntries(entry.FullPath);
                        foreach (DictionaryEntry dicEntry in entries)
                        {
                            LOGGER.Debug("entry=[" + dicEntry.Value + "]");
                        }
                    }
                }
            }

            connection.SubmitRequest(new AddRequest());
        }
Exemplo n.º 6
0
        private void SendFileRequest(ICommandConnection connection, Entry entry)
        {
            DateTime old = entry.TimeStamp;

            entry.TimeStamp = entry.TimeStamp;
            connection.SubmitRequest(new EntryRequest(entry));
            connection.SubmitRequest(new ModifiedRequest(entry.Name));
            connection.SendFile(entry.FullPath, entry.IsBinaryFile);

            entry.TimeStamp = old;
        }
Exemplo n.º 7
0
        /// <summary>
        /// Do the dirty work.
        /// </summary>
        /// <param name="connection"></param>
        public void Execute(ICommandConnection connection)
        {
            //connection.SubmitRequest(new CaseRequest());
            connection.SubmitRequest(new ArgumentRequest("-b"));
            connection.SubmitRequest(new ArgumentRequest("1.1.1"));
            connection.SubmitRequest(new ArgumentRequest("-m"));
            connection.SubmitRequest(new ArgumentRequest(logmessage));

            LOGGER.Info("IMPORT START");

            foreach (DictionaryEntry folder in workingdirectory.Folders)
            {
                this.SetDirectory(connection, (Folder)folder.Value);
                foreach (Entry entry  in ((Folder)folder.Value).Entries.Values)
                {
                    this.SendFileRequest(connection, entry);
                }
            }

            connection.SubmitRequest(new ArgumentRequest(workingdirectory.WorkingDirectoryName));
            connection.SubmitRequest(new ArgumentRequest(vendor));
            connection.SubmitRequest(new ArgumentRequest(release));

            connection.SubmitRequest(new ImportRequest());
            if (LOGGER.IsDebugEnabled)
            {
                LOGGER.Debug("IMPORT END");
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Execute checkout module command.
        /// </summary>
        /// <param name="connection">Server connection</param>
        public void Execute(ICommandConnection connection)
        {
            connection.SubmitRequest(new CaseRequest());

            if (this.deleteTag)
            {
                connection.SubmitRequest(new ArgumentRequest(Options.DELETE_TAG));
            }

            connection.SubmitRequest(new ArgumentRequest(TagName));
            connection.SubmitRequest(new ArgumentRequest(workingDirectory.ModuleName));

            connection.SubmitRequest(new RTagRequest());
        }
Exemplo n.º 9
0
        /// <summary>
        /// Execute the diff command.
        /// </summary>
        /// <param name="connection"></param>
        public void Execute(ICommandConnection connection)
        {
            connection.SubmitRequest(new DirectoryRequest(".",
                                                          workingdirectory.CvsRoot.CvsRepository +
                                                          directory));

            if (IsIgnoringCase)
            {
                connection.SubmitRequest(new ArgumentRequest("-i"));
            }
            if (IsIgnoringAllWhitespace)
            {
                connection.SubmitRequest(new ArgumentRequest("-w"));
            }
            if (IsIgnoringBlankLines)
            {
                connection.SubmitRequest(new ArgumentRequest("-B"));
            }
            if (IsIgnoringSpaceChange)
            {
                connection.SubmitRequest(new ArgumentRequest("-b"));
            }

            connection.SubmitRequest(new ArgumentRequest(entry.Name));
            connection.SubmitRequest(new DiffRequest());
        }
Exemplo n.º 10
0
        /// <summary>
        /// Perform the update.
        /// </summary>
        /// <param name="connection"></param>
        public void Execute(ICommandConnection connection)
        {
            if (workingDirectory.FoldersToUpdate == null)
            {
                LOGGER.Info("Nothing to update on WorkingDirectory.FoldersToUpdate.");
                return;
            }
            Folder[] _foldersToUpdate =
                (Folder[])workingDirectory.FoldersToUpdate.Clone();
            foreach (Folder folder in _foldersToUpdate)
            {
                this.SetDirectory(connection, folder);

                Tag tag = folder.Tag;
                if (null != tag)
                {
                    connection.SubmitRequest(new StickyRequest(tag.FileContents));
                }
                if (workingDirectory.HasOverrideDirectory)
                {
                    connection.SubmitRequest(new ArgumentRequest(ArgumentRequest.Options.OVERRIDE_DIRECTORY));
                    connection.SubmitRequest(
                        new ArgumentRequest(workingDirectory.OverrideDirectory));
                }

                if (this.Revision != null && this.Revision != string.Empty)
                {
                    connection.SubmitRequest(new ArgumentRequest(ArgumentRequest.Options.REVISION));
                    connection.SubmitRequest(new ArgumentRequest(this.Revision));
                }
                if (workingDirectory.HasDate)
                {
                    connection.SubmitRequest(new ArgumentRequest(ArgumentRequest.Options.DATE));
                    connection.SubmitRequest(new ArgumentRequest(workingDirectory.GetDateAsString()));
                }

                foreach (DictionaryEntry dicEntry  in folder.Entries)
                {
                    Entry entry = (Entry)dicEntry.Value;
                    // directory entry modifications are not tracked in cvs,
                    //  once a directory is created it cannot be removed
                    if (!entry.IsDirectory)
                    {
                        DateTime old = entry.TimeStamp;
                        entry.TimeStamp = entry.TimeStamp;

                        this.SendFileRequest(connection, entry);
                    }
                }
                connection.SubmitRequest(new UpdateRequest());
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Do the dirty work.
        /// </summary>
        /// <param name="connection"></param>
        public void Execute(ICommandConnection connection)
        {
            if (this.Quieter)
            {
                connection.SubmitRequest(new ArgumentRequest(Option.QUIETER));
            }
            if (this.EntryFormat)
            {
                connection.SubmitRequest(new ArgumentRequest(Option.ENTRY_FORMAT));
            }
            if (this.AllDetails)
            {
                connection.SubmitRequest(new ArgumentRequest(Option.ALL_DETAILS));
            }
            if (this.Recursive)
            {
                connection.SubmitRequest(new ArgumentRequest(Option.RECURSIVE));
            }
            if (this.LocalTime)
            {
                connection.SubmitRequest(new ArgumentRequest(Option.LOCAL_TIME));
            }
            if (null != this.Tag && this.Tag.Length != 0)
            {
                connection.SubmitRequest(new ArgumentRequest(Option.TAG));
            }
            if (this.Prune)
            {
                connection.SubmitRequest(new ArgumentRequest(Option.PRUNE));
            }

            // add any date arguments
            foreach (object o in dateArgs)
            {
                string dateArg = (string)o;
                connection.SubmitRequest(new ArgumentRequest(Option.DATE));
                connection.SubmitRequest(new ArgumentRequest(dateArg));
            }

            connection.SubmitRequest(new ListRequest());
        }
Exemplo n.º 12
0
        /// <summary>
        /// Execute the status command against the repository.
        /// </summary>
        /// <param name="connection"></param>
        public void Execute(ICommandConnection connection)
        {
            if (null != this._folders)
            {
                connection.SubmitRequest(new ArgumentRequest(ArgumentRequest.Options.DASH));

                foreach (Folder folder in this.Folders.Values)
                {
                    connection.SubmitRequest(new DirectoryRequest(".",
                                                                  this._workingdirectory.CvsRoot.CvsRepository + "/" +
                                                                  folder.Repository.FileContents));
                    foreach (Entry entry in folder.Entries.Values)
                    {
                        connection.SubmitRequest(new EntryRequest(entry));
                        connection.SubmitRequest(new UnchangedRequest(entry.Name));
                    }
                }
            }
            connection.ResponseMessageEvents.MessageResponseMessageEvent +=
                new MessageEventHandler(this.WriteEvent);
            connection.SubmitRequest(new StatusRequest());
        }
Exemplo n.º 13
0
 /// <summary>
 /// Do the dirty work.
 /// </summary>
 /// <param name="connection"></param>
 public void Execute(ICommandConnection connection)
 {
     connection.SubmitRequest(new DirectoryRequest(".", workingdirectory.CvsRoot.CvsRepository + directory));
     connection.SubmitRequest(new EntryRequest(entry));
     connection.SubmitRequest(new RemoveRequest());
     connection.SubmitRequest(new ArgumentRequest("-m"));
     connection.SubmitRequest(new ArgumentRequest("Remove"));
     connection.SubmitRequest(new CommitRequest());
 }
Exemplo n.º 14
0
 /// <summary>
 /// Do the dirty work.
 /// </summary>
 /// <param name="connection"></param>
 public void Execute(ICommandConnection connection)
 {
     connection.SubmitRequest(new DirectoryRequest(".", workingdirectory.CvsRoot.CvsRepository + directory));
     connection.SubmitRequest(new EntryRequest(entry));
     connection.SubmitRequest(new RemoveRequest());
     connection.SubmitRequest(new ArgumentRequest("-m"));
     connection.SubmitRequest(new ArgumentRequest("Remove"));
     connection.SubmitRequest(new CommitRequest());
 }
Exemplo n.º 15
0
        private void SetDirectory(ICommandConnection connection,
                                  Folder folder)
        {
            String absoluteDir = String.Format("{0}",
                                               connection.Repository.CvsRoot.CvsRepository);

            try {
                connection.SubmitRequest(new DirectoryRequest(".",
                                                              absoluteDir));
            }
            catch (Exception e) {
                String msg = "Exception while submitting directory request.  " +
                             "path=[" + folder.Repository.FileContents + "]";
                LOGGER.Error(e);
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Execute checkout module command.
        /// </summary>
        /// <param name="connection">Server connection</param>
        public new void Execute(ICommandConnection connection)
        {
            string relativeDirectory = this.workingDirectory.ModuleName;

            // Note: don't use Path.Combine() as the separator must be "/"
            string repositoryDir = workingDirectory.CvsRoot.CvsRepository + "/" + relativeDirectory;

            connection.SubmitRequest(new DirectoryRequest(relativeDirectory, repositoryDir));

            if (DefaultBranch)
            {
                connection.SubmitRequest(new ArgumentRequest("-b"));
            }
            if (HeaderAndDescOnly)
            {
                connection.SubmitRequest(new ArgumentRequest("-t"));
            }
            if (HeaderOnly)
            {
                connection.SubmitRequest(new ArgumentRequest("-h"));
            }
            if (NoTags)
            {
                connection.SubmitRequest(new ArgumentRequest("-N"));
            }

            // add any date arguments
            foreach (object o in base.DateArgs)
            {
                string dateArg = (string)o;
                connection.SubmitRequest(new ArgumentRequest("-d"));
                connection.SubmitRequest(new ArgumentRequest(dateArg));
            }

            connection.SubmitRequest(new ArgumentRequest(workingDirectory.ModuleName));

            connection.SubmitRequest(new RLogRequest());
        }
Exemplo n.º 17
0
        /// <summary>
        /// Execute checkout module command.
        /// 
        /// taken from: http://www.elegosoft.com/cvs/cvsclient.html
        /// add \n
        ///     Response expected: yes. Add a file or directory. This uses any 
        ///     previous Argument, Directory, Entry, or Modified requests, if they 
        ///     have been sent. The last Directory sent specifies the working 
        ///     directory at the time of the operation. To add a directory, send the 
        ///     directory to be added using Directory and Argument requests.
        ///
        /// </summary>
        /// <example>
        /// 
        /// C: Root /u/cvsroot
        /// . . .
        /// C: Argument nsdir
        /// C: Directory nsdir
        /// C: /u/cvsroot/1dir/nsdir
        /// C: Directory .
        /// C: /u/cvsroot/1dir
        /// C: add
        /// S: M Directory /u/cvsroot/1dir/nsdir added to the repository
        /// S: ok
        ///
        /// You will notice that the server does not signal to the client in any 
        /// particular way that the directory has been successfully added. The client 
        /// is supposed to just assume that the directory has been added and update 
        /// its records accordingly. Note also that adding a directory is immediate; 
        /// it does not wait until a ci request as files do. To add a file, send the 
        /// file to be added using a Modified request. For example:
        ///
        /// C: Argument nfile
        /// C: Directory .
        /// C: /u/cvsroot/1dir
        /// C: Modified nfile
        /// C: u=rw,g=r,o=r
        /// C: 6
        /// C: hello
        /// C: add
        /// S: E cvs server: scheduling file `nfile' for addition
        /// S: Mode u=rw,g=r,o=r
        /// S: Checked-in ./
        /// S: /u/cvsroot/1dir/nfile
        /// S: /nfile/0///
        /// S: E cvs server: use 'cvs commit' to add this file permanently
        /// S: ok
        ///
        /// Note that the file has not been added to the repository; the only effect 
        /// of a successful add request, for a file, is to supply the client with a 
        /// new entries line containing `0' to indicate an added file. In fact, the 
        /// client probably could perform this operation without contacting the 
        /// server, although using add does cause the server to perform a few more 
        /// checks. The client sends a subsequent ci to actually add the file to the 
        /// repository. Another quirk of the add request is that with CVS 1.9 and 
        /// older, a pathname specified in an Argument request cannot contain `/'. 
        /// There is no good reason for this restriction, and in fact more recent 
        /// CVS servers don't have it. But the way to interoperate with the older 
        /// servers is to ensure that all Directory requests for add (except those 
        /// used to add directories, as described above), use `.' for local-directory. 
        /// Specifying another string for local-directory may not get an error, but 
        /// it will get you strange Checked-in responses from the buggy servers.
        /// </example>
        /// <param name="connection">Server connection</param>
        public void Execute(ICommandConnection connection) {
            connection.SubmitRequest(new ArgumentRequest(ArgumentRequest.Options.DASH));
            int loops = 0;
            foreach (DictionaryEntry folderEntry in this.Folders) {
                LOGGER.Debug("loops=[" + loops++ + "]");
                Folder folder = (Folder)folderEntry.Value;
                this.SetDirectory (connection, folder);

                // send each is-modified request
                foreach (DictionaryEntry entryEntry in folder.Entries) {
                    Entry entry = (Entry)entryEntry.Value;
                    //connection.SubmitRequest(new IsModifiedRequest(entry.Name));

                    //String fileName = Path.Combine(entry.Path, entry.Name);
                    this.SendFileRequest (connection, entry);

                    // Add the file to the cvs entries file
                    Manager manager = new Manager(connection.Repository.WorkingPath);
                    manager.Add(entry);
                    if (LOGGER.IsDebugEnabled) {
                        LOGGER.Debug("AddCommand.  Entry=[" + entry + "]");
                    }
                }

                // send each argument request
                foreach (DictionaryEntry entryEntry in folder.Entries) {
                    Entry entry = (Entry)entryEntry.Value;
                    connection.SubmitRequest(new ArgumentRequest(entry.Name));

                    //String fileName = Path.Combine(entry.Path, entry.Name);
                    //this.SendFileRequest (connection, entry);

                    // Add the file to the cvs entries file
                    Manager manager = new Manager(connection.Repository.WorkingPath);
                    manager.Add(entry);
                    if (LOGGER.IsDebugEnabled) {
                        LOGGER.Debug("AddCommand.  Entry=[" + entry + "]");
                        Entries entries = manager.FetchEntries(entry.FullPath);
                        foreach (DictionaryEntry dicEntry in entries) {
                            LOGGER.Debug("entry=[" + dicEntry.Value + "]");
                        }
                    }
                }
            }

            connection.SubmitRequest(new AddRequest());
        }
        /// <summary>
        /// Execute checkout module command.
        /// </summary>
        /// <param name="connection">Server connection</param>
        public void Execute(ICommandConnection connection) {
            workingDirectory.Clear();

            //connection.SubmitRequest(new CaseRequest());
            connection.SubmitRequest(new ArgumentRequest(this.Module));

            connection.SubmitRequest(new DirectoryRequest(".",
                                    workingDirectory.CvsRoot.CvsRepository +
                                    "/" + workingDirectory.ModuleName));

            connection.SubmitRequest(new ExpandModulesRequest());

            connection.SubmitRequest(
                new ArgumentRequest(ArgumentRequest.Options.MODULE_NAME));

            if (null != this.Revision) {
                connection.SubmitRequest (new ArgumentRequest (ArgumentRequest.Options.REVISION));
                connection.SubmitRequest(new ArgumentRequest(this.Revision));
            }
            if (this._hasDate) {
                connection.SubmitRequest (new ArgumentRequest (ArgumentRequest.Options.DATE));
                connection.SubmitRequest(new ArgumentRequest(this.DateAsString));
            }
            if (null != this.OverrideDirectory) {
                connection.SubmitRequest (
                    new ArgumentRequest (ArgumentRequest.Options.OVERRIDE_DIRECTORY));
                connection.SubmitRequest (
                    new ArgumentRequest (this.OverrideDirectory));
            }

            connection.SubmitRequest(new ArgumentRequest(this.Module));

            connection.SubmitRequest(new DirectoryRequest(".",
                                    workingDirectory.CvsRoot.CvsRepository +
                                    "/" + this.Module));

            connection.SubmitRequest(new CheckoutRequest());
            Manager manager = new Manager (connection.Repository.WorkingPath);
        }
Exemplo n.º 19
0
        private void SendEntryRequest (ICommandConnection connection,
                                Entry entry) {
            bool fileExists;
            DateTime old = entry.TimeStamp;
            entry.TimeStamp = entry.TimeStamp;
            try {
                fileExists = File.Exists (entry.Filename);
            }
            catch (Exception e) {
                LOGGER.Error (e);
                fileExists = false;
            }

            connection.SubmitRequest (new EntryRequest (entry));
            if (fileExists) {
                if (File.GetLastAccessTime(entry.Filename) !=
                    entry.TimeStamp.ToUniversalTime ()) {
                    connection.SubmitRequest(new ModifiedRequest(entry.Name));
                } else {
                    connection.SubmitRequest(new UnchangedRequest(entry.Name));
                }
            }

            entry.TimeStamp = old;
        }
Exemplo n.º 20
0
        /// <summary>
        /// Execute the diff command.
        /// </summary>
        /// <param name="connection"></param>
        public void Execute(ICommandConnection connection)
        {
            connection.SubmitRequest(new DirectoryRequest(".",
                                    workingdirectory.CvsRoot.CvsRepository +
                                    directory));

            if (IsIgnoringCase) {
                connection.SubmitRequest(new ArgumentRequest("-i"));
            }
            if (IsIgnoringAllWhitespace) {
                connection.SubmitRequest(new ArgumentRequest("-w"));
            }
            if (IsIgnoringBlankLines) {
                connection.SubmitRequest(new ArgumentRequest("-B"));
            }
            if (IsIgnoringSpaceChange) {
                connection.SubmitRequest(new ArgumentRequest("-b"));
            }

            connection.SubmitRequest(new ArgumentRequest(entry.Name));
            connection.SubmitRequest(new DiffRequest());
        }
Exemplo n.º 21
0
        /// <summary>
        /// Do the dirty work.
        /// </summary>
        /// <param name="connection"></param>
        public void Execute(ICommandConnection connection) {
            foreach (Folder folder in this.Folders.Values) {
                this.SetDirectory (connection, folder);
                
                if (defaultBranch) {
                    connection.SubmitRequest(new ArgumentRequest("-b"));
                }
                if (headerAndDescOnly) {
                    connection.SubmitRequest(new ArgumentRequest("-t"));
                }
                if (headerOnly) {
                    connection.SubmitRequest(new ArgumentRequest("-h"));
                }
                if (noTags) {
                    connection.SubmitRequest(new ArgumentRequest("-N"));
                }

                // add any date arguments
                foreach (object o in dateArgs) {
                    string dateArg = (string)o;
                    connection.SubmitRequest(new ArgumentRequest("-d"));
                    connection.SubmitRequest(new ArgumentRequest(dateArg));
                }

                foreach (DictionaryEntry de in folder.Entries) {
                    Entry entry = (Entry)de.Value;
                    // Only submit the entry information if the entry is not
                    // a directory.
                    if (!entry.IsDirectory) {
                        DateTime old = entry.TimeStamp;
                        entry.TimeStamp = entry.TimeStamp;

                        String fileName = Path.Combine(entry.Path, entry.Name);
                        this.SendEntryRequest (connection, entry);
                    }
                }
            }

            string relativeDirectory;
            if (this.directory != null && this.directory.Length > 0) {
                if (null == this.directory) {
                    this.directory = ".";
                }
                relativeDirectory = this.directory;
            } else {
                relativeDirectory = workingDirectory.WorkingDirectoryName;
            }
            // Note: don't use Path.Combine() as the separator must be "/"
            string repositoryDir = workingDirectory.CvsRoot.CvsRepository + "/" + relativeDirectory;
            connection.SubmitRequest(new DirectoryRequest(relativeDirectory, repositoryDir));

            if (defaultBranch) {
                connection.SubmitRequest(new ArgumentRequest("-b"));
            }
            if (headerAndDescOnly) {
                connection.SubmitRequest(new ArgumentRequest("-t"));
            }
            if (headerOnly) {
                connection.SubmitRequest(new ArgumentRequest("-h"));
            }
            if (noTags) {
                connection.SubmitRequest(new ArgumentRequest("-N"));
            }

            if (!recursive) {
                connection.SubmitRequest(new ArgumentRequest("-l"));
            }

            // add any date arguments
            foreach (object o in dateArgs) {
                string dateArg = (string)o;
                connection.SubmitRequest(new ArgumentRequest("-d"));
                connection.SubmitRequest(new ArgumentRequest(dateArg));
            }

            if (this.entry != null) {
                connection.SubmitRequest (new EntryRequest (this.entry));
            }

            connection.SubmitRequest (new LogRequest());

        }
Exemplo n.º 22
0
 /// <summary>
 /// Do the dirty work.
 /// </summary>
 /// <param name="connection"></param>
 public void Execute(ICommandConnection connection)
 {
     connection.SubmitRequest(new InitRequest(cvsroot.CvsRepository));
 }
Exemplo n.º 23
0
        /// <summary>
        /// Execute the status command against the repository.
        /// </summary>
        /// <param name="connection"></param>
        public void Execute(ICommandConnection connection){
            if (null != this._folders) {
                connection.SubmitRequest(new ArgumentRequest(ArgumentRequest.Options.DASH));

                foreach (Folder folder in this.Folders.Values) {
                    connection.SubmitRequest(new DirectoryRequest(".",
                        this._workingdirectory.CvsRoot.CvsRepository + "/" +
                        folder.Repository.FileContents));
                    foreach (Entry entry in folder.Entries.Values) {
                        connection.SubmitRequest(new EntryRequest(entry));
                        connection.SubmitRequest(new UnchangedRequest(entry.Name));
                    }
                }
            }
            connection.ResponseMessageEvents.MessageResponseMessageEvent +=
                new MessageEventHandler(this.WriteEvent);
            connection.SubmitRequest(new StatusRequest());
        }
Exemplo n.º 24
0
        /// <summary>
        /// Perform the update.
        /// </summary>
        /// <param name="connection"></param>
        public void Execute(ICommandConnection connection) {
            if (workingDirectory.FoldersToUpdate == null) {
                LOGGER.Info("Nothing to update on WorkingDirectory.FoldersToUpdate.");
                return;
            }
            Folder[] _foldersToUpdate =
                (Folder[])workingDirectory.FoldersToUpdate.Clone ();
            foreach (Folder folder in _foldersToUpdate) {
                this.SetDirectory (connection, folder);

                Tag tag = folder.Tag;
                if (null != tag) {
                    connection.SubmitRequest (new StickyRequest (tag.FileContents));
                }
                if (workingDirectory.HasOverrideDirectory) {
                    connection.SubmitRequest (new ArgumentRequest (ArgumentRequest.Options.OVERRIDE_DIRECTORY));
                    connection.SubmitRequest (
                        new ArgumentRequest (workingDirectory.OverrideDirectory));
                }

                if (this.Revision != null && this.Revision != string.Empty) {
                    connection.SubmitRequest (new ArgumentRequest (ArgumentRequest.Options.REVISION));
                    connection.SubmitRequest(new ArgumentRequest(this.Revision));
                }
                if (workingDirectory.HasDate) {
                    connection.SubmitRequest (new ArgumentRequest (ArgumentRequest.Options.DATE));
                    connection.SubmitRequest(new ArgumentRequest(workingDirectory.GetDateAsString()));
                }
                
                foreach (DictionaryEntry dicEntry  in folder.Entries) {
                    Entry entry = (Entry)dicEntry.Value;
                    // directory entry modifications are not tracked in cvs,
                    //  once a directory is created it cannot be removed
                    if (!entry.IsDirectory) {
                        DateTime old = entry.TimeStamp;
                        entry.TimeStamp = entry.TimeStamp;
    				
                        this.SendFileRequest (connection, entry);
                    }
                }
                connection.SubmitRequest(new UpdateRequest());
            }

        }
Exemplo n.º 25
0
        /// <summary>
        /// Do the dirty work.
        /// </summary>
        /// <param name="connection"></param>
        public void Execute(ICommandConnection connection)
        {
            //connection.SubmitRequest(new CaseRequest());
            connection.SubmitRequest(new ArgumentRequest("-b"));
            connection.SubmitRequest(new ArgumentRequest("1.1.1"));
            connection.SubmitRequest(new ArgumentRequest("-m"));
            connection.SubmitRequest(new ArgumentRequest(logmessage));

            LOGGER.Info("IMPORT START");

            foreach (DictionaryEntry folder in workingdirectory.Folders) {
                this.SetDirectory(connection, (Folder)folder.Value);
                foreach (Entry entry  in ((Folder)folder.Value).Entries.Values) {
                    this.SendFileRequest(connection, entry);
                }
            }

            connection.SubmitRequest(new ArgumentRequest(workingdirectory.WorkingDirectoryName));
            connection.SubmitRequest(new ArgumentRequest(vendor));
            connection.SubmitRequest(new ArgumentRequest(release));

            connection.SubmitRequest(new ImportRequest());
            if (LOGGER.IsDebugEnabled) {
                LOGGER.Debug ("IMPORT END");
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// Do the dirty work.
        /// </summary>
        /// <param name="connection"></param>
        public void Execute(ICommandConnection connection)
        {
            foreach (Folder folder in this.Folders.Values)
            {
                this.SetDirectory(connection, folder);

                if (defaultBranch)
                {
                    connection.SubmitRequest(new ArgumentRequest("-b"));
                }
                if (headerAndDescOnly)
                {
                    connection.SubmitRequest(new ArgumentRequest("-t"));
                }
                if (headerOnly)
                {
                    connection.SubmitRequest(new ArgumentRequest("-h"));
                }
                if (noTags)
                {
                    connection.SubmitRequest(new ArgumentRequest("-N"));
                }

                // add any date arguments
                foreach (object o in dateArgs)
                {
                    string dateArg = (string)o;
                    connection.SubmitRequest(new ArgumentRequest("-d"));
                    connection.SubmitRequest(new ArgumentRequest(dateArg));
                }

                foreach (DictionaryEntry de in folder.Entries)
                {
                    Entry entry = (Entry)de.Value;
                    // Only submit the entry information if the entry is not
                    // a directory.
                    if (!entry.IsDirectory)
                    {
                        DateTime old = entry.TimeStamp;
                        entry.TimeStamp = entry.TimeStamp;

                        String fileName = Path.Combine(entry.Path, entry.Name);
                        this.SendEntryRequest(connection, entry);
                    }
                }
            }

            string relativeDirectory;

            if (this.directory != null && this.directory.Length > 0)
            {
                if (null == this.directory)
                {
                    this.directory = ".";
                }
                relativeDirectory = this.directory;
            }
            else
            {
                relativeDirectory = workingDirectory.WorkingDirectoryName;
            }
            // Note: don't use Path.Combine() as the separator must be "/"
            string repositoryDir = workingDirectory.CvsRoot.CvsRepository + "/" + relativeDirectory;

            connection.SubmitRequest(new DirectoryRequest(relativeDirectory, repositoryDir));

            if (defaultBranch)
            {
                connection.SubmitRequest(new ArgumentRequest("-b"));
            }
            if (headerAndDescOnly)
            {
                connection.SubmitRequest(new ArgumentRequest("-t"));
            }
            if (headerOnly)
            {
                connection.SubmitRequest(new ArgumentRequest("-h"));
            }
            if (noTags)
            {
                connection.SubmitRequest(new ArgumentRequest("-N"));
            }

            if (!recursive)
            {
                connection.SubmitRequest(new ArgumentRequest("-l"));
            }

            // add any date arguments
            foreach (object o in dateArgs)
            {
                string dateArg = (string)o;
                connection.SubmitRequest(new ArgumentRequest("-d"));
                connection.SubmitRequest(new ArgumentRequest(dateArg));
            }

            if (this.entry != null)
            {
                connection.SubmitRequest(new EntryRequest(this.entry));
            }

            connection.SubmitRequest(new LogRequest());
        }
Exemplo n.º 27
0
 /// <summary>
 /// Do the dirty work.
 /// </summary>
 /// <param name="connection"></param>
 public void Execute(ICommandConnection connection)
 {
     connection.SubmitRequest(new InitRequest(cvsroot.CvsRepository));
 }
Exemplo n.º 28
0
        /// <summary>
        /// Do the dirty work.
        /// </summary>
        /// <param name="connection"></param>
        public void Execute(ICommandConnection connection)
        {
            if (this.Quieter) {
                connection.SubmitRequest(new ArgumentRequest(Option.QUIETER));
            }
            if (this.EntryFormat) {
                connection.SubmitRequest(new ArgumentRequest(Option.ENTRY_FORMAT));
            }
            if (this.AllDetails) {
                connection.SubmitRequest(new ArgumentRequest(Option.ALL_DETAILS));
            }
            if (this.Recursive) {
                connection.SubmitRequest(new ArgumentRequest(Option.RECURSIVE));
            }
            if (this.LocalTime) {
                connection.SubmitRequest(new ArgumentRequest(Option.LOCAL_TIME));
            }
            if (null != this.Tag && this.Tag.Length != 0) {
                connection.SubmitRequest(new ArgumentRequest(Option.TAG));
            }
            if (this.Prune) {
                connection.SubmitRequest(new ArgumentRequest(Option.PRUNE));
            }

            // add any date arguments
            foreach (object o in dateArgs) {
                string dateArg = (string)o;
                connection.SubmitRequest(new ArgumentRequest(Option.DATE));
                connection.SubmitRequest(new ArgumentRequest(dateArg));
            }

            connection.SubmitRequest (new ListRequest());
        }     
Exemplo n.º 29
0
        private void SetDirectory (ICommandConnection connection,
            Folder folder) {
            String absoluteDir =
                connection.Repository.CvsRoot.CvsRepository + "/" +
                folder.Repository.FileContents;

            try {
                connection.SubmitRequest(new DirectoryRequest(".",
                    absoluteDir));
            }
            catch (Exception e) {
                String msg = "Exception while submitting directory request.  " +
                    "path=[" + folder.Repository.FileContents + "]";
                LOGGER.Error (e);
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// Execute checkout module command.
        /// </summary>
        /// <param name="connection">Server connection</param>
        public new void Execute(ICommandConnection connection) {
            string relativeDirectory = this.workingDirectory.ModuleName;

            // Note: don't use Path.Combine() as the separator must be "/"
            string repositoryDir = workingDirectory.CvsRoot.CvsRepository + "/" + relativeDirectory;
            connection.SubmitRequest(new DirectoryRequest(relativeDirectory, repositoryDir));

            if (DefaultBranch) {
                connection.SubmitRequest(new ArgumentRequest("-b"));
            }
            if (HeaderAndDescOnly) {
                connection.SubmitRequest(new ArgumentRequest("-t"));
            }
            if (HeaderOnly) {
                connection.SubmitRequest(new ArgumentRequest("-h"));
            }
            if (NoTags) {
                connection.SubmitRequest(new ArgumentRequest("-N"));
            }
        
            // add any date arguments
            foreach (object o in base.DateArgs) {
                string dateArg = (string)o;
                connection.SubmitRequest(new ArgumentRequest("-d"));
                connection.SubmitRequest(new ArgumentRequest(dateArg));
            }

            connection.SubmitRequest(new ArgumentRequest(workingDirectory.ModuleName));

            connection.SubmitRequest(new RLogRequest());
        }
Exemplo n.º 31
0
        /// <summary>
        /// Execute the commit command
        /// </summary>
        /// <param name="connection">Cvs server connection</param>
        public void Execute(ICommandConnection connection) {
            connection.SubmitRequest(new ArgumentRequest("-m"));
            connection.SubmitRequest(new ArgumentRequest("LOG MESSAGE"));
            connection.SubmitRequest(new ArgumentRequest(ArgumentRequest.Options.DASH));
            foreach (DictionaryEntry folderEntry in workingdirectory.Folders) {
                Folder folder = (Folder)folderEntry.Value;
                this.SetDirectory(connection, folder);
                foreach (DictionaryEntry entryEntry  in folder.Entries) {
                    Entry entry = (Entry)entryEntry.Value;
                    if (!entry.IsDirectory) {
                        this.SendFileRequest(connection, entry);
                    }
                }

                this.SetDirectory(connection, folder);

                foreach (DictionaryEntry entryEntry in folder.Entries) {
                    Entry entry = (Entry)entryEntry.Value;
                    if (!entry.IsDirectory) {
                        connection.SubmitRequest(new ArgumentRequest(entry.Name));
                    }
                }
            }
            connection.SubmitRequest(new CommitRequest());
        }
Exemplo n.º 32
0
        /// <summary>
        /// Execute checkout module command.
        /// </summary>
        /// <param name="connection">Server connection</param>
        public void Execute(ICommandConnection connection) {
            connection.SubmitRequest(new CaseRequest());

            if (this.deleteTag) {
                connection.SubmitRequest(new ArgumentRequest(Options.DELETE_TAG));
            }

            connection.SubmitRequest(new ArgumentRequest(TagName));
            connection.SubmitRequest(new ArgumentRequest(workingDirectory.ModuleName));

            connection.SubmitRequest(new RTagRequest());
        }
Exemplo n.º 33
0
        private void SendFileRequest (ICommandConnection connection,
            Entry entry) {
            DateTime old = entry.TimeStamp;
            entry.TimeStamp = entry.TimeStamp;
            connection.SubmitRequest (new EntryRequest (entry));
            connection.SubmitRequest(new ModifiedRequest(entry.Name));
            connection.SendFile(entry.FullPath, entry.IsBinaryFile);

            entry.TimeStamp = old;
        }
        /// <summary>
        /// Execute checkout module command.
        /// </summary>
        /// <param name="connection">Server connection</param>
        public void Execute(ICommandConnection connection)
        {
            workingDirectory.Clear();

            //connection.SubmitRequest(new CaseRequest());
            connection.SubmitRequest(new ArgumentRequest(this.Module));

            connection.SubmitRequest(new DirectoryRequest(".",
                                                          workingDirectory.CvsRoot.CvsRepository +
                                                          "/" + workingDirectory.ModuleName));

            connection.SubmitRequest(new ExpandModulesRequest());

            connection.SubmitRequest(
                new ArgumentRequest(ArgumentRequest.Options.MODULE_NAME));

            if (null != this.Revision)
            {
                connection.SubmitRequest(new ArgumentRequest(ArgumentRequest.Options.REVISION));
                connection.SubmitRequest(new ArgumentRequest(this.Revision));
            }
            if (this._hasDate)
            {
                connection.SubmitRequest(new ArgumentRequest(ArgumentRequest.Options.DATE));
                connection.SubmitRequest(new ArgumentRequest(this.DateAsString));
            }
            if (null != this.OverrideDirectory)
            {
                connection.SubmitRequest(
                    new ArgumentRequest(ArgumentRequest.Options.OVERRIDE_DIRECTORY));
                connection.SubmitRequest(
                    new ArgumentRequest(this.OverrideDirectory));
            }

            connection.SubmitRequest(new ArgumentRequest(this.Module));

            connection.SubmitRequest(new DirectoryRequest(".",
                                                          workingDirectory.CvsRoot.CvsRepository +
                                                          "/" + this.Module));

            connection.SubmitRequest(new CheckoutRequest());
            Manager manager = new Manager(connection.Repository.WorkingPath);
        }