tests/test-convert-hg-sink
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Sat, 01 Sep 2007 02:49:18 -0300
changeset 5279 2dbd750b3ddd
parent 5278 70e9a527cc61
child 5556 61fdf2558c0a
permissions -rwxr-xr-x
convert: clear the dirstate before a conversion, invalidate it afterwards Clearing it before the conversion protects us from whatever data were there (file copies in particular). Invalidating it after the conversion avoids writing a possibly inconsistent dirstate to disk.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5278
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     1
#!/bin/sh
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     2
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     3
echo "[extensions]" >> $HGRCPATH
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     4
echo "hgext.convert=" >> $HGRCPATH
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     5
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     6
hg init orig
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     7
cd orig
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     8
echo foo > foo
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     9
echo bar > bar
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    10
hg ci -qAm 'add foo and bar' -d '0 0'
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    11
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    12
hg rm foo
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    13
hg ci -m 'remove foo' -d '0 0'
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    14
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    15
mkdir foo
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    16
echo file > foo/file
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    17
hg ci -qAm 'add foo/file' -d '0 0'
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    18
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    19
hg tag -d '0 0' some-tag
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    20
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    21
hg log
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    22
cd ..
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    23
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    24
hg convert orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    25
cd new
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    26
hg out ../orig
5279
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    27
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    28
echo '% dirstate should be empty:'
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    29
hg debugstate
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    30
hg parents -q
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    31
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    32
hg up -C
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    33
hg copy bar baz
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    34
echo '% put something in the dirstate:'
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    35
hg debugstate > debugstate
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    36
grep baz debugstate
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    37
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    38
echo '% add a new revision in the original repo'
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    39
cd ../orig
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    40
echo baz > baz
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    41
hg ci -qAm 'add baz'
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    42
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    43
cd ..
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    44
hg convert orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    45
cd new
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    46
hg out ../orig
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    47
echo '% dirstate should be the same (no output below):'
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    48
hg debugstate > new-debugstate
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    49
diff debugstate new-debugstate
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    50
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    51
echo '% no copies'
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    52
hg up -C
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    53
hg debugrename baz