コード例 #1
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="workingdirectory"></param>
 /// <param name="directory"></param>
 /// <param name="entry"></param>
 public RemoveCommand(WorkingDirectory workingdirectory,
                     string directory,
                     Entry entry)
 {
     this.workingdirectory    = workingdirectory;
     this.directory = directory;
     this.entry = entry;
 }
コード例 #2
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;
        }
コード例 #3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="entry"></param>
 public EntryRequest(Entry entry)
 {
     this.entry = entry;
 }
コード例 #4
0
ファイル: Manager.cs プロジェクト: Orvid/NAntUniversalTasks
 /// <summary>
 /// Add the entry to the <code>CVS\Entries</code> file, if the file does
 ///     not exist then create a new file.
 /// </summary>
 /// <param name="entry">An entry object that represents a line in the
 ///     <code>CVS\Entries</code> file and/ or a file that is being
 ///     managed by CVS.</param>
 /// <returns>The Entry file that has been added.</returns>
 public Entry AddEntry (Entry entry) {
     if (entry.CvsFile.Exists) {
         Entries entries = this.FetchEntries(entry.CvsFile.FullName);
         if (entries.Contains(entry.Key)) {
             // update entry
             entries[entry.Key] = entry;
         } else {
             // add new entry
             entries.Add(entry.Key, entry);
         }
         this.WriteToFile(entries);
     } else {
         this.WriteToFile(entry);
     }
     return entry;
 }
コード例 #5
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;
        }
コード例 #6
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="workingdirectory"></param>
 /// <param name="directory"></param>
 /// <param name="entry"></param>
 public StatusCommand(WorkingDirectory workingdirectory, 
     string directory, Entry entry){
     this._workingdirectory    = workingdirectory;
     this.directory = directory;
     this.entry = entry;
     if (null == this.Folders) {
         this._folders = new Folders();
         Folder folder = new Folder();
         folder.Entries.Add(entry);
         this._folders.Add(folder);
     }
 }
コード例 #7
0
ファイル: Entry.cs プロジェクト: Orvid/NAntUniversalTasks
 /// <summary>
 /// Parse the name of the file from the cvs file.
 /// </summary>
 /// <param name="line">The line to parse.</param>
 /// <returns>The name of the entry in the cvs file.</returns>
 public static String ParseFileName (String line) {
     Entry entry = new Entry(new FileInfo(System.IO.Path.GetTempPath()), line);
     return entry.Filename;
 }
コード例 #8
0
ファイル: Entry.cs プロジェクト: Orvid/NAntUniversalTasks
        /// <summary>
        /// Creates an <see cref="Entry"/> object that manages the file being passed in.
        /// </summary>
        /// <param name="managedDir">The directory that is under cvs control.</param>
        /// <returns>A new cvs entry, using the full path to the file for the
        ///     entry information.</returns>
        /// <exception cref="EntryParseException">If the entry file cannot be
        ///     parsed.</exception>
        /// <example>
        ///     <list type="table">
        ///         <term>managedDir</term>
        ///         <description>The full path to a directory being managed by CVS such as:
        ///             <br />
        ///             <code>C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\sharpcvslib-tests\sharpcvslib-test-repository\someFile.txt</code>
        ///             would create a Entries line like:
        ///             <code>/someText.txt////</code>
        ///         </description>
        ///     </list>
        ///     <warn>If a directory is being managed use the <see cref="DirectoryInfo"/>
        ///     object.</warn>
        /// </example>
        public static Entry CreateEntry (DirectoryInfo managedDir) {
            DirectoryInfo cvsDir = new DirectoryInfo(
                System.IO.Path.Combine(System.IO.Path.GetDirectoryName(managedDir.FullName), "CVS"));

            FileInfo cvsFile = new FileInfo(
                System.IO.Path.Combine(cvsDir.FullName, Entry.FILE_NAME));

            StringBuilder entryString = new StringBuilder();
            entryString.Append("D");
            entryString.Append("/").Append(managedDir.Name);
            entryString.Append("/0///");

            Entry entry = new Entry(cvsFile, entryString.ToString());
            return entry;
        }
コード例 #9
0
ファイル: Factory.cs プロジェクト: Orvid/NAntUniversalTasks
        /// <summary>
        /// Create a cvs file object given the full path and line of the file.
        /// </summary>
        /// <param name="file"></param>
        /// <param name="line"></param>
        /// <returns></returns>
        public ICvsFile CreateCvsObject (FileInfo file, string line) {
            ICvsFile entry;

            if (!System.Enum.IsDefined(typeof(FileType), file.Name)) {
                throw new UnsupportedFileTypeException(string.Format("Unknown cvs file type: {0}",
                    file.Name));
            }

            switch ((FileType)Enum.Parse(typeof(FileType), file.Name, true)) {
                case (FileType.Entries): {
                    entry = new Entry(file, line);
                    break;
                }
                case (FileType.Repository):{
                    entry = new Repository (file, line);
                    break;
                }
                case (FileType.Root):{
                    entry = new Root (file, line);
                    break;
                }
                case (FileType.Tag):{
                    entry = new Tag (file, line);
                    break;
                }
                default:{
                    StringBuilder msg = new StringBuilder();
                    msg.Append("Unknown file type specified.");
                    msg.Append("fileType=[").Append(file.Name).Append("]");
                    throw new UnsupportedFileTypeException (msg.ToString());
                }

            }
            return entry;
        }
コード例 #10
0
ファイル: Entries.cs プロジェクト: Orvid/NAntUniversalTasks
 /// <summary>
 /// Add a new entry to the entry collection.
 /// </summary>
 /// <param name="path">The path of the file the entry represents 
 ///     on the filesystem.</param>
 /// <param name="entry">The entry object to add to the collection.</param>
 public void Add(String path, Entry entry) {
     Dictionary.Add(path, entry);
 }
コード例 #11
0
ファイル: Entries.cs プロジェクト: Orvid/NAntUniversalTasks
 public void Add(Entry entry) {
     if (null == entry || null == entry.FullPath) {
         throw new ArgumentException("Entry must contain a path value.");
     }
     Dictionary.Add(entry.FullPath, entry);
 }
コード例 #12
0
 /// <summary>
 /// Add a new entry to the folders collection.
 /// </summary>
 /// <param name="folder"></param>
 /// <param name="entry"></param>
 public void AddEntry(string folder, Entry entry)
 {
     if (folders[folder] == null) {
         folders[folder] = new Folder();
     }
     ((Folder)folders[folder]).Entries.Add(entry.FullPath, entry);
 }