Mercurial > hg
changeset 17888:39b7052b217b stable
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.
author | Durham Goode <durham@fb.com> |
---|---|
date | Tue, 30 Oct 2012 13:19:06 -0700 |
parents | 0e2846b2482c |
children | ce7bc04d863b |
files | hgext/mq.py tests/test-casefolding.t tests/test-mq-qrefresh.t |
diffstat | 3 files changed, 25 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Wed Oct 17 21:30:08 2012 -0700 +++ b/hgext/mq.py Tue Oct 30 13:19:06 2012 -0700 @@ -1575,8 +1575,18 @@ m = list(mm) r = list(dd) a = list(aa) - c = [filter(matchfn, l) for l in (m, a, r)] - match = scmutil.matchfiles(repo, set(c[0] + c[1] + c[2] + inclsubs)) + + # create 'match' that includes the files to be recommited. + # apply matchfn via repo.status to ensure correct case handling. + cm, ca, cr, cd = repo.status(patchparent, match=matchfn)[:4] + allmatches = set(cm + ca + cr + cd) + refreshchanges = [x.intersection(allmatches) for x in (mm, aa, dd)] + + files = set(inclsubs) + for x in refreshchanges: + files.update(x) + match = scmutil.matchfiles(repo, files) + bmlist = repo[top].bookmarks() try: @@ -1656,6 +1666,7 @@ n = newcommit(repo, oldphase, message, user, ph.date, match=match, force=True) # only write patch after a successful commit + c = [list(x) for x in refreshchanges] if inclsubs: self.putsubstate2changes(substatestate, c) chunks = patchmod.diff(repo, patchparent,
--- a/tests/test-casefolding.t Wed Oct 17 21:30:08 2012 -0700 +++ b/tests/test-casefolding.t Tue Oct 30 13:19:06 2012 -0700 @@ -160,4 +160,15 @@ $ hg status -A C MiXeDcAsE + $ hg qpop -a + popping refresh-casechange + patch queue now empty + $ hg qnew refresh-pattern + $ hg status + $ echo A > A + $ hg add + adding A + $ hg qrefresh a # issue 3271, qrefresh with file handled case wrong + $ hg status # empty status means the qrefresh worked + $ cd ..
--- a/tests/test-mq-qrefresh.t Wed Oct 17 21:30:08 2012 -0700 +++ b/tests/test-mq-qrefresh.t Tue Oct 30 13:19:06 2012 -0700 @@ -208,6 +208,7 @@ $ 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