Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copy/move directory updates #39

Merged
merged 25 commits into from
Apr 9, 2012
Merged

Conversation

rmboggs
Copy link
Member

@rmboggs rmboggs commented Mar 16, 2012

My attempt on addressing the issue of copying/moving directories. Please review before merging into master.

…Empty static method to FilterChain. Added test to Move task to check issue that was reported regarding moving directories.
…if the Includes list is empty when the tasks are called.
… cleaned up the formatting and removed some commented codes.
… the FileOperationMap class. Updated the Log outputs in the copy and move tasks to take directory operations into account. Added more comments.
@rmboggs
Copy link
Member Author

rmboggs commented Mar 16, 2012

This is trying to fix the problem reported in issue #11.

…cted FileCopyMap property back in CopyTask (as obsolete property). Reworked Copy/Move tasks to move entire directoriesif CopyFileSet Includes list is empty. Added method to convert FileOperationMap to Hashtable (for FileCopyMap property). Added private static method to FileUtils static class to check if FilterChain is null or empty.
@rmboggs
Copy link
Member Author

rmboggs commented Mar 21, 2012

FYI - These changes were tested using mono-2.0, mono-4.0, net-2.0, net-3.5, and net-4.0 on WinXP and Mac OS X 10.6.

/// destination file.
/// </para>
/// <para>
/// On Windows, the <see cref="Hashtable" /> is case-insensitive.
/// </para>
/// </remarks>
protected Hashtable FileCopyMap {
get { return _fileCopyMap; }
[ObsoleteAttribute("Use OperationMap instead of FileCopyMap.")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd make it clear that this is essentially a read-only hashtable now.
Any changes you make to the hashtable will not be taken into account.
I'd clarify this in the docs and the ObsoleteAttribute, and check if you can actually return a read-only hashtable (that will throw exception when you attend to modify it); does such a thing exist in .NET ?

…eSet class (as protected internal property). Added IsNullOrEmpty static method to FilterChain class as an internal method. Reworked MoveDirectory static method in FileUtils class for clarity. Removed copytask test that was no longer relevent. Added more move task tests. Documented copy/move task to include details about directories operations.
…ring build. Matches recent change to Makefile.
…n checking files, not directories. Fixed new MoveTask test to take recent DirectoryScanner.IsEverythingIncluded fix into account. Added additional MoveTask test and added DirectoryScanner test.
{
string stagePath = GetTempDirectoryName();

Directory.Move(sourceDirectory, stagePath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps add a try / catch or try / finally in which you ensure that - if the stagePath (still) exists, it is removed.
this avoids "leaking" stage paths.

… but different casing (ie: C:\nant to C:\NAnt) on windows system. Added test for this change and additional comments for clarity.
Log(Level.Info, "Copying {0} file{1} to '{2}'.", fileCount, (fileCount != 1) ? "s" : "", ToFile);
} else {
Log(Level.Info, "Copying {0} file{1} to '{2}'.", fileCount, (fileCount != 1) ? "s" : "", ToDirectory);
if (OperationMap.Count > 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I'd have the following to start the method:

if (OperationMap.Count == 0)
return;

That way you don't have to indent the complete logic in that method.

foreach (DictionaryEntry fileEntry in FileCopyMap) {
string destinationPath = (string) fileEntry.Key;
string sourcePath = ((FileDateInfo) fileEntry.Value).Path;
if (OperationMap.Count > 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I'd have the following to start the method:

if (OperationMap.Count == 0)
return;

That way you don't have to indent the complete logic in that method.

@rmboggs
Copy link
Member Author

rmboggs commented Apr 9, 2012

Rec'd ok from Gert via email this merge. Will merge sometime today. :)

rmboggs added a commit that referenced this pull request Apr 9, 2012
@rmboggs rmboggs merged commit 2406278 into nant:master Apr 9, 2012
@rmboggs rmboggs mentioned this pull request Apr 9, 2012
ft- pushed a commit to ft-/opensim-optimizations-wip that referenced this pull request Apr 26, 2014
…opy files into bin/Debug or bin/Release

nant_0.91~alpha2+dfsg-3_all.deb in Ubuntu 12.04 and earlier actually ignored these due to a bug
However, nant 0.92~rc1+dfsg-2 in Ubuntu 12.10 fixes this bug (possibly nant/nant#39).
Which makes nant time-consumingly copy these files when the aren't actually used.
Tested removal of <copy> on both nant 0.91 and nant 0.92
Will be submitting this patch to prebuild project for comment though I suspect there's nobody there to pay attention.
justincc pushed a commit to justincc/libopenmetaverse that referenced this pull request Jul 24, 2014
…opy files into bin/Debug or bin/Release

nant_0.91~alpha2+dfsg-3_all.deb in Ubuntu 12.04 and earlier actually ignored these due to a bug
However, nant 0.92~rc1+dfsg-2 in Ubuntu 12.10 fixes this bug (possibly nant/nant#39).
Which makes nant time-consumingly copy these files when the aren't actually used.
Tested removal of <copy> on both nant 0.91 and nant 0.92
This change has been used without issue for OpenSimulator since Nov 14 2012 commit 90c6d2e
TheSyncer pushed a commit to TheSyncer/OpenSim that referenced this pull request Jan 3, 2016
…opy files into bin/Debug or bin/Release

nant_0.91~alpha2+dfsg-3_all.deb in Ubuntu 12.04 and earlier actually ignored these due to a bug
However, nant 0.92~rc1+dfsg-2 in Ubuntu 12.10 fixes this bug (possibly nant/nant#39).
Which makes nant time-consumingly copy these files when the aren't actually used.
Tested removal of <copy> on both nant 0.91 and nant 0.92
Will be submitting this patch to prebuild project for comment though I suspect there's nobody there to pay attention.
TheSyncer pushed a commit to TheSyncer/OpenSim that referenced this pull request Jan 3, 2016
…opy files into bin/Debug or bin/Release

nant_0.91~alpha2+dfsg-3_all.deb in Ubuntu 12.04 and earlier actually ignored these due to a bug
However, nant 0.92~rc1+dfsg-2 in Ubuntu 12.10 fixes this bug (possibly nant/nant#39).
Which makes nant time-consumingly copy these files when the aren't actually used.
Tested removal of <copy> on both nant 0.91 and nant 0.92
Will be submitting this patch to prebuild project for comment though I suspect there's nobody there to pay attention.
nathanscottdaniels pushed a commit to nathanscottdaniels/pnant that referenced this pull request Oct 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants