コード例 #1
0
        /// <summary>
        /// Process the response from the cvs server.
        /// </summary>
        public override void Process() {
            Manager manager = new Manager (Services.Repository.WorkingPath);
            string localPath = this.ReadLine();
            string reposPath = this.ReadLine();
            string entry     = this.ReadLine();
            string flags     = this.ReadLine();
            string sizeStr   = this.ReadLine();

            PathTranslator orgPath   =
                new PathTranslator (Services.Repository,
                                    reposPath);
            string localPathAndFilename = orgPath.LocalPathAndFilename;
            string directory = orgPath.LocalPath;

            bool compress = sizeStr[0] == 'z';

            if (compress) {
                sizeStr = sizeStr.Substring(1);
            }

            int size  = Int32.Parse(sizeStr);

            if (!Directory.Exists(orgPath.LocalPath)) {
                Directory.CreateDirectory(orgPath.LocalPath);

            }

            if (Services.NextFile != null && Services.NextFile.Length > 0) {
                localPathAndFilename = Services.NextFile;
                Services.NextFile = null;
            }

            Factory factory = new Factory();
            Entry e = (Entry)
                factory.CreateCvsObject(new DirectoryInfo(Path.GetDirectoryName(orgPath.CurrentDir.FullName)), 
                Entry.FILE_NAME, entry);

            if (e.IsBinaryFile) {
                Services.UncompressedFileHandler.ReceiveBinaryFile(Stream,
                        localPathAndFilename,
                        size);
            } else {
                Services.UncompressedFileHandler.ReceiveTextFile(Stream,
                        localPathAndFilename,
                        size);
            }

            e.Date = Services.NextFileDate;
            Services.NextFileDate = null;

            manager.AddEntry(e);
            manager.SetFileTimeStamp (e.FullPath, e.TimeStamp, e.IsUtcTimeStamp);

            UpdateMessage message = new UpdateMessage ();
            message.Module = Services.Repository.WorkingDirectoryName;
            message.Repository =  orgPath.RelativePath;
            message.Filename = e.Name;
            Services.SendMessage (message.Message);
            Services.ResponseMessageEvents.SendResponseMessage(message.Message, this.GetType());
        }
コード例 #2
0
        /// <summary>
        /// Removed pathname \n
        ///     The file has been removed from the repository (this is the case where 
        ///     cvs prints `file foobar.c is no longer pertinent').
        /// </summary>
        public override void Process() {
            string localPath      = this.ReadLine();
            string repositoryPath = this.ReadLine();
            string entryLine      = this.ReadLine();

            PathTranslator orgPath   =
                new PathTranslator (Services.Repository,
                repositoryPath);

            LOGGER.Error("TODO: Implement RemovedResponse; This response is currently does not do anything.");
        }
コード例 #3
0
        /// <summary>
        /// Process the response stream.
        /// </summary>
        public override void Process() {
            string localPath      = this.ReadLine();
            string repositoryPath = this.ReadLine();
            string stickyTag      = this.ReadLine();

            PathTranslator orgPath   =
                new PathTranslator (Services.Repository, repositoryPath);

            string localPathAndFilename = orgPath.LocalPathAndFilename;
            string directory = orgPath.LocalPath;

            Manager manager = 
                new Manager (Services.Repository.WorkingPath);
            manager.AddTag (Services.Repository, localPath, repositoryPath, stickyTag);

        }
コード例 #4
0
        /// <summary>
        /// Process a new entry response.
        /// 
        /// TODO: Copied implementation from CheckedInResponse, determine if this
        ///     is correct or not.
        /// </summary>
        public override void Process() {
            string localPath      = this.ReadLine();
            string repositoryPath = this.ReadLine();
            string entryLine      = this.ReadLine();

            PathTranslator orgPath   =
                new PathTranslator (Services.Repository,
                repositoryPath);

            string fileName = orgPath.LocalPathAndFilename;
            Factory factory = new Factory();
            Entry  entry = (Entry)
                factory.CreateCvsObject(orgPath.CurrentDir, Entry.FILE_NAME, entryLine);
            Manager manager = new Manager (Services.Repository.WorkingPath);
            manager.Add (entry);
        }
コード例 #5
0
        /// <summary>
        /// Process the response stream.
        /// </summary>
        public override void Process() {
            string localPath      = this.ReadLine();
            string repositoryPath = this.ReadLine();

            PathTranslator pathTranslator =
                new PathTranslator (Services.Repository,
                                    repositoryPath);

            if (!Directory.Exists (pathTranslator.LocalPath)) {
                if (!(pathTranslator.LocalPath == null && 
                    pathTranslator.LocalPath.Length == 0)) {
                    Directory.CreateDirectory (pathTranslator.LocalPath);
                }
            }

            Services.ResponseMessageEvents.SendResponseMessage(String.Format("Updating {0}/{1}",
                Services.Repository.ModuleName, repositoryPath), this.GetType());
        }
コード例 #6
0
        /// <summary>
        /// Process a clear static directory response.
        /// </summary>
        public override void Process() {
            string localPath      = this.ReadLine();
            string reposPath      = this.ReadLine();

            Manager manager = new Manager (Services.Repository.WorkingPath);
            manager.AddRepository (Services.Repository, localPath, reposPath);
            manager.AddRoot (Services.Repository, localPath, reposPath);
            PathTranslator pathTranslator = new PathTranslator (Services.Repository, reposPath);

            Factory factory = new Factory();
            Entry entry = 
                (Entry)factory.CreateCvsObject(pathTranslator.CurrentDir, Entry.FILE_NAME, 
                Entry.CreateEntry(pathTranslator.CurrentDir).FileContents);
            // the root module directory does not get a cvs Entries line.
            // TODO: There has to be a cleaner way to do this...
            if (Services.Repository.WorkingPath.Length <= entry.Path.Length) {
                manager.AddEntry(entry);
            }

            Services.ResponseMessageEvents.SendResponseMessage(
                String.Format("Updating {0}", RemoveTrailingSlash(localPath)), this.GetType());
        }
コード例 #7
0
ファイル: Manager.cs プロジェクト: Orvid/NAntUniversalTasks
        /// <summary>
        ///     Create the root file in the local cvs directory.  This file holds
        ///         the details about the cvs root used in this sandbox.
        /// </summary>
        /// <param name="workingDirectory">Holds information about the current
        ///     path and cvs root.</param>
        /// <param name="localPath">The local path response sent down from
        ///     the server.</param>
        /// <param name="repositoryPath">The path to the file name on the
        ///     server.</param>
        /// <param name="stickyTag">The sticky tag to add to the tag file.</param>
        /// <returns>The object contents of the newly created root file.</returns>
        public Tag AddTag (WorkingDirectory workingDirectory, String localPath,
            String repositoryPath, String stickyTag) {
            PathTranslator pathTranslator =
                new PathTranslator (workingDirectory,
                repositoryPath);
            Factory factory = CvsFactory;

            FileInfo tagFile = 
                new FileInfo(Path.Combine(PathTranslator.AppendCvs(localPath).FullName,
                Tag.FILE_NAME));

            Tag tag =
                (Tag)factory.CreateCvsObject (tagFile, stickyTag);

            return this.AddTag (tag);;
        }
コード例 #8
0
ファイル: Manager.cs プロジェクト: Orvid/NAntUniversalTasks
        /// <summary>
        ///     Create the root file in the local cvs directory.  This file holds
        ///         the details about the cvs root used in this sandbox.
        /// </summary>
        /// <param name="workingDirectory">Holds information about the current
        ///     path and cvs root.</param>
        /// <param name="localPath">The local path response sent down from
        ///     the server.</param>
        /// <param name="repositoryPath">The path to the file name on the
        ///     server.</param>
        /// <returns>The object contents of the newly created root file.</returns>
        public Root AddRoot (WorkingDirectory workingDirectory,
                            String localPath,
                            String repositoryPath) {
            PathTranslator pathTranslator =
                new PathTranslator (workingDirectory,
                                    repositoryPath);
            Factory factory = CvsFactory;

            Root root =
                (Root)factory.CreateCvsObject (pathTranslator.CurrentDir, Root.FILE_NAME,
                                            pathTranslator.CvsRoot.ToString ());
            return this.AddRoot (root);
        }
コード例 #9
0
ファイル: Manager.cs プロジェクト: Orvid/NAntUniversalTasks
        /// <summary>
        ///     Create the repository file in the cvs sub directory of the
        ///         current working directory.
        /// </summary>
        /// <param name="workingDirectory">Holds information about the current
        ///     path and cvs root.</param>
        /// <param name="localPath">The local path response sent down from
        ///     the server.</param>
        /// <param name="repositoryPath">The path to the file name on the
        ///     server.</param>
        /// <returns>The object contents of the newly created repository file.</returns>
        public Repository AddRepository (WorkingDirectory workingDirectory,
                                        String localPath,
                                        String repositoryPath) {
            PathTranslator pathTranslator =
                new PathTranslator (workingDirectory,
                                    repositoryPath);
            Factory factory = CvsFactory;

            String repositoryContents = String.Format("{0}/{1}",
                workingDirectory.ModuleName, pathTranslator.RelativePath);

            DirectoryInfo dir = pathTranslator.CurrentDir;

            Repository repository =
                (Repository)factory.CreateCvsObject (dir, Repository.FILE_NAME,
                                                    repositoryContents);
            return this.AddRepository (repository);
        }
コード例 #10
0
ファイル: Manager.cs プロジェクト: Orvid/NAntUniversalTasks
 /// <summary>
 ///     Create a directory entry from the specified path translator.
 /// </summary>
 /// <param name="path">The information about the path to create the
 ///     directory entry for.</param>
 /// <returns>An entry object that contains information about the directory
 ///       entry.</returns>
 public Entry CreateDirectoryEntry (PathTranslator path) {
     return this.CreateDirectoryEntry(path.LocalPath);
 }
コード例 #11
0
ファイル: Manager.cs プロジェクト: Orvid/NAntUniversalTasks
        /// <summary>
        /// Create a <code>CVS\Entries</code> management file with the given
        ///     entry line, or if the file exists then add the line to the
        ///     management file.
        /// </summary>
        /// <param name="workingDirectory">Local working directory.</param>
        /// <param name="localPath">The local path response sent down from
        ///     the server.</param>
        /// <param name="repositoryPath">The path to the file name on the
        ///     server.</param>
        /// <param name="entry">The string value that represents the cvs
        ///     entry.</param>
        /// <returns>The contents of the newly created entries file that match
        ///     the given file name created.</returns>
        public Entry AddEntry (WorkingDirectory workingDirectory,
                            String localPath,
                            String repositoryPath,
                            String entry) {
            PathTranslator pathTranslator =
                new PathTranslator (workingDirectory,
                                    repositoryPath);
            Factory factory = CvsFactory;

            Entry cvsEntry = (Entry)
                factory.CreateCvsObject(pathTranslator.CurrentDir, Entry.FILE_NAME, entry);

            return this.AddEntry(cvsEntry);
        }