##// END OF EJS Templates
test for git empty new files
Brendan Cully -
r3589:1c9b6f12 default
parent child Browse files
Show More
@@ -1,122 +1,129
1 #!/bin/sh
1 #!/bin/sh
2
2
3 hg init a
3 hg init a
4 cd a
4 cd a
5
5
6 echo % new file
6 echo % new file
7 hg import -mnew - <<EOF
7 hg import -mnew - <<EOF
8 diff --git a/new b/new
8 diff --git a/new b/new
9 new file mode 100644
9 new file mode 100644
10 index 0000000..7898192
10 index 0000000..7898192
11 --- /dev/null
11 --- /dev/null
12 +++ b/new
12 +++ b/new
13 @@ -0,0 +1 @@
13 @@ -0,0 +1 @@
14 +a
14 +a
15 EOF
15 EOF
16
16
17 echo % new empty file
18 hg import -mempty - <<EOF
19 diff --git a/empty b/empty
20 new file mode 100644
21 EOF
22 hg locate empty
23
17 echo % chmod +x
24 echo % chmod +x
18 hg import -msetx - <<EOF
25 hg import -msetx - <<EOF
19 diff --git a/new b/new
26 diff --git a/new b/new
20 old mode 100644
27 old mode 100644
21 new mode 100755
28 new mode 100755
22 EOF
29 EOF
23
30
24 test -x new || echo failed
31 test -x new || echo failed
25
32
26 echo % copy
33 echo % copy
27 hg import -mcopy - <<EOF
34 hg import -mcopy - <<EOF
28 diff --git a/new b/copy
35 diff --git a/new b/copy
29 old mode 100755
36 old mode 100755
30 new mode 100644
37 new mode 100644
31 similarity index 100%
38 similarity index 100%
32 copy from new
39 copy from new
33 copy to copy
40 copy to copy
34 diff --git a/new b/copyx
41 diff --git a/new b/copyx
35 similarity index 100%
42 similarity index 100%
36 copy from new
43 copy from new
37 copy to copyx
44 copy to copyx
38 EOF
45 EOF
39
46
40 test -f copy -a ! -x copy || echo failed
47 test -f copy -a ! -x copy || echo failed
41 test -x copyx || echo failed
48 test -x copyx || echo failed
42 cat copy
49 cat copy
43 hg cat copy
50 hg cat copy
44
51
45 echo % rename
52 echo % rename
46 hg import -mrename - <<EOF
53 hg import -mrename - <<EOF
47 diff --git a/copy b/rename
54 diff --git a/copy b/rename
48 similarity index 100%
55 similarity index 100%
49 rename from copy
56 rename from copy
50 rename to rename
57 rename to rename
51 EOF
58 EOF
52
59
53 hg locate
60 hg locate
54
61
55 echo % delete
62 echo % delete
56 hg import -mdelete - <<EOF
63 hg import -mdelete - <<EOF
57 diff --git a/copyx b/copyx
64 diff --git a/copyx b/copyx
58 deleted file mode 100755
65 deleted file mode 100755
59 index 7898192..0000000
66 index 7898192..0000000
60 --- a/copyx
67 --- a/copyx
61 +++ /dev/null
68 +++ /dev/null
62 @@ -1 +0,0 @@
69 @@ -1 +0,0 @@
63 -a
70 -a
64 EOF
71 EOF
65
72
66 hg locate
73 hg locate
67 test -f copyx && echo failed || true
74 test -f copyx && echo failed || true
68
75
69 echo % regular diff
76 echo % regular diff
70 hg import -mregular - <<EOF
77 hg import -mregular - <<EOF
71 diff --git a/rename b/rename
78 diff --git a/rename b/rename
72 index 7898192..72e1fe3 100644
79 index 7898192..72e1fe3 100644
73 --- a/rename
80 --- a/rename
74 +++ b/rename
81 +++ b/rename
75 @@ -1 +1,5 @@
82 @@ -1 +1,5 @@
76 a
83 a
77 +a
84 +a
78 +a
85 +a
79 +a
86 +a
80 +a
87 +a
81 EOF
88 EOF
82
89
83 echo % copy and modify
90 echo % copy and modify
84 hg import -mcopymod - <<EOF
91 hg import -mcopymod - <<EOF
85 diff --git a/rename b/copy2
92 diff --git a/rename b/copy2
86 similarity index 80%
93 similarity index 80%
87 copy from rename
94 copy from rename
88 copy to copy2
95 copy to copy2
89 index 72e1fe3..b53c148 100644
96 index 72e1fe3..b53c148 100644
90 --- a/rename
97 --- a/rename
91 +++ b/copy2
98 +++ b/copy2
92 @@ -1,5 +1,5 @@
99 @@ -1,5 +1,5 @@
93 a
100 a
94 a
101 a
95 -a
102 -a
96 +b
103 +b
97 a
104 a
98 a
105 a
99 EOF
106 EOF
100
107
101 hg cat copy2
108 hg cat copy2
102
109
103 echo % rename and modify
110 echo % rename and modify
104 hg import -mrenamemod - <<EOF
111 hg import -mrenamemod - <<EOF
105 diff --git a/copy2 b/rename2
112 diff --git a/copy2 b/rename2
106 similarity index 80%
113 similarity index 80%
107 rename from copy2
114 rename from copy2
108 rename to rename2
115 rename to rename2
109 index b53c148..8f81e29 100644
116 index b53c148..8f81e29 100644
110 --- a/copy2
117 --- a/copy2
111 +++ b/rename2
118 +++ b/rename2
112 @@ -1,5 +1,5 @@
119 @@ -1,5 +1,5 @@
113 a
120 a
114 a
121 a
115 b
122 b
116 -a
123 -a
117 +c
124 +c
118 a
125 a
119 EOF
126 EOF
120
127
121 hg locate copy2
128 hg locate copy2
122 hg cat rename2
129 hg cat rename2
@@ -1,34 +1,39
1 % new file
1 % new file
2 applying patch from stdin
2 applying patch from stdin
3 % new empty file
4 applying patch from stdin
5 empty
3 % chmod +x
6 % chmod +x
4 applying patch from stdin
7 applying patch from stdin
5 % copy
8 % copy
6 applying patch from stdin
9 applying patch from stdin
7 a
10 a
8 a
11 a
9 % rename
12 % rename
10 applying patch from stdin
13 applying patch from stdin
11 copyx
14 copyx
15 empty
12 new
16 new
13 rename
17 rename
14 % delete
18 % delete
15 applying patch from stdin
19 applying patch from stdin
20 empty
16 new
21 new
17 rename
22 rename
18 % regular diff
23 % regular diff
19 applying patch from stdin
24 applying patch from stdin
20 % copy and modify
25 % copy and modify
21 applying patch from stdin
26 applying patch from stdin
22 a
27 a
23 a
28 a
24 b
29 b
25 a
30 a
26 a
31 a
27 % rename and modify
32 % rename and modify
28 applying patch from stdin
33 applying patch from stdin
29 copy2: No such file or directory
34 copy2: No such file or directory
30 a
35 a
31 a
36 a
32 b
37 b
33 c
38 c
34 a
39 a
General Comments 0
You need to be logged in to leave comments. Login now