Boost logo

Boost :

From: Bjørn Roald (bjorn_at_[hidden])
Date: 2007-10-21 11:58:10


John Maddock wrote:
> Bjørn Roald wrote:
>
>> Hm, if it is binary, would using a svn library be acceptable? Maybe
>> we could do it trough a dynamically loadable plug-in so it would not
>> be required for the basic bcp tool. Anyways, I guess licensing may
>> be an issue, but this is not a boost library, it is a tool.
>>
>
> Indeed, I just haven't had the time to figure out what's required yet :-(
>

I looked at the svn library sources a bit. I concluded that this is
relatively simple text parsing. There is one important point to note.
The format of the entries file has changes from XML to a simpler text
format. Older clients may still use the old format and that will not
work. New clients will convert the files automatically as they are used
the first time. Hence I decided to ignore the XML format.

I wrote a function that I added to scan_cvs_path.cpp, see attachment.
It fill the m_cvs_path map with data as it is done in the original cvs
version. The only tricky part was getting to the mime info, which are
in separate property files, to determine if files are text or binary.
Also you have to determine whether various mime types map to binary or
text mode.

In my function, if a file does not have mime property, it is assumed to
be text. If it has mime property starting with anything other than
"text/" then it is assumed to be binary. I tested in my version of bcp
and it seems to work fine. I added an additional --svn flagg for the
command line and the other obvious control logic changes. Maybe people
are using bcp automatically for various boost releases, in that case we
could make --cvs and --svn aliases, and automatically check for entries
files in CVS or .svn directories respectively to check which mode to set.

I can provide a patch, but my code is kind of tangled with my other
changes for the replace namespace stuff, so did not post that now. If
you want me post a patch with or without the namespace stuff, please
tell me.

Note. I struggled with multi line regexp for tokenizer matching, urrr..
I gave up and did it old fashion plain and simple. I think my logic may
be cleaned up and made simpler with less nested if statements by using
more clever regexp. However, as it is now, it works. :-)

-- 
Bjørn



Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk