ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/GoogleTron/FileSystem.cpp
(Generate patch)

Comparing GoogleTron/FileSystem.cpp (file contents):
Revision 701 by douglas, 2006-03-13T03:54:44-08:00 vs.
Revision 713 by douglas, 2006-03-27T00:50:21-08:00

# Line 6 | Line 6
6  
7   #include <cxx/standard.hh>
8  
9 + #include <api/pcre/regex.hpp>
10 +
11   #include "FileSystem.hpp"
12  
13 < FileSystem::FileSystem(const cse::String &sitemap, const cse::String &base, ext::Queue<Url> &queue, api::ThreadMutex &queueLock, const _R<FileSystemCommand> &command) : CommandRunner(sitemap, base, queue, queueLock)
13 > FileSystem::FileSystem(const cse::String &sitemap, const cse::String &base, ext::Queue<Url> &queue, api::ThreadMutex &queueLock, const _R<FileSystemCommand> &command) : CommandRunner(sitemap, queue, queueLock)
14   {
15          api::Cout << _B("File System") << ios::NewLine;
16  
17 <        _foreach (const _L<Subversion::Entry>, entry, client.GetEntries(*command))
18 <                api::Cout << cse::String(*entry) << ios::NewLine;
17 >        Directory(command->root, _S<ios::String>() << base << command->path, true);
18 > }
19 >
20 > void FileSystem::Directory(const api::Path &directory, const cse::String &base, bool root)
21 > {
22 >        ext::RedBlackSet<cse::String> excludes(GetProperties<ext::RedBlackSet<cse::String> >(_B("GoogleTron:Exclude"), directory.GetPath()));
23 >
24 >        if (root)
25 >                excludes.Insert(sitemap);
26 >
27 >        _foreach (const _L<Subversion::Entry>, entry, client.GetEntries(directory.GetPath()))
28 >                if (!entry->GetName().StartsWith('.') && !excludes.Contains(entry->GetName()) && client.GetProperty(_B("svn:mime-type"), directory.GetChild(entry->GetName()).GetPath()).IsEmpty())
29 >                        switch (entry->GetKind())
30 >                        {
31 >                        case Subversion::file:
32 >                                File(directory.GetChild(entry->GetName()), base, *entry);
33 >                                break;
34 >                        case Subversion::dir:
35 >                                Directory(directory.GetChild(entry->GetName()), _S<ios::String>() << base << entry->GetName() << _B("/"));
36 >                                break;
37 >                        _nodefault
38 >                        }
39 > }
40 >
41 > void FileSystem::File(const api::Path &file, const cse::String &base, const Subversion::Entry &entry)
42 > {
43 >        _S<ios::String> location(base);
44 >
45 >        if (!api::Pcre::RegEx(_B("^index\\..+$"))(entry.GetName()))
46 >        {
47 >                cse::String actually(client.GetProperty(_B("GoogleTron:Actually"), file.GetPath()));
48 >
49 >                if (actually.IsEmpty())
50 >                        location << entry.GetName();
51 >                else
52 >                        location << actually;
53 >        }
54 >
55 >        Url url(location, entry.GetModified(), GetFrequency(client.GetProperty(_B("GoogleTron:Frequency"), file.GetPath())), GetPriority(client.GetProperty(_B("GoogleTron:Priority"), file.GetPath())));
56 >
57 >        _synchronized (queueLock)
58 >                queue.Push(url);
59   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines