From: <dr...@us...> - 2003-10-17 01:15:18
|
Update of /cvsroot/sharpcvslib/sharpcvslib/src/ICSharpCode/SharpCvsLib/Commands In directory sc8-pr-cvs1:/tmp/cvs-serv19672/src/ICSharpCode/SharpCvsLib/Commands Modified Files: ImportModuleCommand.cs Log Message: Committed console usage message, parser and tests on behalf of Steve Kenzell. Index: ImportModuleCommand.cs =================================================================== RCS file: /cvsroot/sharpcvslib/sharpcvslib/src/ICSharpCode/SharpCvsLib/Commands/ImportModuleCommand.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ImportModuleCommand.cs 5 Oct 2003 09:20:31 -0000 1.4 --- ImportModuleCommand.cs 17 Oct 2003 01:14:08 -0000 1.5 *************** *** 29,34 **** // exception statement from your version. // ! // Author: Mike Krueger, ! // Clayton Harbour {cla...@sp...} #endregion --- 29,34 ---- // exception statement from your version. // ! // <author>Mike Krueger</author> ! // <author>Clayton Harbour</author> #endregion *************** *** 45,98 **** namespace ICSharpCode.SharpCvsLib.Commands { ! /// <summary> /// Import a module into the cvs repository /// </summary> ! public class ImportModuleCommand : ICommand ! { ! private WorkingDirectory workingdirectory; ! private string logmessage; ! private string vendor = "vendor"; ! private string release = "release"; private readonly ILog LOGGER = LogManager.GetLogger (typeof (ImportModuleCommand)); ! /// <summary> /// The log message returned by the cvs server. /// </summary> ! public string LogMessage { ! get { ! return logmessage; ! } ! set { ! logmessage = value; ! } ! } ! /// <summary> /// Vendor string. /// </summary> ! public string VendorString { ! get { ! return vendor; ! } ! set { ! vendor = value; ! } ! } ! /// <summary> /// Release string /// </summary> ! public string ReleaseString { ! get { ! return release; ! } ! set { ! release = value; ! } ! } ! /// <summary> /// Constructor for the import module command. --- 45,98 ---- namespace ICSharpCode.SharpCvsLib.Commands { ! /// <summary> /// Import a module into the cvs repository /// </summary> ! public class ImportModuleCommand : ICommand ! { ! private WorkingDirectory workingdirectory; ! private string logmessage; ! private string vendor = "vendor"; ! private string release = "release"; private readonly ILog LOGGER = LogManager.GetLogger (typeof (ImportModuleCommand)); ! /// <summary> /// The log message returned by the cvs server. /// </summary> ! public string LogMessage { ! get { ! return logmessage; ! } ! set { ! logmessage = value; ! } ! } ! /// <summary> /// Vendor string. /// </summary> ! public string VendorString { ! get { ! return vendor; ! } ! set { ! vendor = value; ! } ! } ! /// <summary> /// Release string /// </summary> ! public string ReleaseString { ! get { ! return release; ! } ! set { ! release = value; ! } ! } ! /// <summary> /// Constructor for the import module command. *************** *** 100,160 **** /// <param name="workingdirectory"></param> /// <param name="logmessage"></param> ! public ImportModuleCommand(WorkingDirectory workingdirectory, string logmessage) ! { ! this.logmessage = logmessage; ! this.workingdirectory = workingdirectory; ! } ! /// <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)); ! connection.SubmitRequest(new ArgumentRequest(workingdirectory.WorkingDirectoryName)); ! connection.SubmitRequest(new ArgumentRequest(vendor)); ! connection.SubmitRequest(new ArgumentRequest(release)); ! Console.WriteLine("IMPORT START"); ! ! foreach (DictionaryEntry folder in workingdirectory.Folders) { ! foreach (Entry entry in ((Folder)folder.Value).Entries) { ! DateTime old = entry.TimeStamp; ! entry.TimeStamp = entry.TimeStamp.ToUniversalTime(); ! ! string path = workingdirectory.CvsRoot.CvsRepository + "/" + workingdirectory.WorkingDirectoryName + folder.Key.ToString(); ! string modulepath; ! ! if (folder.Key.ToString().Length < 1) { ! modulepath = "."; ! } else { ! modulepath = folder.Key.ToString().Substring(1); ! } ! ! connection.SubmitRequest(new DirectoryRequest(modulepath, path)); ! connection.SubmitRequest(new ModifiedRequest(entry.Name)); ! ! path = Path.Combine (workingdirectory.CvsRoot.CvsRepository, ! folder.Key.ToString()); ! ! ! string fileName = Path.Combine (path, entry.Name); connection.SendFile(fileName, entry.IsBinaryFile); ! ! entry.TimeStamp = old; ! } ! } ! ! connection.SubmitRequest(new DirectoryRequest(".", workingdirectory.CvsRoot.CvsRepository + "/" + workingdirectory.WorkingDirectoryName)); ! connection.SubmitRequest(new ImportRequest()); if (LOGGER.IsDebugEnabled) { LOGGER.Debug ("IMPORT END"); } ! } ! } } --- 100,160 ---- /// <param name="workingdirectory"></param> /// <param name="logmessage"></param> ! public ImportModuleCommand(WorkingDirectory workingdirectory, string logmessage) ! { ! this.logmessage = logmessage; ! this.workingdirectory = workingdirectory; ! } ! /// <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)); ! connection.SubmitRequest(new ArgumentRequest(workingdirectory.WorkingDirectoryName)); ! connection.SubmitRequest(new ArgumentRequest(vendor)); ! connection.SubmitRequest(new ArgumentRequest(release)); ! System.Console.WriteLine("IMPORT START"); ! ! foreach (DictionaryEntry folder in workingdirectory.Folders) { ! foreach (Entry entry in ((Folder)folder.Value).Entries) { ! DateTime old = entry.TimeStamp; ! entry.TimeStamp = entry.TimeStamp.ToUniversalTime(); ! ! string path = workingdirectory.CvsRoot.CvsRepository + "/" + workingdirectory.WorkingDirectoryName + folder.Key.ToString(); ! string modulepath; ! ! if (folder.Key.ToString().Length < 1) { ! modulepath = "."; ! } else { ! modulepath = folder.Key.ToString().Substring(1); ! } ! ! connection.SubmitRequest(new DirectoryRequest(modulepath, path)); ! connection.SubmitRequest(new ModifiedRequest(entry.Name)); ! ! path = Path.Combine (workingdirectory.CvsRoot.CvsRepository, ! folder.Key.ToString()); ! ! ! string fileName = Path.Combine (path, entry.Name); connection.SendFile(fileName, entry.IsBinaryFile); ! ! entry.TimeStamp = old; ! } ! } ! ! connection.SubmitRequest(new DirectoryRequest(".", workingdirectory.CvsRoot.CvsRepository + "/" + workingdirectory.WorkingDirectoryName)); ! connection.SubmitRequest(new ImportRequest()); if (LOGGER.IsDebugEnabled) { LOGGER.Debug ("IMPORT END"); } ! } ! } } |