| 1 |
#require mtn |
| 2 |
|
| 3 |
Monotone directory is called .monotone on *nix and monotone |
| 4 |
on Windows. |
| 5 |
|
| 6 |
#if windows |
| 7 |
|
| 8 |
$ mtndir=monotone |
| 9 |
|
| 10 |
#else |
| 11 |
|
| 12 |
$ mtndir=.monotone |
| 13 |
|
| 14 |
#endif |
| 15 |
|
| 16 |
$ echo "[extensions]" >> $HGRCPATH |
| 17 |
$ echo "convert=" >> $HGRCPATH |
| 18 |
|
| 19 |
Windows version of monotone home |
| 20 |
|
| 21 |
$ APPDATA=$HOME; export APPDATA |
| 22 |
|
| 23 |
tedious monotone keys configuration |
| 24 |
The /dev/null redirection is necessary under Windows, or |
| 25 |
it complains about home directory permissions |
| 26 |
|
| 27 |
$ mtn --quiet genkey [email protected] 1>/dev/null 2>&1 <<EOF |
| 28 |
> passphrase |
| 29 |
> passphrase |
| 30 |
> EOF |
| 31 |
$ cat >> $HOME/$mtndir/monotonerc <<EOF |
| 32 |
> function get_passphrase(keypair_id) |
| 33 |
> return "passphrase" |
| 34 |
> end |
| 35 |
> EOF |
| 36 |
|
| 37 |
create monotone repository |
| 38 |
|
| 39 |
$ mtn db init --db=repo.mtn |
| 40 |
$ mtn --db=repo.mtn --branch=com.selenic.test setup workingdir |
| 41 |
$ cd workingdir |
| 42 |
$ echo a > a |
| 43 |
$ mkdir dir |
| 44 |
$ echo b > dir/b |
| 45 |
$ echo d > dir/d |
| 46 |
$ "$PYTHON" -c 'open("bin", "wb").write(b"a\\x00b") and None' |
| 47 |
$ echo c > c |
| 48 |
$ mtn add a dir/b dir/d c bin |
| 49 |
mtn: adding 'a' to workspace manifest |
| 50 |
mtn: adding 'bin' to workspace manifest |
| 51 |
mtn: adding 'c' to workspace manifest |
| 52 |
mtn: adding 'dir' to workspace manifest |
| 53 |
mtn: adding 'dir/b' to workspace manifest |
| 54 |
mtn: adding 'dir/d' to workspace manifest |
| 55 |
$ mtn ci -m initialize |
| 56 |
mtn: beginning commit on branch 'com.selenic.test' |
| 57 |
mtn: committed revision 0f6e5e4f2e7d2a8ef312408f57618abf026afd90 |
| 58 |
|
| 59 |
update monotone working directory |
| 60 |
|
| 61 |
$ mtn mv a dir/a |
| 62 |
mtn: skipping 'dir', already accounted for in workspace |
| 63 |
mtn: renaming 'a' to 'dir/a' in workspace manifest |
| 64 |
$ echo a >> dir/a |
| 65 |
$ echo b >> dir/b |
| 66 |
$ mtn drop c |
| 67 |
mtn: dropping 'c' from workspace manifest |
| 68 |
$ "$PYTHON" -c 'open("bin", "wb").write(b"b\\x00c") and None' |
| 69 |
$ mtn ci -m update1 |
| 70 |
mtn: beginning commit on branch 'com.selenic.test' |
| 71 |
mtn: committed revision 51d0a982464573a2a2cf5ee2c9219c652aaebeff |
| 72 |
$ cd .. |
| 73 |
|
| 74 |
convert once |
| 75 |
|
| 76 |
$ hg convert -s mtn repo.mtn |
| 77 |
assuming destination repo.mtn-hg |
| 78 |
initializing destination repo.mtn-hg repository |
| 79 |
scanning source... |
| 80 |
sorting... |
| 81 |
converting... |
| 82 |
1 initialize |
| 83 |
0 update1 |
| 84 |
$ cd workingdir |
| 85 |
$ echo e > e |
| 86 |
$ mtn add e |
| 87 |
mtn: adding 'e' to workspace manifest |
| 88 |
$ mtn drop dir/b |
| 89 |
mtn: dropping 'dir/b' from workspace manifest |
| 90 |
$ mtn mv bin bin2 |
| 91 |
mtn: renaming 'bin' to 'bin2' in workspace manifest |
| 92 |
$ mtn ci -m 'update2 "with" quotes' |
| 93 |
mtn: beginning commit on branch 'com.selenic.test' |
| 94 |
mtn: committed revision ebe58335d85d8cb176b6d0a12be04f5314b998da |
| 95 |
|
| 96 |
test directory move |
| 97 |
|
| 98 |
$ mkdir -p dir1/subdir1 |
| 99 |
$ mkdir -p dir1/subdir2_other |
| 100 |
$ echo file1 > dir1/subdir1/file1 |
| 101 |
$ echo file2 > dir1/subdir2_other/file1 |
| 102 |
$ mtn add dir1/subdir1/file1 dir1/subdir2_other/file1 |
| 103 |
mtn: adding 'dir1' to workspace manifest |
| 104 |
mtn: adding 'dir1/subdir1' to workspace manifest |
| 105 |
mtn: adding 'dir1/subdir1/file1' to workspace manifest |
| 106 |
mtn: adding 'dir1/subdir2_other' to workspace manifest |
| 107 |
mtn: adding 'dir1/subdir2_other/file1' to workspace manifest |
| 108 |
$ mtn ci -m createdir1 |
| 109 |
mtn: beginning commit on branch 'com.selenic.test' |
| 110 |
mtn: committed revision a8d62bc04fee4d2936d28e98bbcc81686dd74306 |
| 111 |
$ mtn rename dir1/subdir1 dir1/subdir2 |
| 112 |
mtn: skipping 'dir1', already accounted for in workspace |
| 113 |
mtn: renaming 'dir1/subdir1' to 'dir1/subdir2' in workspace manifest |
| 114 |
$ mtn ci -m movedir1 |
| 115 |
mtn: beginning commit on branch 'com.selenic.test' |
| 116 |
mtn: committed revision 2c3d241bbbfe538b1b51d910f5676407e3f4d3a6 |
| 117 |
|
| 118 |
test subdirectory move |
| 119 |
|
| 120 |
$ mtn mv dir dir2 |
| 121 |
mtn: renaming 'dir' to 'dir2' in workspace manifest |
| 122 |
$ echo newfile > dir2/newfile |
| 123 |
$ mtn drop dir2/d |
| 124 |
mtn: dropping 'dir2/d' from workspace manifest |
| 125 |
$ mtn add dir2/newfile |
| 126 |
mtn: adding 'dir2/newfile' to workspace manifest |
| 127 |
$ mtn ci -m movedir |
| 128 |
mtn: beginning commit on branch 'com.selenic.test' |
| 129 |
mtn: committed revision fdb5a02dae8bfce3a79b3393680af471016e1b4c |
| 130 |
|
| 131 |
Test directory removal with empty directory |
| 132 |
|
| 133 |
$ mkdir dir2/dir |
| 134 |
$ mkdir dir2/dir/subdir |
| 135 |
$ echo f > dir2/dir/subdir/f |
| 136 |
$ mkdir dir2/dir/emptydir |
| 137 |
$ mtn add --quiet -R dir2/dir |
| 138 |
$ mtn ci -m emptydir |
| 139 |
mtn: beginning commit on branch 'com.selenic.test' |
| 140 |
mtn: committed revision 8bbf76d717001d24964e4604739fdcd0f539fc88 |
| 141 |
$ mtn drop -R dir2/dir |
| 142 |
mtn: dropping 'dir2/dir/subdir/f' from workspace manifest |
| 143 |
mtn: dropping 'dir2/dir/subdir' from workspace manifest |
| 144 |
mtn: dropping 'dir2/dir/emptydir' from workspace manifest |
| 145 |
mtn: dropping 'dir2/dir' from workspace manifest |
| 146 |
$ mtn ci -m dropdirectory |
| 147 |
mtn: beginning commit on branch 'com.selenic.test' |
| 148 |
mtn: committed revision 2323d4bc324e6c82628dc04d47a9fd32ad24e322 |
| 149 |
|
| 150 |
test directory and file move |
| 151 |
|
| 152 |
$ mkdir -p dir3/d1 |
| 153 |
$ echo a > dir3/a |
| 154 |
$ mtn add dir3/a dir3/d1 |
| 155 |
mtn: adding 'dir3' to workspace manifest |
| 156 |
mtn: adding 'dir3/a' to workspace manifest |
| 157 |
mtn: adding 'dir3/d1' to workspace manifest |
| 158 |
$ mtn ci -m dirfilemove |
| 159 |
mtn: beginning commit on branch 'com.selenic.test' |
| 160 |
mtn: committed revision 47b192f720faa622f48c68d1eb075b26d405aa8b |
| 161 |
$ mtn mv dir3/a dir3/d1/a |
| 162 |
mtn: skipping 'dir3/d1', already accounted for in workspace |
| 163 |
mtn: renaming 'dir3/a' to 'dir3/d1/a' in workspace manifest |
| 164 |
$ mtn mv dir3/d1 dir3/d2 |
| 165 |
mtn: skipping 'dir3', already accounted for in workspace |
| 166 |
mtn: renaming 'dir3/d1' to 'dir3/d2' in workspace manifest |
| 167 |
$ mtn ci -m dirfilemove2 |
| 168 |
mtn: beginning commit on branch 'com.selenic.test' |
| 169 |
mtn: committed revision 8b543a400d3ee7f6d4bb1835b9b9e3747c8cb632 |
| 170 |
|
| 171 |
test directory move into another directory move |
| 172 |
|
| 173 |
$ mkdir dir4 |
| 174 |
$ mkdir dir5 |
| 175 |
$ echo a > dir4/a |
| 176 |
$ mtn add dir4/a dir5 |
| 177 |
mtn: adding 'dir4' to workspace manifest |
| 178 |
mtn: adding 'dir4/a' to workspace manifest |
| 179 |
mtn: adding 'dir5' to workspace manifest |
| 180 |
$ mtn ci -m dirdirmove |
| 181 |
mtn: beginning commit on branch 'com.selenic.test' |
| 182 |
mtn: committed revision 466e0b2afc7a55aa2b4ab2f57cb240bb6cd66fc7 |
| 183 |
$ mtn mv dir5 dir6 |
| 184 |
mtn: renaming 'dir5' to 'dir6' in workspace manifest |
| 185 |
$ mtn mv dir4 dir6/dir4 |
| 186 |
mtn: skipping 'dir6', already accounted for in workspace |
| 187 |
mtn: renaming 'dir4' to 'dir6/dir4' in workspace manifest |
| 188 |
$ mtn ci -m dirdirmove2 |
| 189 |
mtn: beginning commit on branch 'com.selenic.test' |
| 190 |
mtn: committed revision 3d1f77ebad0c23a5d14911be3b670f990991b749 |
| 191 |
|
| 192 |
test diverging directory moves |
| 193 |
|
| 194 |
$ mkdir -p dir7/dir9/dir8 |
| 195 |
$ echo a > dir7/dir9/dir8/a |
| 196 |
$ echo b > dir7/dir9/b |
| 197 |
$ echo c > dir7/c |
| 198 |
$ mtn add -R dir7 |
| 199 |
mtn: adding 'dir7' to workspace manifest |
| 200 |
mtn: adding 'dir7/c' to workspace manifest |
| 201 |
mtn: adding 'dir7/dir9' to workspace manifest |
| 202 |
mtn: adding 'dir7/dir9/b' to workspace manifest |
| 203 |
mtn: adding 'dir7/dir9/dir8' to workspace manifest |
| 204 |
mtn: adding 'dir7/dir9/dir8/a' to workspace manifest |
| 205 |
$ mtn ci -m divergentdirmove |
| 206 |
mtn: beginning commit on branch 'com.selenic.test' |
| 207 |
mtn: committed revision 08a08511f18b428d840199b062de90d0396bc2ed |
| 208 |
$ mtn mv dir7 dir7-2 |
| 209 |
mtn: renaming 'dir7' to 'dir7-2' in workspace manifest |
| 210 |
$ mtn mv dir7-2/dir9 dir9-2 |
| 211 |
mtn: renaming 'dir7-2/dir9' to 'dir9-2' in workspace manifest |
| 212 |
$ mtn mv dir9-2/dir8 dir8-2 |
| 213 |
mtn: renaming 'dir9-2/dir8' to 'dir8-2' in workspace manifest |
| 214 |
$ mtn ci -m divergentdirmove2 |
| 215 |
mtn: beginning commit on branch 'com.selenic.test' |
| 216 |
mtn: committed revision 4a736634505795f17786fffdf2c9cbf5b11df6f6 |
| 217 |
|
| 218 |
test large file support (> 32kB) |
| 219 |
|
| 220 |
>>> fp = open('large-file', 'wb') |
| 221 |
>>> for x in range(10000): fp.write(b'%d\n' % x) and None |
| 222 |
>>> fp.close() |
| 223 |
$ md5sum.py large-file |
| 224 |
5d6de8a95c3b6bf9e0ffb808ba5299c1 large-file |
| 225 |
$ mtn add large-file |
| 226 |
mtn: adding 'large-file' to workspace manifest |
| 227 |
$ mtn ci -m largefile |
| 228 |
mtn: beginning commit on branch 'com.selenic.test' |
| 229 |
mtn: committed revision f0a20fecd10dc4392d18fe69a03f1f4919d3387b |
| 230 |
|
| 231 |
test suspending (closing a branch) |
| 232 |
|
| 233 |
$ mtn suspend f0a20fecd10dc4392d18fe69a03f1f4919d3387b 2> /dev/null |
| 234 |
$ cd .. |
| 235 |
|
| 236 |
convert incrementally |
| 237 |
|
| 238 |
$ hg convert -s mtn repo.mtn |
| 239 |
assuming destination repo.mtn-hg |
| 240 |
scanning source... |
| 241 |
sorting... |
| 242 |
converting... |
| 243 |
12 update2 "with" quotes |
| 244 |
11 createdir1 |
| 245 |
10 movedir1 |
| 246 |
9 movedir |
| 247 |
8 emptydir |
| 248 |
7 dropdirectory |
| 249 |
6 dirfilemove |
| 250 |
5 dirfilemove2 |
| 251 |
4 dirdirmove |
| 252 |
3 dirdirmove2 |
| 253 |
2 divergentdirmove |
| 254 |
1 divergentdirmove2 |
| 255 |
0 largefile |
| 256 |
$ glog() |
| 257 |
> { |
| 258 |
> hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@" |
| 259 |
> } |
| 260 |
$ cd repo.mtn-hg |
| 261 |
$ hg up -C |
| 262 |
12 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 263 |
no open descendant heads on branch "com.selenic.test", updating to a closed head |
| 264 |
(committing will reopen branch "com.selenic.test") |
| 265 |
$ glog |
| 266 |
@ 14 "largefile" files: large-file |
| 267 |
| |
| 268 |
o 13 "divergentdirmove2" files: dir7-2/c dir7/c dir7/dir9/b dir7/dir9/dir8/a dir8-2/a dir9-2/b |
| 269 |
| |
| 270 |
o 12 "divergentdirmove" files: dir7/c dir7/dir9/b dir7/dir9/dir8/a |
| 271 |
| |
| 272 |
o 11 "dirdirmove2" files: dir4/a dir6/dir4/a |
| 273 |
| |
| 274 |
o 10 "dirdirmove" files: dir4/a |
| 275 |
| |
| 276 |
o 9 "dirfilemove2" files: dir3/a dir3/d2/a |
| 277 |
| |
| 278 |
o 8 "dirfilemove" files: dir3/a |
| 279 |
| |
| 280 |
o 7 "dropdirectory" files: dir2/dir/subdir/f |
| 281 |
| |
| 282 |
o 6 "emptydir" files: dir2/dir/subdir/f |
| 283 |
| |
| 284 |
o 5 "movedir" files: dir/a dir/d dir2/a dir2/newfile |
| 285 |
| |
| 286 |
o 4 "movedir1" files: dir1/subdir1/file1 dir1/subdir2/file1 |
| 287 |
| |
| 288 |
o 3 "createdir1" files: dir1/subdir1/file1 dir1/subdir2_other/file1 |
| 289 |
| |
| 290 |
o 2 "update2 "with" quotes" files: bin bin2 dir/b e |
| 291 |
| |
| 292 |
o 1 "update1" files: a bin c dir/a dir/b |
| 293 |
| |
| 294 |
o 0 "initialize" files: a bin c dir/b dir/d |
| 295 |
|
| 296 |
|
| 297 |
manifest |
| 298 |
|
| 299 |
$ hg manifest |
| 300 |
bin2 |
| 301 |
dir1/subdir2/file1 |
| 302 |
dir1/subdir2_other/file1 |
| 303 |
dir2/a |
| 304 |
dir2/newfile |
| 305 |
dir3/d2/a |
| 306 |
dir6/dir4/a |
| 307 |
dir7-2/c |
| 308 |
dir8-2/a |
| 309 |
dir9-2/b |
| 310 |
e |
| 311 |
large-file |
| 312 |
|
| 313 |
contents |
| 314 |
|
| 315 |
$ cat dir2/a |
| 316 |
a |
| 317 |
a |
| 318 |
$ test -d dir2/dir && echo 'removed dir2/dir is still there!' |
| 319 |
[1] |
| 320 |
|
| 321 |
file move |
| 322 |
|
| 323 |
$ hg log -v -C -r 1 | grep copies |
| 324 |
copies: dir/a (a) |
| 325 |
|
| 326 |
check directory move |
| 327 |
|
| 328 |
$ hg manifest -r 4 |
| 329 |
bin2 |
| 330 |
dir/a |
| 331 |
dir/d |
| 332 |
dir1/subdir2/file1 |
| 333 |
dir1/subdir2_other/file1 |
| 334 |
e |
| 335 |
$ test -d dir1/subdir2 || echo 'new dir1/subdir2 does not exist!' |
| 336 |
$ test -d dir1/subdir1 && echo 'renamed dir1/subdir1 is still there!' |
| 337 |
[1] |
| 338 |
$ hg log -v -C -r 4 | grep copies |
| 339 |
copies: dir1/subdir2/file1 (dir1/subdir1/file1) |
| 340 |
|
| 341 |
check file remove with directory move |
| 342 |
|
| 343 |
$ hg manifest -r 5 |
| 344 |
bin2 |
| 345 |
dir1/subdir2/file1 |
| 346 |
dir1/subdir2_other/file1 |
| 347 |
dir2/a |
| 348 |
dir2/newfile |
| 349 |
e |
| 350 |
|
| 351 |
check file move with directory move |
| 352 |
|
| 353 |
$ hg manifest -r 9 |
| 354 |
bin2 |
| 355 |
dir1/subdir2/file1 |
| 356 |
dir1/subdir2_other/file1 |
| 357 |
dir2/a |
| 358 |
dir2/newfile |
| 359 |
dir3/d2/a |
| 360 |
e |
| 361 |
|
| 362 |
check file directory directory move |
| 363 |
|
| 364 |
$ hg manifest -r 11 |
| 365 |
bin2 |
| 366 |
dir1/subdir2/file1 |
| 367 |
dir1/subdir2_other/file1 |
| 368 |
dir2/a |
| 369 |
dir2/newfile |
| 370 |
dir3/d2/a |
| 371 |
dir6/dir4/a |
| 372 |
e |
| 373 |
|
| 374 |
check divergent directory moves |
| 375 |
|
| 376 |
$ hg manifest -r 13 |
| 377 |
bin2 |
| 378 |
dir1/subdir2/file1 |
| 379 |
dir1/subdir2_other/file1 |
| 380 |
dir2/a |
| 381 |
dir2/newfile |
| 382 |
dir3/d2/a |
| 383 |
dir6/dir4/a |
| 384 |
dir7-2/c |
| 385 |
dir8-2/a |
| 386 |
dir9-2/b |
| 387 |
e |
| 388 |
|
| 389 |
test large file support (> 32kB) |
| 390 |
|
| 391 |
$ md5sum.py large-file |
| 392 |
5d6de8a95c3b6bf9e0ffb808ba5299c1 large-file |
| 393 |
|
| 394 |
check branch closing |
| 395 |
|
| 396 |
$ hg branches -a |
| 397 |
$ hg branches -c |
| 398 |
com.selenic.test 14:* (closed) (glob) |
| 399 |
|