private static Entries LoadImpl (FileInfo cvsFile) { Manager manager = new Manager(cvsFile.DirectoryName); return manager.FetchEntries(cvsFile.FullName); }
/// <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()); }
private void FetchFilesRecursive(ArrayList folders, string localDirectory) { String modulePath = localDirectory; Manager manager = new Manager(modulePath); Folder folder = new Folder (); folder.Repository = (Repository)manager.FetchSingle (modulePath, Factory.FileType.Repository); Entries entries1= manager.FetchEntries(Path.Combine(modulePath, Entry.FILE_NAME)); foreach (DictionaryEntry dicEntry in entries1) { Entry entry = (Entry)dicEntry.Value; if (!entry.IsDirectory) { if (LOGGER.IsDebugEnabled) { LOGGER.Debug("Found file=[" + entry.FullPath + "]"); } folder.Entries.Add (entry.FullPath, entry); } } folders.Add (folder); foreach (DictionaryEntry dicEntry in entries1) { Entry entry = (Entry)dicEntry.Value; if (entry.IsDirectory) { string childDir = Path.Combine(localDirectory, entry.Name); if (LOGGER.IsDebugEnabled) { LOGGER.Debug("Found directory=[" + childDir + "]"); } FetchFilesRecursive(folders, childDir); } } }