Mercurial > hg
annotate tests/test-sparse-clear.t @ 49603:3eda36e9b3d6 stable
matcher: fix issues regex flag contained in pattern (issue6759)
Python 3.11 is now enforcing that flag must be at the beginning of the regex
This creates a serious regression for people using Python 3.11 with an hgignore
using flag in a "relre" pattern.
We now detect any flags in such pattern and "prepend" our ".*" pattern after them.
In addition, we now insert the flag in the regexp to only affect the pattern we
are rewriting. Otherwise, the regex built from the combined pattern would these
flags in the middle of it anyway.
As a side effect of this last change, we fix a bug… before this change regex
flag in a pattern would affect all combined patterns. That was bad and is not
longer the case.
The Rust code needs to be updated to fix that very bug, but we will do it in
another changeset.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 16 Nov 2022 13:05:01 +0100 |
parents | a6efb9180764 |
children |
rev | line source |
---|---|
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 test sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 $ hg init myrepo |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 $ cd myrepo |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 $ cat >> $HGRCPATH <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
6 > [extensions] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
7 > sparse= |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
8 > purge= |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
9 > strip= |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
10 > rebase= |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
11 > EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
12 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 $ echo a > index.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
14 $ echo x > data.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
15 $ echo z > readme.txt |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
16 $ cat > base.sparse <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 > [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
18 > *.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
19 > EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
20 $ hg ci -Aqm 'initial' |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 $ cat > webpage.sparse <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
22 > %include base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 > [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
24 > *.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
25 > EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 $ hg ci -Aqm 'initial' |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
27 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
28 Clear rules when there are includes |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
29 |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
30 $ hg debugsparse --include *.py |
44724
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33293
diff
changeset
|
31 $ ls -A |
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33293
diff
changeset
|
32 .hg |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
33 data.py |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
34 $ hg debugsparse --clear-rules |
44724
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33293
diff
changeset
|
35 $ ls -A |
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33293
diff
changeset
|
36 .hg |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
37 base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
38 data.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
39 index.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 readme.txt |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
41 webpage.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
42 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
43 Clear rules when there are excludes |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
44 |
48737
a6efb9180764
sparse: rework debugsparse's interface
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
44724
diff
changeset
|
45 $ hg debugsparse -X base.sparse -X webpage.sparse |
44724
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33293
diff
changeset
|
46 $ ls -A |
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33293
diff
changeset
|
47 .hg |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
48 data.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
49 index.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
50 readme.txt |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
51 $ hg debugsparse --clear-rules |
44724
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33293
diff
changeset
|
52 $ ls -A |
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33293
diff
changeset
|
53 .hg |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
54 base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
55 data.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
56 index.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
57 readme.txt |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
58 webpage.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
59 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
60 Clearing rules should not alter profiles |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
61 |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
62 $ hg debugsparse --enable-profile webpage.sparse |
44724
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33293
diff
changeset
|
63 $ ls -A |
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33293
diff
changeset
|
64 .hg |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
65 base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
66 index.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
67 webpage.sparse |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
68 $ hg debugsparse --include *.py |
44724
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33293
diff
changeset
|
69 $ ls -A |
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33293
diff
changeset
|
70 .hg |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
71 base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
72 data.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
73 index.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
74 webpage.sparse |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
75 $ hg debugsparse --clear-rules |
44724
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33293
diff
changeset
|
76 $ ls -A |
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33293
diff
changeset
|
77 .hg |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
78 base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
79 index.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
80 webpage.sparse |