comparison tests/test-diff-change.t @ 12136:30b5e83004e0

tests: unify test-diff-change
author Adrian Buehlmann <adrian@cadifra.com>
date Mon, 30 Aug 2010 14:38:15 +0200
parents tests/test-diff-change@89c2b78faec4
children 4fe874697a4d
comparison
equal deleted inserted replaced
12135:b6cc68ef2702 12136:30b5e83004e0
1 Testing diff --change
2
3 $ hg init a
4 $ cd a
5
6 $ echo "first" > file.txt
7 $ hg add file.txt
8 $ hg commit -m 'first commit' # 0
9
10 $ echo "second" > file.txt
11 $ hg commit -m 'second commit' # 1
12
13 $ echo "third" > file.txt
14 $ hg commit -m 'third commit' # 2
15
16 $ hg diff --nodates --change 1
17 diff -r 4bb65dda5db4 -r e9b286083166 file.txt
18 --- a/file.txt
19 +++ b/file.txt
20 @@ -1,1 +1,1 @@
21 -first
22 +second
23
24 $ hg diff --change e9b286083166
25 diff -r 4bb65dda5db4 -r e9b286083166 file.txt
26 --- a/file.txt Thu Jan 01 00:00:00 1970 +0000
27 +++ b/file.txt Thu Jan 01 00:00:00 1970 +0000
28 @@ -1,1 +1,1 @@
29 -first
30 +second
31
32
33 Testing diff --change when merge:
34
35 $ for i in 1 2 3 4 5 6 7 8 9 10; do
36 $ echo $i >> file.txt
37 $ done
38 $ hg commit -m "lots of text" # 3
39
40 $ sed -e 's,^2$,x,' file.txt > file.txt.tmp
41 $ mv file.txt.tmp file.txt
42 $ hg commit -m "change 2 to x" # 4
43
44 $ hg up -r 3
45 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 $ sed -e 's,^8$,y,' file.txt > file.txt.tmp
47 $ mv file.txt.tmp file.txt
48 $ hg commit -m "change 8 to y"
49 created new head
50
51 $ hg up -C -r 4
52 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
53 $ hg merge -r 5
54 merging file.txt
55 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
56 (branch merge, don't forget to commit)
57 $ hg commit -m "merge 8 to y" # 6
58
59 $ hg diff --change 5
60 diff -r ae119d680c82 -r 9085c5c02e52 file.txt
61 --- a/file.txt Thu Jan 01 00:00:00 1970 +0000
62 +++ b/file.txt Thu Jan 01 00:00:00 1970 +0000
63 @@ -6,6 +6,6 @@
64 5
65 6
66 7
67 -8
68 +y
69 9
70 10
71
72 must be similar to 'hg diff --change 5':
73
74 $ hg diff -c 6
75 diff -r 273b50f17c6d -r 979ca961fd2e file.txt
76 --- a/file.txt Thu Jan 01 00:00:00 1970 +0000
77 +++ b/file.txt Thu Jan 01 00:00:00 1970 +0000
78 @@ -6,6 +6,6 @@
79 5
80 6
81 7
82 -8
83 +y
84 9
85 10
86