Mercurial > hg > mercurial-crew-with-dirclash
annotate tests/test-encoding @ 5210:90d9ec0dc69d
merge: forcefully mark files that we get from the second parent as dirty
After a hg merge, we want to include in the commit all the files that we
got from the second parent, so that we have the correct file-level
history. To make them visible to hg commit, we try to mark them as dirty.
Unfortunately, right now we can't really mark them as dirty[1] - the
best we can do is to mark them as needing a full comparison of their
contents, but they will still be considered clean if they happen to be
identical to the version in the first parent.
This changeset extends the dirstate format in a compatible way, so that
we can mark a file as dirty:
Right now we use a negative file size to indicate we don't have valid
stat data for this entry. In practice, this size is always -1.
This patch uses -2 to indicate that the entry is dirty. Older versions
of hg won't choke on this dirstate, but they may happily mark the file
as clean after a full comparison, destroying all of our hard work.
The patch adds a dirstate.normallookup method with the semantics of the
current normaldirty, and changes normaldirty to forcefully mark the
entry as dirty.
This should fix issue522.
[1] - well, we could put them in state 'm', but that state has a
different meaning.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Thu, 23 Aug 2007 01:48:29 -0300 |
parents | 46abbed02b2d |
children |
rev | line source |
---|---|
3778
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
1 #!/bin/sh |
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
2 |
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
3 hg init t |
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
4 cd t |
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
5 |
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
6 # we need a repo with some legacy latin-1 changesets |
3781
d0a48313b0f6
test-encoding: copy a bundle from TESTDIR rather than constructing one
Matt Mackall <mpm@selenic.com>
parents:
3780
diff
changeset
|
7 hg unbundle $TESTDIR/legacy-encoding.hg |
3778
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
8 hg co |
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
9 |
3789
734b1d6ba3dc
Use python instead of shell printf with \x sequences for test-encoding.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3784
diff
changeset
|
10 python << EOF |
734b1d6ba3dc
Use python instead of shell printf with \x sequences for test-encoding.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3784
diff
changeset
|
11 f = file('latin-1', 'w'); f.write("latin-1 e' encoded: \xe9"); f.close() |
734b1d6ba3dc
Use python instead of shell printf with \x sequences for test-encoding.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3784
diff
changeset
|
12 f = file('utf-8', 'w'); f.write("utf-8 e' encoded: \xc3\xa9"); f.close() |
734b1d6ba3dc
Use python instead of shell printf with \x sequences for test-encoding.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3784
diff
changeset
|
13 f = file('latin-1-tag', 'w'); f.write("\xe9"); f.close() |
734b1d6ba3dc
Use python instead of shell printf with \x sequences for test-encoding.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3784
diff
changeset
|
14 EOF |
3784
4421cef5d3f0
Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents:
3781
diff
changeset
|
15 |
3778
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
16 echo % should fail with encoding error |
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
17 echo "plain old ascii" > a |
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
18 hg st |
3839
3820385fb113
Fixes test-encoding for python2.3 and minor cleanups:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3835
diff
changeset
|
19 HGENCODING=ascii hg ci -l latin-1 -d "1000000 0" |
3778
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
20 |
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
21 echo % these should work |
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
22 echo "latin-1" > a |
3839
3820385fb113
Fixes test-encoding for python2.3 and minor cleanups:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3835
diff
changeset
|
23 HGENCODING=latin-1 hg ci -l latin-1 -d "1000000 0" |
3778
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
24 echo "utf-8" > a |
3839
3820385fb113
Fixes test-encoding for python2.3 and minor cleanups:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3835
diff
changeset
|
25 HGENCODING=utf-8 hg ci -l utf-8 -d "1000000 0" |
3778
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
26 |
3839
3820385fb113
Fixes test-encoding for python2.3 and minor cleanups:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3835
diff
changeset
|
27 HGENCODING=latin-1 hg tag -d "1000000 0" `cat latin-1-tag` |
3862
46abbed02b2d
Use UTF-8 in .hg/branch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3845
diff
changeset
|
28 HGENCODING=latin-1 hg branch `cat latin-1-tag` |
3839
3820385fb113
Fixes test-encoding for python2.3 and minor cleanups:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3835
diff
changeset
|
29 HGENCODING=latin-1 hg ci -d "1000000 0" -m 'latin1 branch' |
3824
3674ca805a5b
log: convert branch names to the local encoding
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3789
diff
changeset
|
30 rm .hg/branch |
3778
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
31 |
3784
4421cef5d3f0
Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents:
3781
diff
changeset
|
32 echo % ascii |
3778
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
33 hg --encoding ascii log |
3784
4421cef5d3f0
Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents:
3781
diff
changeset
|
34 echo % latin-1 |
3778
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
35 hg --encoding latin-1 log |
3784
4421cef5d3f0
Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents:
3781
diff
changeset
|
36 echo % utf-8 |
3778
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
37 hg --encoding utf-8 log |
3784
4421cef5d3f0
Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents:
3781
diff
changeset
|
38 echo % ascii |
3778
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
39 HGENCODING=ascii hg tags |
3784
4421cef5d3f0
Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents:
3781
diff
changeset
|
40 echo % latin-1 |
3778
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
41 HGENCODING=latin-1 hg tags |
3784
4421cef5d3f0
Make quoting in test-encoding simpler
Matt Mackall <mpm@selenic.com>
parents:
3781
diff
changeset
|
42 echo % utf-8 |
3778
5da370c2f72d
Add a charset encoding test case
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
43 HGENCODING=utf-8 hg tags |
3824
3674ca805a5b
log: convert branch names to the local encoding
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3789
diff
changeset
|
44 echo % ascii |
3674ca805a5b
log: convert branch names to the local encoding
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3789
diff
changeset
|
45 HGENCODING=ascii hg branches |
3674ca805a5b
log: convert branch names to the local encoding
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3789
diff
changeset
|
46 echo % latin-1 |
3674ca805a5b
log: convert branch names to the local encoding
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3789
diff
changeset
|
47 HGENCODING=latin-1 hg branches |
3674ca805a5b
log: convert branch names to the local encoding
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3789
diff
changeset
|
48 echo % utf-8 |
3674ca805a5b
log: convert branch names to the local encoding
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3789
diff
changeset
|
49 HGENCODING=utf-8 hg branches |
3835
d1ce5461beed
Allow the user to specify the fallback encoding for the changelog
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3824
diff
changeset
|
50 |
d1ce5461beed
Allow the user to specify the fallback encoding for the changelog
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3824
diff
changeset
|
51 echo '[ui]' >> .hg/hgrc |
3839
3820385fb113
Fixes test-encoding for python2.3 and minor cleanups:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3835
diff
changeset
|
52 echo 'fallbackencoding = koi8-r' >> .hg/hgrc |
3835
d1ce5461beed
Allow the user to specify the fallback encoding for the changelog
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3824
diff
changeset
|
53 echo % utf-8 |
d1ce5461beed
Allow the user to specify the fallback encoding for the changelog
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3824
diff
changeset
|
54 HGENCODING=utf-8 hg log |
3843
abaa2cd00d2b
make transcoding more robust
Matt Mackall <mpm@selenic.com>
parents:
3839
diff
changeset
|
55 |
3845
8958417abf62
Make test-encoding return 0
Matt Mackall <mpm@selenic.com>
parents:
3843
diff
changeset
|
56 HGENCODING=dolphin hg log |
8958417abf62
Make test-encoding return 0
Matt Mackall <mpm@selenic.com>
parents:
3843
diff
changeset
|
57 |
3862
46abbed02b2d
Use UTF-8 in .hg/branch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3845
diff
changeset
|
58 HGENCODING=ascii hg branch `cat latin-1-tag` |
46abbed02b2d
Use UTF-8 in .hg/branch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3845
diff
changeset
|
59 cp latin-1-tag .hg/branch |
46abbed02b2d
Use UTF-8 in .hg/branch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3845
diff
changeset
|
60 HGENCODING=latin-1 hg ci -d "1000000 0" -m 'should fail' |
3845
8958417abf62
Make test-encoding return 0
Matt Mackall <mpm@selenic.com>
parents:
3843
diff
changeset
|
61 exit 0 |