tests/test-mq-qdiff
author Renato Cunha <renatoc@gmail.com>
Tue, 03 Aug 2010 13:52:48 -0300
changeset 11748 37a70a784397
parent 11049 a84f14228b1d
permissions -rwxr-xr-x
py3kcompat: added a "compatibility layer" for py3k This patch adds some ugly constructs. The first of them is bytesformatter, a function that formats strings like when '%' is called. The main motivation for this function is py3k's strange behavior: >>> 'foo %s' % b'bar' "foo b'bar'" >>> b'foo %s' % b'bar' Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for %: 'bytes' and 'bytes' >>> b'foo %s' % 'bar' Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for %: 'bytes' and 'str' In other words, if we can't format bytes with bytes, and recall that all mercurial strings will be converted by a fixer, then things will break badly if we don't take a similar approach. The other addition with this patch is that the os.environ dictionary is monkeypatched to have bytes items. Hopefully this won't be needed in the future, as python 3.2 might get a os.environb dictionary that holds bytes items.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2916
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     1
#!/bin/sh
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     2
2990
61fcd9fac434 Make tests append settings to $HGRCPATH instead of $HGTMP/.hgrc
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2917
diff changeset
     3
echo "[extensions]" >> $HGRCPATH
61fcd9fac434 Make tests append settings to $HGRCPATH instead of $HGTMP/.hgrc
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2917
diff changeset
     4
echo "mq=" >> $HGRCPATH
10191
99d285ac5da4 mq: qdiff with the same diff options than qrefresh (issue1350)
Patrick Mezard <pmezard@gmail.com>
parents: 9857
diff changeset
     5
echo "[mq]" >> $HGRCPATH
99d285ac5da4 mq: qdiff with the same diff options than qrefresh (issue1350)
Patrick Mezard <pmezard@gmail.com>
parents: 9857
diff changeset
     6
echo "git=keep" >> $HGRCPATH
2916
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     7
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     8
echo % init
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     9
hg init a
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    10
cd a
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    11
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    12
echo % commit
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    13
echo 'base' > base
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    14
hg ci -Ambase -d '1 0'
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    15
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    16
echo % qnew mqbase
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    17
hg qnew -mmqbase mqbase
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    18
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    19
echo % qrefresh
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    20
echo 'patched' > base
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    21
hg qrefresh
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    22
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    23
echo % qdiff
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    24
hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    25
               -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    26
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    27
echo % qdiff dirname
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    28
hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
8ca608c1eb02 tests: new test for mq qdiff command
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    29
                 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
6668
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    30
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    31
echo % qdiff filename
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    32
hg qdiff --nodates base
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    33
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    34
echo % revert
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    35
hg revert -a
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    36
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    37
echo % qpop
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    38
hg qpop
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    39
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    40
echo % qdelete mqbase
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    41
hg qdelete mqbase
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    42
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    43
echo % commit 2
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    44
printf '1\n2\n3\n4\nhello world\ngoodbye world\n7\n8\n9\n' > lines
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    45
hg ci -Amlines -d '2 0'
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    46
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    47
echo % qnew 2
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    48
hg qnew -mmqbase2 mqbase2
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    49
printf '\n\n1\n2\n3\n4\nhello  world\n     goodbye world\n7\n8\n9\n' > lines
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    50
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    51
echo % qdiff -U 1
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    52
hg qdiff --nodates -U 1
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    53
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    54
echo % qdiff -b
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    55
hg qdiff --nodates -b
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    56
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    57
echo % qdiff -U 1 -B
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    58
hg qdiff --nodates -U 1 -B
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    59
9725
3f522d2fa633 diff: add --inverse option
Yannick Gingras <ygingras@ygingras.net>
parents: 6668
diff changeset
    60
echo % qdiff -w
6668
034f444902d9 mq: qdiff: support all diffopts
Jason Orendorff <jorendorff@mozilla.com>
parents: 2990
diff changeset
    61
hg qdiff --nodates -w
9725
3f522d2fa633 diff: add --inverse option
Yannick Gingras <ygingras@ygingras.net>
parents: 6668
diff changeset
    62
9857
24bc6e414610 diff: change --inverse to --reverse
Martin Geisler <mg@lazybytes.net>
parents: 9725
diff changeset
    63
echo % qdiff --reverse
24bc6e414610 diff: change --inverse to --reverse
Martin Geisler <mg@lazybytes.net>
parents: 9725
diff changeset
    64
hg qdiff --nodates --reverse
10191
99d285ac5da4 mq: qdiff with the same diff options than qrefresh (issue1350)
Patrick Mezard <pmezard@gmail.com>
parents: 9857
diff changeset
    65
99d285ac5da4 mq: qdiff with the same diff options than qrefresh (issue1350)
Patrick Mezard <pmezard@gmail.com>
parents: 9857
diff changeset
    66
echo % qdiff preserve existing git flag
99d285ac5da4 mq: qdiff with the same diff options than qrefresh (issue1350)
Patrick Mezard <pmezard@gmail.com>
parents: 9857
diff changeset
    67
hg qrefresh --git
99d285ac5da4 mq: qdiff with the same diff options than qrefresh (issue1350)
Patrick Mezard <pmezard@gmail.com>
parents: 9857
diff changeset
    68
echo a >> lines
99d285ac5da4 mq: qdiff with the same diff options than qrefresh (issue1350)
Patrick Mezard <pmezard@gmail.com>
parents: 9857
diff changeset
    69
hg qdiff
99d285ac5da4 mq: qdiff with the same diff options than qrefresh (issue1350)
Patrick Mezard <pmezard@gmail.com>
parents: 9857
diff changeset
    70
11049
a84f14228b1d mq: fix opts['unified'] = '0' to take effect when qdiff --stat
Yuya Nishihara <yuya@tcha.org>
parents: 10191
diff changeset
    71
echo % qdiff --stat
a84f14228b1d mq: fix opts['unified'] = '0' to take effect when qdiff --stat
Yuya Nishihara <yuya@tcha.org>
parents: 10191
diff changeset
    72
hg qdiff --stat