From: Clayton H. <dr...@us...> - 2004-11-29 13:56:49
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/ICSharpCode/SharpCvsLib/FileSystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16622/src/ICSharpCode/SharpCvsLib/FileSystem Modified Files: AbstractCvsFile.cs Entry.cs Repository.cs Log Message: Working on issue with commit command, partially there just running into an up to date check issue. Index: AbstractCvsFile.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/ICSharpCode/SharpCvsLib/FileSystem/AbstractCvsFile.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AbstractCvsFile.cs 3 Nov 2004 07:06:53 -0000 1.5 --- AbstractCvsFile.cs 29 Nov 2004 13:56:39 -0000 1.6 *************** *** 144,147 **** --- 144,163 ---- } + protected static string LoadFile(string filePath) { + return LoadFile(new FileInfo(filePath)); + } + + /// <summary> + /// Load the file from the current directory. + /// </summary> + /// <returns>The string contents of the file.</returns> + protected static string LoadFile (FileInfo filePath) { + string fileContents; + using (StreamReader reader = new StreamReader(filePath.FullName)) { + fileContents = reader.ReadToEnd(); + } + return fileContents; + } + /// <summary> /// Parse command that must be overridden for subclasses. Index: Repository.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/ICSharpCode/SharpCvsLib/FileSystem/Repository.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Repository.cs 5 Nov 2004 08:15:24 -0000 1.12 --- Repository.cs 29 Nov 2004 13:56:39 -0000 1.13 *************** *** 124,128 **** /// </example> public override void Parse (String line) { ! this.moduleName = line.Substring(0, line.IndexOf("/")); this.FileContents = line; } --- 124,132 ---- /// </example> public override void Parse (String line) { ! int moduleLength = line.Length; ! if (line.IndexOf("/") > -1) { ! moduleLength = line.IndexOf("/"); ! } ! this.moduleName = line.Substring(0, moduleLength); this.FileContents = line; } Index: Entry.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/ICSharpCode/SharpCvsLib/FileSystem/Entry.cs,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Entry.cs 1 Nov 2004 21:23:30 -0000 1.21 --- Entry.cs 29 Nov 2004 13:56:39 -0000 1.22 *************** *** 304,307 **** --- 304,318 ---- /// <summary> + /// Load file using the current directory, if the file cannot be found + /// in the current directory appends cvs and tries again. + /// </summary> + public Entry Load() { + FileInfo entryPath = new FileInfo( + System.IO.Path.Combine(System.IO.Path.Combine(Environment.CurrentDirectory, "CVS"), + "Entries")); + return new Entry(entryPath.DirectoryName, LoadFile(entryPath)); + } + + /// <summary> /// Creates an <see cref="Entry"/> object that manages the file being passed in. /// </summary> |