Mercurial > hg-stable
changeset 12095:80b0865b3fa5
tests: unify test-churn
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Mon, 30 Aug 2010 12:41:43 +0900 |
parents | 1db76910f9b4 |
children | bb69460e9d2d |
files | tests/test-bisect.t tests/test-churn tests/test-churn.out tests/test-churn.t |
diffstat | 3 files changed, 141 insertions(+), 133 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-churn Mon Aug 30 12:02:31 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -#!/bin/sh - -echo "[extensions]" >> $HGRCPATH -echo "churn=" >> $HGRCPATH - -echo % create test repository -hg init repo -cd repo -echo a > a -hg ci -Am adda -u user1 -d 6:00 -echo b >> a -echo b > b -hg ci -m changeba -u user2 -d 9:00 a -hg ci -Am addb -u user2 -d 9:30 -echo c >> a -echo c >> b -echo c > c -hg ci -m changeca -u user3 -d 12:00 a -hg ci -m changecb -u user3 -d 12:15 b -hg ci -Am addc -u user3 -d 12:30 -mkdir -p d/e -echo abc > d/e/f1.txt -hg ci -Am "add d/e/f1.txt" -u user1 -d 12:45 d/e/f1.txt -mkdir -p d/g -echo def > d/g/f2.txt -hg ci -Am "add d/g/f2.txt" -u user1 -d 13:00 d/g/f2.txt - -echo % churn separate directories -cd d -hg churn e -echo % churn all -hg churn -echo % churn excluding one dir -hg churn -X e -echo % churn up to rev 2 -hg churn -r :2 -cd .. -echo % churn with aliases -cat > ../aliases <<EOF -user1 alias1 - -user3 alias3 -not-an-alias -EOF -hg churn --aliases ../aliases -echo % churn with .hgchurn -mv ../aliases .hgchurn -hg churn -rm .hgchurn -echo % churn with column specifier -COLUMNS=40 hg churn -echo % churn by hour -hg churn -f '%H' -s - -echo % churn with separated added/removed lines -hg rm d/g/f2.txt -hg ci -Am "removed d/g/f2.txt" -u user1 -d 14:00 d/g/f2.txt -hg churn --diffstat -echo % churn --diffstat with color -hg --config extensions.color= churn --config color.mode=ansi \ - --diffstat --color=always - -echo % changeset number churn -hg churn -c - -echo 'with space = no-space' >> ../aliases -echo a >> a -hg commit -m a -u 'with space' -d 15:00 -echo % churn with space in alias -hg churn --aliases ../aliases -r tip - -cd .. - -# issue 833: ZeroDivisionError -hg init issue-833 -cd issue-833 -touch foo -hg ci -Am foo -# this was failing with a ZeroDivisionError -hg churn -cd ..
--- a/tests/test-churn.out Mon Aug 30 12:02:31 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -% create test repository -adding a -adding b -adding c -% churn separate directories -user1 1 *************************************************************** -% churn all -user3 3 *************************************************************** -user1 3 *************************************************************** -user2 2 ****************************************** -% churn excluding one dir -user3 3 *************************************************************** -user2 2 ****************************************** -user1 2 ****************************************** -% churn up to rev 2 -user2 2 *************************************************************** -user1 1 ******************************** -% churn with aliases -skipping malformed alias: not-an-alias -alias3 3 ************************************************************** -alias1 3 ************************************************************** -user2 2 ***************************************** -% churn with .hgchurn -skipping malformed alias: not-an-alias -alias3 3 ************************************************************** -alias1 3 ************************************************************** -user2 2 ***************************************** -% churn with column specifier -user3 3 *********************** -user1 3 *********************** -user2 2 *************** -% churn by hour -06 1 ***************** -09 2 ********************************* -12 4 ****************************************************************** -13 1 ***************** -% churn with separated added/removed lines -user1 +3/-1 +++++++++++++++++++++++++++++++++++++++++-------------- -user3 +3/-0 +++++++++++++++++++++++++++++++++++++++++ -user2 +2/-0 +++++++++++++++++++++++++++ -% churn --diffstat with color -user1 +3/-1 [0;32m+++++++++++++++++++++++++++++++++++++++++[0m[0;31m--------------[0m -user3 +3/-0 [0;32m+++++++++++++++++++++++++++++++++++++++++[0m -user2 +2/-0 [0;32m+++++++++++++++++++++++++++[0m -% changeset number churn -user1 4 *************************************************************** -user3 3 *********************************************** -user2 2 ******************************** -% churn with space in alias -no-space 1 ************************************************************ -adding foo -test 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-churn.t Mon Aug 30 12:41:43 2010 +0900 @@ -0,0 +1,141 @@ + $ echo "[extensions]" >> $HGRCPATH + $ echo "churn=" >> $HGRCPATH + +create test repository + + $ hg init repo + $ cd repo + $ echo a > a + $ hg ci -Am adda -u user1 -d 6:00 + adding a + $ echo b >> a + $ echo b > b + $ hg ci -m changeba -u user2 -d 9:00 a + $ hg ci -Am addb -u user2 -d 9:30 + adding b + $ echo c >> a + $ echo c >> b + $ echo c > c + $ hg ci -m changeca -u user3 -d 12:00 a + $ hg ci -m changecb -u user3 -d 12:15 b + $ hg ci -Am addc -u user3 -d 12:30 + adding c + $ mkdir -p d/e + $ echo abc > d/e/f1.txt + $ hg ci -Am "add d/e/f1.txt" -u user1 -d 12:45 d/e/f1.txt + $ mkdir -p d/g + $ echo def > d/g/f2.txt + $ hg ci -Am "add d/g/f2.txt" -u user1 -d 13:00 d/g/f2.txt + + +churn separate directories + + $ cd d + $ hg churn e + user1 1 *************************************************************** + +churn all + + $ hg churn + user3 3 *************************************************************** + user1 3 *************************************************************** + user2 2 ****************************************** + +churn excluding one dir + + $ hg churn -X e + user3 3 *************************************************************** + user2 2 ****************************************** + user1 2 ****************************************** + +churn up to rev 2 + + $ hg churn -r :2 + user2 2 *************************************************************** + user1 1 ******************************** + $ cd .. + +churn with aliases + + $ cat > ../aliases <<EOF + > user1 alias1 + > user3 alias3 + > not-an-alias + > EOF + +churn with .hgchurn + + $ mv ../aliases .hgchurn + $ hg churn + skipping malformed alias: not-an-alias + alias3 3 ************************************************************** + alias1 3 ************************************************************** + user2 2 ***************************************** + $ rm .hgchurn + +churn with column specifier + + $ COLUMNS=40 hg churn + user3 3 *********************** + user1 3 *********************** + user2 2 *************** + +churn by hour + + $ hg churn -f '%H' -s + 06 1 ***************** + 09 2 ********************************* + 12 4 ****************************************************************** + 13 1 ***************** + + +churn with separated added/removed lines + + $ hg rm d/g/f2.txt + $ hg ci -Am "removed d/g/f2.txt" -u user1 -d 14:00 d/g/f2.txt + $ hg churn --diffstat + user1 +3/-1 +++++++++++++++++++++++++++++++++++++++++-------------- + user3 +3/-0 +++++++++++++++++++++++++++++++++++++++++ + user2 +2/-0 +++++++++++++++++++++++++++ + +churn --diffstat with color + + $ hg --config extensions.color= churn --config color.mode=ansi \ + > --diffstat --color=always + user1 +3/-1 [0;32m+++++++++++++++++++++++++++++++++++++++++[0m[0;31m--------------[0m + user3 +3/-0 [0;32m+++++++++++++++++++++++++++++++++++++++++[0m + user2 +2/-0 [0;32m+++++++++++++++++++++++++++[0m + + +changeset number churn + + $ hg churn -c + user1 4 *************************************************************** + user3 3 *********************************************** + user2 2 ******************************** + + $ echo 'with space = no-space' >> ../aliases + $ echo a >> a + $ hg commit -m a -u 'with space' -d 15:00 + +churn with space in alias + + $ hg churn --aliases ../aliases -r tip + no-space 1 ************************************************************ + + $ cd .. + + +issue 833: ZeroDivisionError + + $ hg init issue-833 + $ cd issue-833 + $ touch foo + $ hg ci -Am foo + adding foo + +this was failing with a ZeroDivisionError + + $ hg churn + test 0 + $ cd ..