[PATCH] convert: support glob patterns to exclude/include files
Patrick Mézard
pmezard at gmail.com
Fri Mar 12 14:47:06 CST 2010
Le 09/03/10 15:49, Greg Ward a écrit :
> On Sun, Mar 7, 2010 at 4:21 PM, Tessa Starkey <testarkey at gmail.com> wrote:
>> # HG changeset patch
>> # User Tessa Starkey <testarkey at gmail.com>
>> # Date 1267939187 18000
>> # Node ID b894d8a84bef5dd0702e41c9f7959a62f7cbd9f6
>> # Parent efd3b71fc29315e79a29033fdd0d149b309eb398
>> convert: support glob patterns to include/exclude files
>>
>> Implemented by replacing the existing filename-matching logic and using
>> matcher from the main match module instead. This was done to avoid
>> re-implementing glob matching.
>
> As it happens, I do know my way around convert a little bit, although
> I'm not familiar with filemap. So I'll see if I can throw out some
> useful feedback.
>
> Just to confuse things, I'll start with the tests. I like test-first
> development, so why not test-first code reviews?
>
>> --- a/tests/test-convert-filemap
>> +++ b/tests/test-convert-filemap
>> @@ -21,6 +21,8 @@
>> echo dir/file2 >> dir/file2
>> echo dir/subdir/file3 >> dir/subdir/file3
>> echo dir/subdir/file4 >> dir/subdir/file4
>> +echo dir/fi.bin >> dir/fi.bin
>> +echo dir/file5.bin >> dir/file5.py
>
> I assume the content of the file is irrelevant here, but the
> convention seems to be that content == filename, in which case you
> should echo dir/file5.py >> dir/file5.py.
>
>> @@ -128,3 +130,16 @@
>> hg --cwd source cat copied
>> echo 'copied2:'
>> hg --cwd renames.repo cat copied2
>> +
>> +cat > globs.fmap <<EOF
>> +exclude dir/file2
>> +exclude b*
>> +rename dir dir2
>> +rename foo foo2
>> +exclude */f?.py
>> +EOF
>
> First, you need something like "echo % convert with glob patterns in
> filemap" at the top of this test case. Every caller to splitrepo gets
> that for free, and it makes the test output much easier to follow.
>
> Second, do regular expressions work? I.e. is it possible to say
>
> exclude regexp:.*/f.\.py$
>
> instead?
Yes, it spells 're:' or 'relre:', see my other response about new problems brought by regexps syntax.
--
Patrick Mézard
More information about the Mercurial-devel
mailing list