##// END OF EJS Templates
tests: unify test-diff-change
Adrian Buehlmann -
r12136:30b5e830 default
parent child Browse files
Show More
@@ -1,63 +1,86 b''
1 #!/bin/sh -e
1 Testing diff --change
2
2
3 # test of hg diff --change
3 $ hg init a
4
4 $ cd a
5 set -e
6
5
7 ec() {
6 $ echo "first" > file.txt
8 echo "invoking $@:"
7 $ hg add file.txt
9 "$@"
8 $ hg commit -m 'first commit' # 0
10 }
11
9
12 hg init a
10 $ echo "second" > file.txt
13 cd a
11 $ hg commit -m 'second commit' # 1
12
13 $ echo "third" > file.txt
14 $ hg commit -m 'third commit' # 2
14
15
15 echo "first" > file.txt
16 $ hg diff --nodates --change 1
16 hg add file.txt
17 diff -r 4bb65dda5db4 -r e9b286083166 file.txt
17 hg commit -m 'first commit' # 0
18 --- a/file.txt
18
19 +++ b/file.txt
19 echo "second" > file.txt
20 @@ -1,1 +1,1 @@
20 hg commit -m 'second commit' # 1
21 -first
22 +second
21
23
22 echo "third" > file.txt
24 $ hg diff --change e9b286083166
23 hg commit -m 'third commit' # 2
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
24
31
25 ec hg diff --nodates --change 1
26
32
27 echo
33 Testing diff --change when merge:
28
34
29 #rev=$(hg log -r 1 --template '{node|short}')
35 $ for i in 1 2 3 4 5 6 7 8 9 10; do
30 rev=e9b286083166
36 $ echo $i >> file.txt
31 ec hg diff --nodates --change "$rev"
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
32
43
33 ##
44 $ hg up -r 3
34 # Testing diff -c when merge
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
35
50
36 for i in 1 2 3 4 5 6 7 8 9 10; do
51 $ hg up -C -r 4
37 echo $i >> file.txt
52 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 done
53 $ hg merge -r 5
39 hg commit -m "lots of text" # 3
54 merging file.txt
40
55 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
41 sed -e 's,^2$,x,' file.txt > file.txt.tmp
56 (branch merge, don't forget to commit)
42 mv file.txt.tmp file.txt
57 $ hg commit -m "merge 8 to y" # 6
43 hg commit -m "changed 2 to x" # 4
44
58
45 hg up -r 3 > /dev/null 2>&1 # updated, merged, removed, unresolved
59 $ hg diff --change 5
46 sed -e 's,^8$,y,' file.txt > file.txt.tmp
60 diff -r ae119d680c82 -r 9085c5c02e52 file.txt
47 mv file.txt.tmp file.txt
61 --- a/file.txt Thu Jan 01 00:00:00 1970 +0000
48 hg commit -m "change 8 to y" > /dev/null 2>&1 # 5 # created new head
62 +++ b/file.txt Thu Jan 01 00:00:00 1970 +0000
49
63 @@ -6,6 +6,6 @@
50 hg up -C -r 4 > /dev/null 2>&1 # updated, merged, removed, unresolved
64 5
51 hg merge -r 5 > /dev/null 2>&1 # updated, merged, removed, unresolved
65 6
52 hg commit -m "merging 8 to y" # 6
66 7
67 -8
68 +y
69 9
70 10
53
71
54 echo
72 must be similar to 'hg diff --change 5':
55 ec hg diff --nodates --change 6 # must be similar to hg diff --nodates --change 5
56
73
57 #echo
74 $ hg diff -c 6
58 #hg log
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
59
86
60 echo
61 echo "EOF"
62
63 # vim: set ts=4 sw=4 et:
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now