// ImportModuleCommand.cs
// Copyright (C) 2001 Mike Krueger
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// As a specption does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
using System;
using System.Collections;
using System.IO;
using CVS.Requests;
using CVS.Misc;
namespace CVS.Commands{
public class UpdateCommand2 : ICommand
{
WorkingDirectory workingdirectory;
string logmessage;
string vendor = "vendor";
string release = "release";
public string LogMessage {
get {
return logmessage;
}
set {
logmessage = value;
}
}
public string VendorString {
get {
return vendor;
}
set {
vendor = value;
}
}
public string ReleaseString {
get {
return release;
}
set {
release = value;
}
}
public UpdateCommand2(WorkingDirectory workingdirectory)
{
this.workingdirectory = workingdirectory;
}
/* log
Case
Argument -b
Argument 1.1.1
Argument -m
Argument logmessage
Argumentx
Argument SharpDevelop
Argument vendor
Argument start
Directory .
/cvsroot/sharpdevelop/SharpDevelop
Modified TestME.cs
u=rw,g=rw,o=rw
9
testme :)
Directory c
/cvsroot/sharpdevelop/SharpDevelop/c
Modified te2.cs
u=rw,g=rw,o=rw
14
fojrwpefj4erwp
Directory .
/cvsroot/sharpdevelop/SharpDevelop
import
*/
public void Execute(CVSServerConnection connection)
{
foreach (DictionaryEntry folder in workingdirectory.Folders) {
foreach (Entry entry in ((Folder)folder.Value).Entries)
if (!entry.IsDirectory) {
DateTime old = entry.TimeStamp;
entry.TimeStamp = entry.TimeStamp;
string path = workingdirectory.CvsRoot.CvsRepository + "/" + workingdirectory.WorkingDirectoryName + folder.Key.ToString();
connection.SubmitRequest(new DirectoryRequest(".", path));
path = workingdirectory.CvsRoot.CvsRepository + folder.Key.ToString();
string fileName = Path.GetDirectoryName(workingdirectory.LocalDirectory) + Path.DirectorySeparatorChar + Path.GetDirectoryName(path.Substring(workingdirectory.CvsRoot.CvsRepository.Length)) + "/" + entry.Name;
fileName = fileName.Replace('/', Path.DirectorySeparatorChar);
Console.WriteLine("local name ? : " + fileName);
if (File.GetLastAccessTime(fileName) != entry.TimeStamp) {
connection.SubmitRequest(new ModifiedRequest(entry.Name));
if (entry.IsBinaryFile) {
connection.UncompressedFileHandler.SendBinaryFile(connection.OutputStream, fileName);
} else {
connection.UncompressedFileHandler.SendTextFile(connection.OutputStream, fileName);
}
} else {
connection.SubmitRequest(new EntryRequest(entry));
connection.SubmitRequest(new UnchangedRequest(entry.Name));
}
entry.TimeStamp = old;
}
}
connection.SubmitRequest(new UpdateRequest());
}
}
}
|