[PATCH stable] mq: fix qrefresh case sensitivity (issue3271)
Adrian Buehlmann
adrian at cadifra.com
Fri Nov 2 14:25:18 UTC 2012
On 2012-10-30 23:54, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham at fb.com>
> # Date 1351628346 25200
> # Branch stable
> # Node ID 983d425ca3f84e77ebbd5a9562352a9284f0a656
> # Parent 0188ddfa844ed5f9cf2eed46765dcaa7dcad89f6
> mq: fix qrefresh case sensitivity (issue3271)
>
> When calling qrefresh with filenames, the filenames were being
> treated as case-sensistive on case-insensitive file systems.
> So 'qrefresh foo' would not match file 'Foo', and it failed silently.
> This fix makes it work correctly on case-insensitive file systems.
>
> Previously the matching function was applied directly to the filenames.
> Now we apply the matching function through repo.status, which handles
> the case logic for us. A side effect of using repo.status is that
> if the qrefresh file doesn't exist, there is output stating it
> doesn't exist.
>
> Adds a test to an existing mq refresh case test.
[..]
> diff --git a/tests/test-mq-qrefresh.t b/tests/test-mq-qrefresh.t
> --- a/tests/test-mq-qrefresh.t
> +++ b/tests/test-mq-qrefresh.t
> @@ -203,16 +203,17 @@
> +patched
>
>
> qrefresh --short tests:
>
> $ echo 'orphan' > orphanchild
> $ hg add orphanchild
> $ hg qrefresh nonexistentfilename # clear patch
> + nonexistentfilename: No such file or directory
> $ hg qrefresh --short 1/base
> $ hg qrefresh --short 2/base
>
> $ hg qdiff
> diff -r e7af5904b465 1/base
> --- a/1/base
> +++ b/1/base
> @@ -1,1 +1,1 @@
This is a bit strange.
The preexisting comment ("# clear patch") is probably a hint that
someone tried to "clear the patch".
But it seems to me that this didn't clear the patch.
It seems it just silently failed before this patch, now we get an error
message.
The problem I was looking into is that the error message on Windows is
different than on Linux, currently causing the test to fail with:
--- C:\Users\adi\hgrepos\hg-main\tests\test-mq-qrefresh.t
+++ C:\Users\adi\hgrepos\hg-main\tests\test-mq-qrefresh.t.err
@@ -208,7 +208,7 @@
$ echo 'orphan' > orphanchild
$ hg add orphanchild
$ hg qrefresh nonexistentfilename # clear patch
- nonexistentfilename: No such file or directory
+ nonexistentfilename: The system cannot find the file specified
$ hg qrefresh --short 1/base
$ hg qrefresh --short 2/base
Now, I could probably send a patch that globs away that difference in
error message, like this:
diff --git a/tests/test-mq-qrefresh.t b/tests/test-mq-qrefresh.t
--- a/tests/test-mq-qrefresh.t
+++ b/tests/test-mq-qrefresh.t
@@ -208,7 +208,7 @@
$ echo 'orphan' > orphanchild
$ hg add orphanchild
$ hg qrefresh nonexistentfilename # clear patch
- nonexistentfilename: No such file or directory
+ nonexistentfilename: * (glob)
$ hg qrefresh --short 1/base
$ hg qrefresh --short 2/base
But this seems to me like papering over the fact that the command there
never really did what the comment suggested.
I haven't looked into the implementation of mq nor the details of this
patch. Perhaps someone else is more versed with this.
More information about the Mercurial-devel
mailing list