author | Matt Mackall <mpm@selenic.com> |
Sat, 23 May 2009 12:31:28 -0500 | |
changeset 8560 | 107af208ed0b |
parent 5403 | 477136fa6571 |
child 10060 | f780b1098efc |
permissions | -rwxr-xr-x |
2864 | 1 |
#!/bin/sh |
2 |
||
3 |
hg init a |
|
4 |
cd a |
|
5 |
||
6 |
echo % new file |
|
7 |
hg import -mnew - <<EOF |
|
8 |
diff --git a/new b/new |
|
9 |
new file mode 100644 |
|
10 |
index 0000000..7898192 |
|
11 |
--- /dev/null |
|
12 |
+++ b/new |
|
13 |
@@ -0,0 +1 @@ |
|
14 |
+a |
|
15 |
EOF |
|
16 |
||
3589
1c9b6f1237e0
test for git empty new files
Brendan Cully <brendan@kublai.com>
parents:
2864
diff
changeset
|
17 |
echo % new empty file |
1c9b6f1237e0
test for git empty new files
Brendan Cully <brendan@kublai.com>
parents:
2864
diff
changeset
|
18 |
hg import -mempty - <<EOF |
1c9b6f1237e0
test for git empty new files
Brendan Cully <brendan@kublai.com>
parents:
2864
diff
changeset
|
19 |
diff --git a/empty b/empty |
1c9b6f1237e0
test for git empty new files
Brendan Cully <brendan@kublai.com>
parents:
2864
diff
changeset
|
20 |
new file mode 100644 |
1c9b6f1237e0
test for git empty new files
Brendan Cully <brendan@kublai.com>
parents:
2864
diff
changeset
|
21 |
EOF |
1c9b6f1237e0
test for git empty new files
Brendan Cully <brendan@kublai.com>
parents:
2864
diff
changeset
|
22 |
hg locate empty |
1c9b6f1237e0
test for git empty new files
Brendan Cully <brendan@kublai.com>
parents:
2864
diff
changeset
|
23 |
|
2864 | 24 |
echo % chmod +x |
25 |
hg import -msetx - <<EOF |
|
26 |
diff --git a/new b/new |
|
27 |
old mode 100644 |
|
28 |
new mode 100755 |
|
29 |
EOF |
|
30 |
||
31 |
test -x new || echo failed |
|
32 |
||
33 |
echo % copy |
|
34 |
hg import -mcopy - <<EOF |
|
35 |
diff --git a/new b/copy |
|
36 |
old mode 100755 |
|
37 |
new mode 100644 |
|
38 |
similarity index 100% |
|
39 |
copy from new |
|
40 |
copy to copy |
|
41 |
diff --git a/new b/copyx |
|
42 |
similarity index 100% |
|
43 |
copy from new |
|
44 |
copy to copyx |
|
45 |
EOF |
|
46 |
||
5073
4cd52978e188
test-git-import: fake executable permissions.
Patrick Mezard <pmezard@gmail.com>
parents:
4679
diff
changeset
|
47 |
if "$TESTDIR/hghave" -q execbit; then |
4cd52978e188
test-git-import: fake executable permissions.
Patrick Mezard <pmezard@gmail.com>
parents:
4679
diff
changeset
|
48 |
test -f copy -a ! -x copy || echo failed |
4cd52978e188
test-git-import: fake executable permissions.
Patrick Mezard <pmezard@gmail.com>
parents:
4679
diff
changeset
|
49 |
test -x copyx || echo failed |
4cd52978e188
test-git-import: fake executable permissions.
Patrick Mezard <pmezard@gmail.com>
parents:
4679
diff
changeset
|
50 |
else |
4cd52978e188
test-git-import: fake executable permissions.
Patrick Mezard <pmezard@gmail.com>
parents:
4679
diff
changeset
|
51 |
test -f copy || echo failed |
4cd52978e188
test-git-import: fake executable permissions.
Patrick Mezard <pmezard@gmail.com>
parents:
4679
diff
changeset
|
52 |
fi |
2864 | 53 |
cat copy |
54 |
hg cat copy |
|
55 |
||
56 |
echo % rename |
|
57 |
hg import -mrename - <<EOF |
|
58 |
diff --git a/copy b/rename |
|
59 |
similarity index 100% |
|
60 |
rename from copy |
|
61 |
rename to rename |
|
62 |
EOF |
|
63 |
||
64 |
hg locate |
|
65 |
||
66 |
echo % delete |
|
67 |
hg import -mdelete - <<EOF |
|
68 |
diff --git a/copyx b/copyx |
|
69 |
deleted file mode 100755 |
|
70 |
index 7898192..0000000 |
|
71 |
--- a/copyx |
|
72 |
+++ /dev/null |
|
73 |
@@ -1 +0,0 @@ |
|
74 |
-a |
|
75 |
EOF |
|
76 |
||
77 |
hg locate |
|
78 |
test -f copyx && echo failed || true |
|
79 |
||
80 |
echo % regular diff |
|
81 |
hg import -mregular - <<EOF |
|
82 |
diff --git a/rename b/rename |
|
83 |
index 7898192..72e1fe3 100644 |
|
84 |
--- a/rename |
|
85 |
+++ b/rename |
|
86 |
@@ -1 +1,5 @@ |
|
87 |
a |
|
88 |
+a |
|
89 |
+a |
|
90 |
+a |
|
91 |
+a |
|
92 |
EOF |
|
93 |
||
94 |
echo % copy and modify |
|
95 |
hg import -mcopymod - <<EOF |
|
96 |
diff --git a/rename b/copy2 |
|
97 |
similarity index 80% |
|
98 |
copy from rename |
|
99 |
copy to copy2 |
|
100 |
index 72e1fe3..b53c148 100644 |
|
101 |
--- a/rename |
|
102 |
+++ b/copy2 |
|
103 |
@@ -1,5 +1,5 @@ |
|
104 |
a |
|
105 |
a |
|
106 |
-a |
|
107 |
+b |
|
108 |
a |
|
109 |
a |
|
110 |
EOF |
|
111 |
||
112 |
hg cat copy2 |
|
113 |
||
114 |
echo % rename and modify |
|
115 |
hg import -mrenamemod - <<EOF |
|
116 |
diff --git a/copy2 b/rename2 |
|
117 |
similarity index 80% |
|
118 |
rename from copy2 |
|
119 |
rename to rename2 |
|
120 |
index b53c148..8f81e29 100644 |
|
121 |
--- a/copy2 |
|
122 |
+++ b/rename2 |
|
123 |
@@ -1,5 +1,5 @@ |
|
124 |
a |
|
125 |
a |
|
126 |
b |
|
127 |
-a |
|
128 |
+c |
|
129 |
a |
|
130 |
EOF |
|
131 |
||
132 |
hg locate copy2 |
|
133 |
hg cat rename2 |
|
3701
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
134 |
|
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
135 |
echo % one file renamed multiple times |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
136 |
hg import -mmultirenames - <<EOF |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
137 |
diff --git a/rename2 b/rename3 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
138 |
rename from rename2 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
139 |
rename to rename3 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
140 |
diff --git a/rename2 b/rename3-2 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
141 |
rename from rename2 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
142 |
rename to rename3-2 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
143 |
EOF |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
144 |
hg log -vCr. --template '{rev} {files} / {file_copies%filecopy}\n' |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
145 |
|
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
146 |
hg locate rename2 rename3 rename3-2 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
147 |
hg cat rename3 |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
148 |
echo |
05c8704a3743
handle git patches that rename a file to more than one destination
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3589
diff
changeset
|
149 |
hg cat rename3-2 |
3716
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
150 |
|
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
151 |
echo foo > foo |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
152 |
hg add foo |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
153 |
hg ci -m 'add foo' |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
154 |
echo % binary files and regular patch hunks |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
155 |
hg import -m binaryregular - <<EOF |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
156 |
diff --git a/binary b/binary |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
157 |
new file mode 100644 |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
158 |
index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4 |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
159 |
GIT binary patch |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
160 |
literal 4 |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
161 |
Lc\${NkU|;|M00aO5 |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
162 |
|
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
163 |
diff --git a/foo b/foo2 |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
164 |
rename from foo |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
165 |
rename to foo2 |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
166 |
EOF |
ab5600428b08
handle files with both git binary patches and copy/rename ops
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3701
diff
changeset
|
167 |
cat foo2 |
3736 | 168 |
hg manifest --debug | grep binary |
3717
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
169 |
|
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
170 |
echo % many binary files |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
171 |
hg import -m multibinary - <<EOF |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
172 |
diff --git a/mbinary1 b/mbinary1 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
173 |
new file mode 100644 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
174 |
index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
175 |
GIT binary patch |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
176 |
literal 4 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
177 |
Lc\${NkU|;|M00aO5 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
178 |
|
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
179 |
diff --git a/mbinary2 b/mbinary2 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
180 |
new file mode 100644 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
181 |
index 0000000000000000000000000000000000000000..112363ac1917b417ffbd7f376ca786a1e5fa7490 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
182 |
GIT binary patch |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
183 |
literal 5 |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
184 |
Mc\${NkU|\`?^000jF3jhEB |
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
185 |
|
9e248cfd8b94
handle files with more than one git binary patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3716
diff
changeset
|
186 |
EOF |
3736 | 187 |
hg manifest --debug | grep mbinary |
4679
826659bd8053
git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3736
diff
changeset
|
188 |
|
826659bd8053
git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3736
diff
changeset
|
189 |
echo % filenames with spaces |
826659bd8053
git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3736
diff
changeset
|
190 |
hg import -m spaces - <<EOF |
826659bd8053
git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3736
diff
changeset
|
191 |
diff --git a/foo bar b/foo bar |
826659bd8053
git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3736
diff
changeset
|
192 |
new file mode 100644 |
826659bd8053
git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3736
diff
changeset
|
193 |
index 0000000..257cc56 |
826659bd8053
git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3736
diff
changeset
|
194 |
--- /dev/null |
826659bd8053
git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3736
diff
changeset
|
195 |
+++ b/foo bar |
826659bd8053
git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3736
diff
changeset
|
196 |
@@ -0,0 +1 @@ |
826659bd8053
git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3736
diff
changeset
|
197 |
+foo |
826659bd8053
git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3736
diff
changeset
|
198 |
EOF |
826659bd8053
git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3736
diff
changeset
|
199 |
cat "foo bar" |
826659bd8053
git patches: correct handling of filenames with spaces
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3736
diff
changeset
|
200 |
|
5403
477136fa6571
Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5073
diff
changeset
|
201 |
echo % copy then modify the original file |
477136fa6571
Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5073
diff
changeset
|
202 |
hg import -m copy-mod-orig - <<EOF |
477136fa6571
Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5073
diff
changeset
|
203 |
diff --git a/foo2 b/foo2 |
477136fa6571
Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5073
diff
changeset
|
204 |
index 257cc56..fe08ec6 100644 |
477136fa6571
Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5073
diff
changeset
|
205 |
--- a/foo2 |
477136fa6571
Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5073
diff
changeset
|
206 |
+++ b/foo2 |
477136fa6571
Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5073
diff
changeset
|
207 |
@@ -1 +1,2 @@ |
477136fa6571
Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5073
diff
changeset
|
208 |
foo |
477136fa6571
Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5073
diff
changeset
|
209 |
+new line |
477136fa6571
Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5073
diff
changeset
|
210 |
diff --git a/foo2 b/foo3 |
477136fa6571
Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5073
diff
changeset
|
211 |
similarity index 100% |
477136fa6571
Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5073
diff
changeset
|
212 |
copy from foo2 |
477136fa6571
Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5073
diff
changeset
|
213 |
copy to foo3 |
477136fa6571
Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5073
diff
changeset
|
214 |
EOF |
477136fa6571
Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5073
diff
changeset
|
215 |
|
477136fa6571
Always copy the necessary files before applying a git patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5073
diff
changeset
|
216 |
cat foo3 |