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 705 by douglas, 2006-03-18T20:49:26-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)
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, base);
18 > }
19 >
20 > void FileSystem::Directory(const api::Path &directory, const cse::String &base)
21 > {
22 >        ext::RedBlackSet<cse::String> excludes;
23 >
24 >        {
25 >                _S<ios::Buffer> property(client.GetProperty(_B("GoogleTron:Exclude"), directory.GetPath()));
26 >                ext::Buffer exclude;
27 >
28 >                while (ios::ReadLine(property, exclude))
29 >                        excludes.Insert(exclude);
30 >        }
31 >
32 >        if (base == this->base)
33 >                excludes.Insert(sitemap);
34 >
35 >        _foreach (const _L<Subversion::Entry>, entry, client.GetEntries(directory.GetPath()))
36 >                if (!entry->GetName().StartsWith('.') && !excludes.Contains(entry->GetName()) && client.GetProperty(_B("svn:mime-type"), directory.GetChild(entry->GetName()).GetPath()).IsEmpty())
37 >                        switch (entry->GetKind())
38 >                        {
39 >                        case Subversion::file:
40 >                                File(directory.GetChild(entry->GetName()), base, *entry);
41 >                                break;
42 >                        case Subversion::dir:
43 >                                Directory(directory.GetChild(entry->GetName()), _S<ios::String>() << base << entry->GetName() << _B("/"));
44 >                                break;
45 >                        _nodefault
46 >                        }
47 > }
48 >
49 > void FileSystem::File(const api::Path &file, const cse::String &base, const Subversion::Entry &entry)
50 > {
51 >        _S<ios::String> location(base);
52 >
53 >        if (!api::Pcre::RegEx(_B("^index\\..+$"))(entry.GetName()))
54 >        {
55 >                cse::String actually(client.GetProperty(_B("GoogleTron:Actually"), file.GetPath()));
56 >
57 >                if (actually.IsEmpty())
58 >                        location << entry.GetName();
59 >                else
60 >                        location << actually;
61 >        }
62 >
63 >        Url url(location, entry.GetModified(), GetFrequency(client.GetProperty(_B("GoogleTron:Frequency"), file.GetPath())), GetPriority(client.GetProperty(_B("GoogleTron:Priority"), file.GetPath())));
64 >
65 >        _synchronized (queueLock)
66 >                queue.Push(url);
67   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines