Mercurial > hg
changeset 12136:30b5e83004e0
tests: unify test-diff-change
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Mon, 30 Aug 2010 14:38:15 +0200 |
parents | b6cc68ef2702 |
children | e1814ff260c2 |
files | tests/test-diff-change tests/test-diff-change.out tests/test-diff-change.t |
diffstat | 3 files changed, 86 insertions(+), 93 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-diff-change Mon Aug 30 11:16:21 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -#!/bin/sh -e - -# test of hg diff --change - -set -e - -ec() { - echo "invoking $@:" - "$@" -} - -hg init a -cd a - -echo "first" > file.txt -hg add file.txt -hg commit -m 'first commit' # 0 - -echo "second" > file.txt -hg commit -m 'second commit' # 1 - -echo "third" > file.txt -hg commit -m 'third commit' # 2 - -ec hg diff --nodates --change 1 - -echo - -#rev=$(hg log -r 1 --template '{node|short}') -rev=e9b286083166 -ec hg diff --nodates --change "$rev" - -## -# Testing diff -c when merge - -for i in 1 2 3 4 5 6 7 8 9 10; do - echo $i >> file.txt -done -hg commit -m "lots of text" # 3 - -sed -e 's,^2$,x,' file.txt > file.txt.tmp -mv file.txt.tmp file.txt -hg commit -m "changed 2 to x" # 4 - -hg up -r 3 > /dev/null 2>&1 # updated, merged, removed, unresolved -sed -e 's,^8$,y,' file.txt > file.txt.tmp -mv file.txt.tmp file.txt -hg commit -m "change 8 to y" > /dev/null 2>&1 # 5 # created new head - -hg up -C -r 4 > /dev/null 2>&1 # updated, merged, removed, unresolved -hg merge -r 5 > /dev/null 2>&1 # updated, merged, removed, unresolved -hg commit -m "merging 8 to y" # 6 - -echo -ec hg diff --nodates --change 6 # must be similar to hg diff --nodates --change 5 - -#echo -#hg log - -echo -echo "EOF" - -# vim: set ts=4 sw=4 et:
--- a/tests/test-diff-change.out Mon Aug 30 11:16:21 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -invoking hg diff --nodates --change 1: -diff -r 4bb65dda5db4 -r e9b286083166 file.txt ---- a/file.txt -+++ b/file.txt -@@ -1,1 +1,1 @@ --first -+second - -invoking hg diff --nodates --change e9b286083166: -diff -r 4bb65dda5db4 -r e9b286083166 file.txt ---- a/file.txt -+++ b/file.txt -@@ -1,1 +1,1 @@ --first -+second - -invoking hg diff --nodates --change 6: -diff -r e8a0797e73a6 -r aa9873050139 file.txt ---- a/file.txt -+++ b/file.txt -@@ -6,6 +6,6 @@ - 5 - 6 - 7 --8 -+y - 9 - 10 - -EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-diff-change.t Mon Aug 30 14:38:15 2010 +0200 @@ -0,0 +1,86 @@ +Testing diff --change + + $ hg init a + $ cd a + + $ echo "first" > file.txt + $ hg add file.txt + $ hg commit -m 'first commit' # 0 + + $ echo "second" > file.txt + $ hg commit -m 'second commit' # 1 + + $ echo "third" > file.txt + $ hg commit -m 'third commit' # 2 + + $ hg diff --nodates --change 1 + diff -r 4bb65dda5db4 -r e9b286083166 file.txt + --- a/file.txt + +++ b/file.txt + @@ -1,1 +1,1 @@ + -first + +second + + $ hg diff --change e9b286083166 + diff -r 4bb65dda5db4 -r e9b286083166 file.txt + --- a/file.txt Thu Jan 01 00:00:00 1970 +0000 + +++ b/file.txt Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,1 @@ + -first + +second + + +Testing diff --change when merge: + + $ for i in 1 2 3 4 5 6 7 8 9 10; do + $ echo $i >> file.txt + $ done + $ hg commit -m "lots of text" # 3 + + $ sed -e 's,^2$,x,' file.txt > file.txt.tmp + $ mv file.txt.tmp file.txt + $ hg commit -m "change 2 to x" # 4 + + $ hg up -r 3 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ sed -e 's,^8$,y,' file.txt > file.txt.tmp + $ mv file.txt.tmp file.txt + $ hg commit -m "change 8 to y" + created new head + + $ hg up -C -r 4 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg merge -r 5 + merging file.txt + 0 files updated, 1 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + $ hg commit -m "merge 8 to y" # 6 + + $ hg diff --change 5 + diff -r ae119d680c82 -r 9085c5c02e52 file.txt + --- a/file.txt Thu Jan 01 00:00:00 1970 +0000 + +++ b/file.txt Thu Jan 01 00:00:00 1970 +0000 + @@ -6,6 +6,6 @@ + 5 + 6 + 7 + -8 + +y + 9 + 10 + +must be similar to 'hg diff --change 5': + + $ hg diff -c 6 + diff -r 273b50f17c6d -r 979ca961fd2e file.txt + --- a/file.txt Thu Jan 01 00:00:00 1970 +0000 + +++ b/file.txt Thu Jan 01 00:00:00 1970 +0000 + @@ -6,6 +6,6 @@ + 5 + 6 + 7 + -8 + +y + 9 + 10 +