tests/test-qrecord
author Renato Cunha <renatoc@gmail.com>
Tue, 03 Aug 2010 13:41:47 -0300
changeset 11747 40d5633889bb
parent 8167 6c82beaaa11a
permissions -rwxr-xr-x
hgfixes: add a fixer to convert plain strings to bytestrings This patch implements a 2to3 fixer that converts all plain strings in a python source file to byte strings syntax. Example: foo = 'Normal string' would become foo = b'Normal string' The motivation behind this fixer can be found in http://selenic.com/pipermail/mercurial-devel/2010-June/022363.html or, in other words: the current hg source assumes that _most_ strings are "meant" to be byte sequences, so it makes sense to make the convertion implemented by this patch. As mentioned above, not all mercurial modules want to use strings as bytes, examples include i18n (which uses unicode), and demandimport (in py3k, module names are normal strings, thus unicode, and there's no need for a convertion). Therefore, these modules are blacklisted in the fixer. There are also a few functions that can take only unicode arguments, thus the convertion shouldn't be done for those.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5933
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     1
#!/bin/sh
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     2
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     3
echo "[ui]" >> $HGRCPATH
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     4
echo "interactive=true" >> $HGRCPATH
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     5
echo "[extensions]"     >> $HGRCPATH
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     6
echo "record="          >> $HGRCPATH
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     7
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     8
echo "% help (no mq, so no qrecord)"
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
     9
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    10
hg help qrecord
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    11
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    12
echo "mq="              >> $HGRCPATH
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    13
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    14
echo "% help (mq present)"
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    15
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    16
hg help qrecord
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    17
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    18
hg init a
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    19
cd a
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    20
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    21
echo % base commit
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    22
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    23
cat > 1.txt <<EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    24
1
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    25
2
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    26
3
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    27
4
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    28
5
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    29
EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    30
cat > 2.txt <<EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    31
a
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    32
b
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    33
c
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    34
d
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    35
e
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    36
f
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    37
EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    38
mkdir dir
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    39
cat > dir/a.txt <<EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    40
hello world
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    41
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    42
someone
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    43
up
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    44
there
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    45
loves
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    46
me
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    47
EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    48
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    49
hg add 1.txt 2.txt dir/a.txt
8167
6c82beaaa11a tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 6210
diff changeset
    50
hg commit -m 'initial checkin'
5933
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    51
6210
942287cb1f57 Removed trailing spaces from everything except test output
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5933
diff changeset
    52
echo % changing files
5933
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    53
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    54
sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    55
sed -e 's/b/b b/' 2.txt > 2.txt.new
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    56
sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    57
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    58
mv -f 1.txt.new 1.txt
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    59
mv -f 2.txt.new 2.txt
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    60
mv -f dir/a.txt.new dir/a.txt
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    61
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    62
echo % whole diff
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    63
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    64
hg diff --nodates
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    65
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    66
echo % qrecord a.patch
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    67
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    68
hg qrecord -d '0 0' -m aaa a.patch <<EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    69
y
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    70
y
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    71
n
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    72
y
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    73
y
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    74
n
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    75
EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    76
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    77
echo
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    78
echo % "after qrecord a.patch 'tip'"
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    79
hg tip -p
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    80
echo
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    81
echo % "after qrecord a.patch 'diff'"
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    82
hg diff --nodates
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    83
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    84
echo % qrecord b.patch
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    85
hg qrecord -d '0 0' -m bbb b.patch <<EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    86
y
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    87
y
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    88
y
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    89
y
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    90
EOF
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    91
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    92
echo
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    93
echo % "after qrecord b.patch 'tip'"
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    94
hg tip -p
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    95
echo
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    96
echo % "after qrecord b.patch 'diff'"
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    97
hg diff --nodates
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    98
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
    99
echo
28a79c259fcf qrecord: add tests
Kirill Smelkov <kirr@mns.spb.ru>
parents:
diff changeset
   100
echo % --- end ---