| 1 |
#require execbit |
| 2 |
|
| 3 |
$ cat <<EOF >> $HGRCPATH |
| 4 |
> [extensions] |
| 5 |
> autodiff = $TESTDIR/autodiff.py |
| 6 |
> [diff] |
| 7 |
> nodates = 1 |
| 8 |
> EOF |
| 9 |
|
| 10 |
$ hg init repo |
| 11 |
$ cd repo |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
make a combination of new, changed and deleted file |
| 16 |
|
| 17 |
$ echo regular > regular |
| 18 |
$ echo rmregular > rmregular |
| 19 |
$ "$PYTHON" -c "open('bintoregular', 'wb').write(b'\0')" |
| 20 |
$ touch rmempty |
| 21 |
$ echo exec > exec |
| 22 |
$ chmod +x exec |
| 23 |
$ echo rmexec > rmexec |
| 24 |
$ chmod +x rmexec |
| 25 |
$ echo setexec > setexec |
| 26 |
$ echo unsetexec > unsetexec |
| 27 |
$ chmod +x unsetexec |
| 28 |
$ echo binary > binary |
| 29 |
$ "$PYTHON" -c "open('rmbinary', 'wb').write(b'\0')" |
| 30 |
$ hg ci -Am addfiles |
| 31 |
adding binary |
| 32 |
adding bintoregular |
| 33 |
adding exec |
| 34 |
adding regular |
| 35 |
adding rmbinary |
| 36 |
adding rmempty |
| 37 |
adding rmexec |
| 38 |
adding rmregular |
| 39 |
adding setexec |
| 40 |
adding unsetexec |
| 41 |
$ echo regular >> regular |
| 42 |
$ echo newregular >> newregular |
| 43 |
$ rm rmempty |
| 44 |
$ touch newempty |
| 45 |
$ rm rmregular |
| 46 |
$ echo exec >> exec |
| 47 |
$ echo newexec > newexec |
| 48 |
$ echo bintoregular > bintoregular |
| 49 |
$ chmod +x newexec |
| 50 |
$ rm rmexec |
| 51 |
$ chmod +x setexec |
| 52 |
$ chmod -x unsetexec |
| 53 |
$ "$PYTHON" -c "open('binary', 'wb').write(b'\0\0')" |
| 54 |
$ "$PYTHON" -c "open('newbinary', 'wb').write(b'\0')" |
| 55 |
$ rm rmbinary |
| 56 |
$ hg addremove -s 0 |
| 57 |
adding newbinary |
| 58 |
adding newempty |
| 59 |
adding newexec |
| 60 |
adding newregular |
| 61 |
removing rmbinary |
| 62 |
removing rmempty |
| 63 |
removing rmexec |
| 64 |
removing rmregular |
| 65 |
|
| 66 |
git=no: regular diff for all files |
| 67 |
|
| 68 |
$ hg autodiff --git=no |
| 69 |
diff -r a66d19b9302d binary |
| 70 |
Binary file binary has changed |
| 71 |
diff -r a66d19b9302d bintoregular |
| 72 |
Binary file bintoregular has changed |
| 73 |
diff -r a66d19b9302d exec |
| 74 |
--- a/exec |
| 75 |
+++ b/exec |
| 76 |
@@ -1,1 +1,2 @@ |
| 77 |
exec |
| 78 |
+exec |
| 79 |
diff -r a66d19b9302d newbinary |
| 80 |
Binary file newbinary has changed |
| 81 |
diff -r a66d19b9302d newexec |
| 82 |
--- /dev/null |
| 83 |
+++ b/newexec |
| 84 |
@@ -0,0 +1,1 @@ |
| 85 |
+newexec |
| 86 |
diff -r a66d19b9302d newregular |
| 87 |
--- /dev/null |
| 88 |
+++ b/newregular |
| 89 |
@@ -0,0 +1,1 @@ |
| 90 |
+newregular |
| 91 |
diff -r a66d19b9302d regular |
| 92 |
--- a/regular |
| 93 |
+++ b/regular |
| 94 |
@@ -1,1 +1,2 @@ |
| 95 |
regular |
| 96 |
+regular |
| 97 |
diff -r a66d19b9302d rmbinary |
| 98 |
Binary file rmbinary has changed |
| 99 |
diff -r a66d19b9302d rmexec |
| 100 |
--- a/rmexec |
| 101 |
+++ /dev/null |
| 102 |
@@ -1,1 +0,0 @@ |
| 103 |
-rmexec |
| 104 |
diff -r a66d19b9302d rmregular |
| 105 |
--- a/rmregular |
| 106 |
+++ /dev/null |
| 107 |
@@ -1,1 +0,0 @@ |
| 108 |
-rmregular |
| 109 |
|
| 110 |
git=yes: git diff for single regular file |
| 111 |
|
| 112 |
$ hg autodiff --git=yes regular |
| 113 |
diff --git a/regular b/regular |
| 114 |
--- a/regular |
| 115 |
+++ b/regular |
| 116 |
@@ -1,1 +1,2 @@ |
| 117 |
regular |
| 118 |
+regular |
| 119 |
|
| 120 |
git=auto: regular diff for regular files and non-binary removals |
| 121 |
|
| 122 |
$ hg autodiff --git=auto regular newregular rmregular rmexec |
| 123 |
diff -r a66d19b9302d newregular |
| 124 |
--- /dev/null |
| 125 |
+++ b/newregular |
| 126 |
@@ -0,0 +1,1 @@ |
| 127 |
+newregular |
| 128 |
diff -r a66d19b9302d regular |
| 129 |
--- a/regular |
| 130 |
+++ b/regular |
| 131 |
@@ -1,1 +1,2 @@ |
| 132 |
regular |
| 133 |
+regular |
| 134 |
diff -r a66d19b9302d rmexec |
| 135 |
--- a/rmexec |
| 136 |
+++ /dev/null |
| 137 |
@@ -1,1 +0,0 @@ |
| 138 |
-rmexec |
| 139 |
diff -r a66d19b9302d rmregular |
| 140 |
--- a/rmregular |
| 141 |
+++ /dev/null |
| 142 |
@@ -1,1 +0,0 @@ |
| 143 |
-rmregular |
| 144 |
|
| 145 |
$ for f in exec newexec setexec unsetexec binary newbinary newempty rmempty rmbinary bintoregular; do |
| 146 |
> echo |
| 147 |
> echo '% git=auto: git diff for' $f |
| 148 |
> hg autodiff --git=auto $f |
| 149 |
> done |
| 150 |
|
| 151 |
% git=auto: git diff for exec |
| 152 |
diff -r a66d19b9302d exec |
| 153 |
--- a/exec |
| 154 |
+++ b/exec |
| 155 |
@@ -1,1 +1,2 @@ |
| 156 |
exec |
| 157 |
+exec |
| 158 |
|
| 159 |
% git=auto: git diff for newexec |
| 160 |
diff --git a/newexec b/newexec |
| 161 |
new file mode 100755 |
| 162 |
--- /dev/null |
| 163 |
+++ b/newexec |
| 164 |
@@ -0,0 +1,1 @@ |
| 165 |
+newexec |
| 166 |
|
| 167 |
% git=auto: git diff for setexec |
| 168 |
diff --git a/setexec b/setexec |
| 169 |
old mode 100644 |
| 170 |
new mode 100755 |
| 171 |
|
| 172 |
% git=auto: git diff for unsetexec |
| 173 |
diff --git a/unsetexec b/unsetexec |
| 174 |
old mode 100755 |
| 175 |
new mode 100644 |
| 176 |
|
| 177 |
% git=auto: git diff for binary |
| 178 |
diff --git a/binary b/binary |
| 179 |
index a9128c283485202893f5af379dd9beccb6e79486..09f370e38f498a462e1ca0faa724559b6630c04f |
| 180 |
GIT binary patch |
| 181 |
literal 2 |
| 182 |
Jc${Nk0000200961 |
| 183 |
|
| 184 |
|
| 185 |
% git=auto: git diff for newbinary |
| 186 |
diff --git a/newbinary b/newbinary |
| 187 |
new file mode 100644 |
| 188 |
index 0000000000000000000000000000000000000000..f76dd238ade08917e6712764a16a22005a50573d |
| 189 |
GIT binary patch |
| 190 |
literal 1 |
| 191 |
Ic${MZ000310RR91 |
| 192 |
|
| 193 |
|
| 194 |
% git=auto: git diff for newempty |
| 195 |
diff --git a/newempty b/newempty |
| 196 |
new file mode 100644 |
| 197 |
|
| 198 |
% git=auto: git diff for rmempty |
| 199 |
diff --git a/rmempty b/rmempty |
| 200 |
deleted file mode 100644 |
| 201 |
|
| 202 |
% git=auto: git diff for rmbinary |
| 203 |
diff --git a/rmbinary b/rmbinary |
| 204 |
deleted file mode 100644 |
| 205 |
index f76dd238ade08917e6712764a16a22005a50573d..0000000000000000000000000000000000000000 |
| 206 |
GIT binary patch |
| 207 |
literal 0 |
| 208 |
Hc$@<O00001 |
| 209 |
|
| 210 |
|
| 211 |
% git=auto: git diff for bintoregular |
| 212 |
diff --git a/bintoregular b/bintoregular |
| 213 |
index f76dd238ade08917e6712764a16a22005a50573d..9c42f2b6427d8bf034b7bc23986152dc01bfd3ab |
| 214 |
GIT binary patch |
| 215 |
literal 13 |
| 216 |
Uc$`bh%qz(+N=+}#Ni5<5043uE82|tP |
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
git=warn: regular diff with data loss warnings |
| 221 |
|
| 222 |
$ hg autodiff --git=warn |
| 223 |
diff -r a66d19b9302d binary |
| 224 |
Binary file binary has changed |
| 225 |
diff -r a66d19b9302d bintoregular |
| 226 |
Binary file bintoregular has changed |
| 227 |
diff -r a66d19b9302d exec |
| 228 |
--- a/exec |
| 229 |
+++ b/exec |
| 230 |
@@ -1,1 +1,2 @@ |
| 231 |
exec |
| 232 |
+exec |
| 233 |
diff -r a66d19b9302d newbinary |
| 234 |
Binary file newbinary has changed |
| 235 |
diff -r a66d19b9302d newexec |
| 236 |
--- /dev/null |
| 237 |
+++ b/newexec |
| 238 |
@@ -0,0 +1,1 @@ |
| 239 |
+newexec |
| 240 |
diff -r a66d19b9302d newregular |
| 241 |
--- /dev/null |
| 242 |
+++ b/newregular |
| 243 |
@@ -0,0 +1,1 @@ |
| 244 |
+newregular |
| 245 |
diff -r a66d19b9302d regular |
| 246 |
--- a/regular |
| 247 |
+++ b/regular |
| 248 |
@@ -1,1 +1,2 @@ |
| 249 |
regular |
| 250 |
+regular |
| 251 |
diff -r a66d19b9302d rmbinary |
| 252 |
Binary file rmbinary has changed |
| 253 |
diff -r a66d19b9302d rmexec |
| 254 |
--- a/rmexec |
| 255 |
+++ /dev/null |
| 256 |
@@ -1,1 +0,0 @@ |
| 257 |
-rmexec |
| 258 |
diff -r a66d19b9302d rmregular |
| 259 |
--- a/rmregular |
| 260 |
+++ /dev/null |
| 261 |
@@ -1,1 +0,0 @@ |
| 262 |
-rmregular |
| 263 |
data lost for: binary |
| 264 |
data lost for: bintoregular |
| 265 |
data lost for: newbinary |
| 266 |
data lost for: newempty |
| 267 |
data lost for: newexec |
| 268 |
data lost for: rmbinary |
| 269 |
data lost for: rmempty |
| 270 |
data lost for: setexec |
| 271 |
data lost for: unsetexec |
| 272 |
|
| 273 |
git=abort: fail on execute bit change |
| 274 |
|
| 275 |
$ hg autodiff --git=abort regular setexec |
| 276 |
abort: losing data for setexec |
| 277 |
[255] |
| 278 |
|
| 279 |
git=abort: succeed on regular file |
| 280 |
|
| 281 |
$ hg autodiff --git=abort regular |
| 282 |
diff -r a66d19b9302d regular |
| 283 |
--- a/regular |
| 284 |
+++ b/regular |
| 285 |
@@ -1,1 +1,2 @@ |
| 286 |
regular |
| 287 |
+regular |
| 288 |
|
| 289 |
$ cd .. |
| 290 |
|