monotone

monotone Mtn Source Tree

Root/tests/t_unidiff2.at

1# -*- Autoconf -*-
2
3AT_SETUP([calculation of incorrect unidiffs])
4
5MIMENCODE=`which mimencode 2>/dev/null`
6if test -z "$MIMENCODE" ; then
7 exit 77
8fi
9
10MONOTONE_SETUP
11
12AT_DATA(firstfile.b64, [Ly8gY29weXJpZ2h0IChDKSAyMDAyLCAyMDAzIGdyYXlkb24gaG9hcmUgPGdyYXlkb25AcG9i
13b3guY29tPgovLyBhbGwgcmlnaHRzIHJlc2VydmVkLgovLyBsaWNlbnNlZCB0byB0aGUgcHVi
14bGljIHVuZGVyIHRoZSB0ZXJtcyBvZiB0aGUgR05VIEdQTCAoPj0gMikKLy8gc2VlIHRoZSBm
15aWxlIENPUFlJTkcgZm9yIGRldGFpbHMKCiNpbmNsdWRlIDxtYXA+CiNpbmNsdWRlIDxjc3Rk
16aW8+CiNpbmNsdWRlIDxzZXQ+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxhbGdvcml0
17aG0+CiNpbmNsdWRlIDxpdGVyYXRvcj4KI2luY2x1ZGUgPGJvb3N0L2ZpbGVzeXN0ZW0vcGF0
18aC5ocHA+CiNpbmNsdWRlIDxib29zdC9maWxlc3lzdGVtL29wZXJhdGlvbnMuaHBwPgojaW5j
19bHVkZSA8Ym9vc3QvbGV4aWNhbF9jYXN0LmhwcD4KCiNpbmNsdWRlICJjb21tYW5kcy5oaCIK
20I2luY2x1ZGUgImNvbnN0YW50cy5oaCIKCiNpbmNsdWRlICJhcHBfc3RhdGUuaGgiCiNpbmNs
21dWRlICJkaWZmX3BhdGNoLmhoIgojaW5jbHVkZSAiZmlsZV9pby5oaCIKI2luY2x1ZGUgImtl
22eXMuaGgiCiNpbmNsdWRlICJtYW5pZmVzdC5oaCIKI2luY2x1ZGUgIm5ldHdvcmsuaGgiCiNp
23bmNsdWRlICJwYWNrZXQuaGgiCiNpbmNsdWRlICJwYXRjaF9zZXQuaGgiCiNpbmNsdWRlICJy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G4iLCBtX3BhdGgoKS5j
112X3N0cigpKTsKICB3cml0ZV9tYW5pZmVzdF9tYXAobSwgbV9kYXRhKTsKICB3cml0ZV9kYXRh
113KG1fcGF0aCwgbV9kYXRhLmlubmVyKCkpOwogIEwoIndyb3RlICVkIG1hbmlmZXN0IGVudHJp
114ZXNcbiIsIG0uc2l6ZSgpKTsKfQoKc3RhdGljIHZvaWQgZ2V0X3dvcmtfc2V0KHdvcmtfc2V0
115ICYgdykKewogIGVuc3VyZV9ib29rZGlyKCk7CiAgbG9jYWxfcGF0aCB3X3BhdGg7CiAgZ2V0
116X3dvcmtfcGF0aCh3X3BhdGgpOwogIGlmIChmaWxlX2V4aXN0cyh3X3BhdGgpKQogICAgewog
117ICAgICBMKCJjaGVja2luZyBmb3IgdW4tY29tbWl0dGVkIHdvcmsgZmlsZSAlc1xuIiwgCgl3
118X3BhdGgoKS5jX3N0cigpKTsKICAgICAgZGF0YSB3X2RhdGE7CiAgICAgIHJlYWRfZGF0YSh3
119X3BhdGgsIHdfZGF0YSk7CiAgICAgIHJlYWRfd29ya19zZXQod19kYXRhLCB3KTsKICAgICAg
120TCgicmVhZCAlZCBkZWxzLCAlZCBhZGRzIGZyb20gJXNcbiIsIAoJdy5kZWxzLnNpemUoKSwg
121dy5hZGRzLnNpemUoKSwgd19wYXRoKCkuY19zdHIoKSk7CiAgICB9CiAgZWxzZQogICAgewog
122ICAgICBMKCJubyB1bi1jb21taXR0ZWQgd29yayBmaWxlICVzXG4iLCB3X3BhdGgoKS5jX3N0
123cigpKTsKICAgIH0KfQoKc3RhdGljIHZvaWQgcHV0X3dvcmtfc2V0KHdvcmtfc2V0ICYgdykK
124ewogIGxvY2FsX3BhdGggd19wYXRoOwogIGdldF93b3JrX3BhdGgod19wYXRoKTsKCiAgaWYg
125KHcuYWRkcy5zaXplKCkgPiAwCiAgICAgIHx8IHcuZGVscy5zaXplKCkgPiAwKQogICAgewog
126ICAgICBlbnN1cmVfYm9va2RpcigpOwogICAgICBkY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GVuZGw7CiAgICAgIGZvciAoc2l6ZV90
314IGkgPSAwOyBpIDwgcHJpdmtleXMuc2l6ZSgpOyArK2kpCgljb3V0IDw8IHByaXZrZXlzW2ld
315KCkgPDwgZW5kbDsKICAgICAgY291dCA8PCBlbmRsOwogICAgfQoKICBndWFyZC5jb21taXQo
316KTsKfQoKQ01EKGdlbmtleSwgImtleSBhbmQgY2VydCIsICI8a2V5aWQ+IiwgImdlbmVyYXRl
317IGFuIFJTQSBrZXktcGFpciIpCnsKICBpZiAoYXJncy5zaXplKCkgIT0gMSkKICAgIHRocm93
318IHVzYWdlKG5hbWUpOwogIAogIHRyYW5zYWN0aW9uX2d1YXJkIGd1YXJkKGFwcC5kYik7CiAg
319cnNhX2tleXBhaXJfaWQgaWRlbnQoYXJnc1swXSk7CgogIE4oISBhcHAuZGIua2V5X2V4aXN0
320cyhpZGVudCksCiAgICAoc3RyaW5nKCJrZXkgJyIpICsgaWRlbnQoKSArICInIGFscmVhZHkg
321ZXhpc3RzIGluIGRhdGFiYXNlIikpOwogIAogIGJhc2U2NDxyc2FfcHViX2tleT4gcHViOwog
322IGJhc2U2NDwgYXJjNDxyc2FfcHJpdl9rZXk+ID4gcHJpdjsKICBQKCJnZW5lcmF0aW5nIGtl
323eS1wYWlyICclcydcbiIsIGlkZW50KCkuY19zdHIoKSk7CiAgZ2VuZXJhdGVfa2V5X3BhaXIo
324YXBwLmx1YSwgaWRlbnQsIHB1YiwgcHJpdik7CiAgUCgic3RvcmluZyBrZXktcGFpciAnJXMn
325IGluIGRhdGFiYXNlXG4iLCBpZGVudCgpLmNfc3RyKCkpOwogIGFwcC5kYi5wdXRfa2V5X3Bh
326aXIoaWRlbnQsIHB1YiwgcHJpdik7CgogIGd1YXJkLmNvbW1pdCgpOwp9CgpDTUQoY2VydCwg
327ImtleSBhbmQgY2VydCIsICIoZmlsZXxtYW5pZmVzdCkgPGlkPiA8Y2VydG5hbWU+IFtjZXJ0
328dmFsXSIsIAogICAgICAgICAgICAg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aXplKCkgIT0gMykKICAgIHRocm93IHVzYWdlKG5hbWUpOwoKICBzdHJp
373bmcgY29tbWVudDsKICBpZiAoYXJncy5zaXplKCkgPT0gMykKICAgIGNvbW1lbnQgPSBhcmdz
374WzJdOwogIGVsc2UKICAgIE4oYXBwLmx1YS5ob29rX2VkaXRfY29tbWVudCgiIiwgY29tbWVu
375dCksICJlZGl0IGNvbW1lbnQgZmFpbGVkIik7CiAgCiAgTihjb21tZW50LmZpbmRfZmlyc3Rf
376bm90X29mKCIgXHJcdFxuIikgPT0gc3RyaW5nOjpucG9zLCAiZW1wdHkgY29tbWVudCIpOwoK
377ICBpZiAoYXJnc1swXSA9PSAiZmlsZSIpCiAgICB7CiAgICAgIHBhY2tldF9kYl93cml0ZXIg
378ZGJ3KGFwcCk7CiAgICAgIGNlcnRfZmlsZV9jb21tZW50KGZpbGVfaWQoYXJnc1sxXSksIGNv
379bW1lbnQsIGFwcCwgZGJ3KTsgCiAgICB9CiAgZWxzZSBpZiAoYXJnc1swXSA9PSAibWFuaWZl
380c3QiKQogICAgewogICAgICBwYWNrZXRfZGJfd3JpdGVyIGRidyhhcHApOwogICAgICBjZXJ0
381X21hbmlmZXN0X2NvbW1lbnQobWFuaWZlc3RfaWQoYXJnc1sxXSksIGNvbW1lbnQsIGFwcCwg
382ZGJ3KTsKICAgIH0KICBlbHNlCiAgICB0aHJvdyB1c2FnZShuYW1lKTsKfQoKCgpDTUQoYWRk
383LCAid29ya2luZyBjb3B5IiwgIjxwYXRobmFtZT4gWy4uLl0iLCAiYWRkIGZpbGVzIHRvIHdv
384cmtpbmcgY29weSIpCnsKICBpZiAoYXJncy5zaXplKCkgPCAxKQogICAgdGhyb3cgdXNhZ2Uo
385bmFtZSk7CgogIHRyYW5zYWN0aW9uX2d1YXJkIGd1YXJkKGFwcC5kYik7CgogIG1hbmlmZXN0
386X21hcCBtYW47CiAgd29ya19zZXQgd29yazsgIAogIGdldF9tYW5pZmVzdF9tYXAobWFuKTsK
387ICBnZ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nJhbmNo
619PTxicmFuY2huYW1lPiIgPDwgZW5kbDsKICAgICAgcmV0dXJuOwogICAgfQoKICBnZXRfYnJh
620bmNoX2hlYWRzKGFwcC5icmFuY2hfbmFtZSwgYXBwLCBoZWFkcyk7CgogIGlmIChoZWFkcy5z
621aXplKCkgPT0gMCkKICAgIHsKICAgICAgY291dCA8PCAiYnJhbmNoICIgPDwgYXJnc1swXSA8
622PCAiaXMgZW1wdHkiIDw8IGVuZGw7CiAgICAgIHJldHVybjsKICAgIH0KICBlbHNlIGlmICho
623ZWFkcy5zaXplKCkgPT0gMSkKICAgIHsKICAgICAgY291dCA8PCAiYnJhbmNoICIgPDwgYXJn
624c1swXSA8PCAiaXMgbWVyZ2VkIiA8PCBlbmRsOwogICAgICByZXR1cm47CiAgICB9CiAgZWxz
625ZQogICAgewogICAgICB2ZWN0b3I8IHBhaXI8dXJsLGdyb3VwPiA+IHRhcmdldHM7CiAgICAg
626IGFwcC5sdWEuaG9va19nZXRfcG9zdF90YXJnZXRzKGFwcC5icmFuY2hfbmFtZSwgdGFyZ2V0
627cyk7CgogICAgICBtYW5pZmVzdF9pZCBsZWZ0ID0gaGVhZHNbMF07CiAgICAgIG1hbmlmZXN0
628X2lkIGFuY2VzdG9yOwogICAgICBmb3IgKHNpemVfdCBpID0gMTsgaSA8IGhlYWRzLnNpemUo
629KTsgKytpKQoJewoJICBtYW5pZmVzdF9pZCByaWdodCA9IGhlYWRzW2ldOwoJICBQKCJtZXJn
630aW5nIHdpdGggbWFuaWZlc3QgJWQgLyAlZDogJXMgPC0+ICVzXG4iLAoJICAgIGksIGhlYWRz
631LnNpemUoKSwKCSAgICBsZWZ0LmlubmVyKCkoKS5jX3N0cigpLCByaWdodC5pbm5lcigpKCku
632Y19zdHIoKSk7CgoJICBtYW5pZmVzdF9pZCBtZXJnZWQ7CgkgIHRyYW5zYWN0aW9uX2d1YXJk
633IGd1YXJkKGFwcC5kYik7CgkgIHRyeV9vbmVfbWVyZ2UgKGxlZnQs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ldHMpOwoJfQogICAgICBl
823bHNlCgl7CgkgIE4oYXBwLmx1YS5ob29rX2dldF9wb3N0X3RhcmdldHMoYXBwLmJyYW5jaF9u
824YW1lLCB0YXJnZXRzKSwKCSAgICAoIm5vIFVSTCAvIGdyb3VwIHBhaXJzIGZvdW5kIGZvciBi
825cmFuY2ggIiArIGFwcC5icmFuY2hfbmFtZSkpOyAKCX0KICAgIH0gIAogIGVsc2UKICAgIHsK
826ICAgICAgTihhcmdzLnNpemUoKSA9PSAyLCAibmVlZCBVUkwgYW5kIGdyb3VwbmFtZSIpOwog
827ICAgICB0YXJnZXRzLnB1c2hfYmFjayhtYWtlX3BhaXIodXJsKGFyZ3NbMF0pLAoJCQkJICBn
828cm91cChhcmdzWzFdKSkpOwogICAgfQoKICBwb3N0X3F1ZXVlZF9ibG9ic190b19uZXR3b3Jr
829KHRhcmdldHMsIGFwcCk7Cn0KCgpDTUQocmNzX2ltcG9ydCwgInJjcyIsICI8cmNzZmlsZT4g
830Li4uIiwgImltcG9ydCBhbGwgdmVyc2lvbnMgaW4gUkNTIGZpbGVzIikKewogIGlmIChhcmdz
831LnNpemUoKSA8IDEpCiAgICB0aHJvdyB1c2FnZShuYW1lKTsKICAKICB0cmFuc2FjdGlvbl9n
832dWFyZCBndWFyZChhcHAuZGIpOwogIGZvciAodmVjdG9yPHN0cmluZz46OmNvbnN0X2l0ZXJh
833dG9yIGkgPSBhcmdzLmJlZ2luKCk7CiAgICAgICBpICE9IGFyZ3MuZW5kKCk7ICsraSkKICAg
834IHsKICAgICAgaW1wb3J0X3Jjc19maWxlKGZzOjpwYXRoKCppKSwgYXBwLmRiKTsKICAgIH0K
835ICBndWFyZC5jb21taXQoKTsKfQoKCkNNRChjdnNfaW1wb3J0LCAicmNzIiwgIjxjdnNyb290
836PiIsICJpbXBvcnQgYWxsIHZlcnNpb25zIGluIENWUyByZXBvc2l0b3J5IikKewogIGlmIChh
837cmdzLnNpemUoKSAhPSAxKQogICAgdGhyb3cgdXNhZ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gICAgICAgICAgICAgICAgICAgICAgICAg
913ICAgICAgICAgICAgICAgICAgIFwKICB2aXJ0dWFsIHZvaWQgZXhlYyhhcHBfc3RhdGUgJiBh
914cHAsICAgICAgICAgICAgICBcCiAgICAgICAgICAgICAgICAgICAgdmVjdG9yPHN0cmluZz4g
915Y29uc3QgJiBhcmdzKTsgXAp9OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
916ICAgICAgICAgICAgIFwKc3RhdGljIGNtZF8gIyMgQyBDICMjIF9jbWQ7ICAgICAgICAgICAg
917ICAgICAgICAgICBcCnZvaWQgY21kXyAjIyBDOjpleGVjKGFwcF9zdGF0ZSAmIGFwcCwgICAg
918ICAgICAgICAgXAogICAgICAgICAgICAgICAgICAgICB2ZWN0b3I8c3RyaW5nPiBjb25zdCAm
919IGFyZ3MpIFwKCiNkZWZpbmUgQUxJQVMoQywgcmVhbGNvbW1hbmQsIGdyb3VwLCBwYXJhbXMs
920IGRlc2MpCVwKQ01EKEMsIGdyb3VwLCBwYXJhbXMsIGRlc2MpCQkJCVwKewkJCQkJCQlcCiAg
921cHJvY2VzcyhhcHAsIHN0cmluZygjcmVhbGNvbW1hbmQpLCBhcmdzKTsJCVwKfQoKCnN0YXRp
922YyB2b2lkIGVuc3VyZV9ib29rZGlyKCkKewogIG1rZGlyX3AobG9jYWxfcGF0aChib29rX2tl
923ZXBpbmdfZGlyKSk7Cn0KCnN0YXRpYyB2b2lkIGdldF9tYW5pZmVzdF9wYXRoKGxvY2FsX3Bh
924dGggJiBtX3BhdGgpCnsKICBtX3BhdGggPSAoZnM6OnBhdGgoYm9va19rZWVwaW5nX2Rpcikg
925LyBmczo6cGF0aChtYW5pZmVzdF9maWxlX25hbWUpKS5zdHJpbmcoKTsKICBMKCJtYW5pZmVz
926dCBwYXRoIGlzICVzXG4iLCBtX3BhdGgoKS5jX3N0cigpKTsKfQoKc3RhdGljIHZvaWQgZ2V0
927X3dvcmtfcGF0aChsb2NhbF9wYXRoICYgd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TsKICB3cml0ZV9tYW5pZmVzdF9tYXAobSwgbV9kYXRhKTsKICB3cml0ZV9kYXRh
943KG1fcGF0aCwgbV9kYXRhLmlubmVyKCkpOwogIEwoIndyb3RlICVkIG1hbmlmZXN0IGVudHJp
944ZXNcbiIsIG0uc2l6ZSgpKTsKfQoKc3RhdGljIHZvaWQgZ2V0X3dvcmtfc2V0KHdvcmtfc2V0
945ICYgdykKewogIGVuc3VyZV9ib29rZGlyKCk7CiAgbG9jYWxfcGF0aCB3X3BhdGg7CiAgZ2V0
946X3dvcmtfcGF0aCh3X3BhdGgpOwogIGlmIChmaWxlX2V4aXN0cyh3X3BhdGgpKQogICAgewog
947ICAgICBMKCJjaGVja2luZyBmb3IgdW4tY29tbWl0dGVkIHdvcmsgZmlsZSAlc1xuIiwgCgl3
948X3BhdGgoKS5jX3N0cigpKTsKICAgICAgZGF0YSB3X2RhdGE7CiAgICAgIHJlYWRfZGF0YSh3
949X3BhdGgsIHdfZGF0YSk7CiAgICAgIHJlYWRfd29ya19zZXQod19kYXRhLCB3KTsKICAgICAg
950TCgicmVhZCAlZCBkZWxzLCAlZCBhZGRzIGZyb20gJXNcbiIsIAoJdy5kZWxzLnNpemUoKSwg
951dy5hZGRzLnNpemUoKSwgd19wYXRoKCkuY19zdHIoKSk7CiAgICB9CiAgZWxzZQogICAgewog
952ICAgICBMKCJubyB1bi1jb21taXR0ZWQgd29yayBmaWxlICVzXG4iLCB3X3BhdGgoKS5jX3N0
953cigpKTsKICAgIH0KfQoKc3RhdGljIHZvaWQgcHV0X3dvcmtfc2V0KHdvcmtfc2V0ICYgdykK
954ewogIGxvY2FsX3BhdGggd19wYXRoOwogIGdldF93b3JrX3BhdGgod19wYXRoKTsKCiAgaWYg
955KHcuYWRkcy5zaXplKCkgPiAwCiAgICAgIHx8IHcuZGVscy5zaXplKCkgPiAwKQogICAgewog
956ICAgICBlbnN1cmVfYm9va2RpcigpOwogICAgICBkYXRhIHdfZGF0YTsKICAgICAgd3JpdGVf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ZW5k
1142bDsKICAgIH0KCiAgaWYgKHByaXZrZXlzLnNpemUoKSA+IDApCiAgICB7CiAgICAgIGNvdXQg
1143PDwgZW5kbCA8PCAiW3ByaXZhdGUga2V5c10iIDw8IGVuZGw7CiAgICAgIGZvciAoc2l6ZV90
1144IGkgPSAwOyBpIDwgcHJpdmtleXMuc2l6ZSgpOyArK2kpCgljb3V0IDw8IHByaXZrZXlzW2ld
1145KCkgPDwgZW5kbDsKICAgICAgY291dCA8PCBlbmRsOwogICAgfQoKICBndWFyZC5jb21taXQo
1146KTsKfQoKQ01EKGdlbmtleSwgImtleSBhbmQgY2VydCIsICI8a2V5aWQ+IiwgImdlbmVyYXRl
1147IGFuIFJTQSBrZXktcGFpciIpCnsKICBpZiAoYXJncy5zaXplKCkgIT0gMSkKICAgIHRocm93
1148IHVzYWdlKG5hbWUpOwogIAogIHRyYW5zYWN0aW9uX2d1YXJkIGd1YXJkKGFwcC5kYik7CiAg
1149cnNhX2tleXBhaXJfaWQgaWRlbnQoYXJnc1swXSk7CgogIE4oISBhcHAuZGIua2V5X2V4aXN0
1150cyhpZGVudCksCiAgICAoc3RyaW5nKCJrZXkgJyIpICsgaWRlbnQoKSArICInIGFscmVhZHkg
1151ZXhpc3RzIGluIGRhdGFiYXNlIikpOwogIAogIGJhc2U2NDxyc2FfcHViX2tleT4gcHViOwog
1152IGJhc2U2NDwgYXJjNDxyc2FfcHJpdl9rZXk+ID4gcHJpdjsKICBQKCJnZW5lcmF0aW5nIGtl
1153eS1wYWlyICclcydcbiIsIGlkZW50KCkuY19zdHIoKSk7CiAgZ2VuZXJhdGVfa2V5X3BhaXIo
1154YXBwLmx1YSwgaWRlbnQsIHB1YiwgcHJpdik7CiAgUCgic3RvcmluZyBrZXktcGFpciAnJXMn
1155IGluIGRhdGFiYXNlXG4iLCBpZGVudCgpLmNfc3RyKCkpOwogIGFwcC5kYi5wdXRfa2V5X3Bh
1156aXIoaWRlbnQsIHB1YiwgcHJpdik7CgogIGd1YXJk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xcHcpOwogICAgICBjZXJ0X21hbmlmZXN0
1515X2NoYW5nZWxvZyhtZXJnZWQsIAoJCQkgICAgICAicHJvcGFnYXRlIG9mICIgCgkJCSAgICAg
1516ICsgc3JjX2hlYWRzWzBdLmlubmVyKCkoKSAKCQkJICAgICAgKyAiIGFuZCAiIAoJCQkgICAg
1517ICArIGRzdF9oZWFkc1swXS5pbm5lcigpKCkKCQkJICAgICAgKyAiXG4iCgkJCSAgICAgICsg
1518ImZyb20gYnJhbmNoICIgCgkJCSAgICAgICsgYXJnc1swXSArICIgdG8gIiArIGFyZ3NbMV0g
1519KyAiXG4iLCAKCQkJICAgICAgYXBwLCBxcHcpOwkgIAogICAgICBndWFyZC5jb21taXQoKTsg
1520ICAgICAKICAgIH0KfQoKCgpDTUQoZGlmZiwgImluZm9ybWF0aXZlIiwgIiIsICJzaG93IGN1
1521cnJlbnQgZGlmZnMgb24gc3Rkb3V0IikKewogIG1hbmlmZXN0X21hcCBtX29sZCwgbV9uZXc7
1522CiAgcGF0Y2hfc2V0IHBzOwoKICB0cmFuc2FjdGlvbl9ndWFyZCBndWFyZChhcHAuZGIpOwoK
1523ICBpZiAoYXJncy5zaXplKCkgPiAwKQogICAgewogICAgICBtYW5pZmVzdF9kYXRhIGRhdDsK
1524ICAgICAgbWFuaWZlc3RfaWQgaWRlbnQoYXJnc1swXSk7CgogICAgICBOKGFwcC5kYi5tYW5p
1525ZmVzdF92ZXJzaW9uX2V4aXN0cyhpZGVudCksCgkoc3RyaW5nKCJubyBmaWxlIHZlcnNpb24g
1526IikgKyBpZGVudC5pbm5lcigpKCkgKyAiIGZvdW5kIGluIGRhdGFiYXNlIikpOwoKICAgICAg
1527TCgiZ2V0dGluZyBtYW5pZmVzdCAlc1xuIiwgaWRlbnQuaW5uZXIoKSgpLmNfc3RyKCkpOwog
1528ICAgICBhcHAuZGIuZ2V0X21hbmlmZXN0X3ZlcnNpb24oaWRlbnQsIGRhdCk7CiAgICAgIHJl
1529YWRfbWFuaWZ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kpOyAKCX0KICAg
1673IH0gIAogIGVsc2UKICAgIHsKICAgICAgTihhcmdzLnNpemUoKSA9PSAyLCAibmVlZCBVUkwg
1674YW5kIGdyb3VwbmFtZSIpOwogICAgICB0YXJnZXRzLnB1c2hfYmFjayhtYWtlX3BhaXIodXJs
1675KGFyZ3NbMF0pLAoJCQkJICBncm91cChhcmdzWzFdKSkpOwogICAgfQoKICBwb3N0X3F1ZXVl
1676ZF9ibG9ic190b19uZXR3b3JrKHRhcmdldHMsIGFwcCk7Cn0KCgpDTUQocmNzX2ltcG9ydCwg
1677InJjcyIsICI8cmNzZmlsZT4gLi4uIiwgImltcG9ydCBhbGwgdmVyc2lvbnMgaW4gUkNTIGZp
1678bGVzIikKewogIGlmIChhcmdzLnNpemUoKSA8IDEpCiAgICB0aHJvdyB1c2FnZShuYW1lKTsK
1679ICAKICB0cmFuc2FjdGlvbl9ndWFyZCBndWFyZChhcHAuZGIpOwogIGZvciAodmVjdG9yPHN0
1680cmluZz46OmNvbnN0X2l0ZXJhdG9yIGkgPSBhcmdzLmJlZ2luKCk7CiAgICAgICBpICE9IGFy
1681Z3MuZW5kKCk7ICsraSkKICAgIHsKICAgICAgaW1wb3J0X3Jjc19maWxlKGZzOjpwYXRoKCpp
1682KSwgYXBwLmRiKTsKICAgIH0KICBndWFyZC5jb21taXQoKTsKfQoKCkNNRChjdnNfaW1wb3J0
1683LCAicmNzIiwgIjxjdnNyb290PiIsICJpbXBvcnQgYWxsIHZlcnNpb25zIGluIENWUyByZXBv
1684c2l0b3J5IikKewogIGlmIChhcmdzLnNpemUoKSAhPSAxKQogICAgdGhyb3cgdXNhZ2UobmFt
1685ZSk7CgogIGltcG9ydF9jdnNfcmVwbyhmczo6cGF0aChhcmdzLmF0KDApKSwgYXBwKTsKfQoK
1686Cn07IC8vIG5hbWVzcGFjZSBjb21tYW5kcwo=
1687])
1688
1689# decode first file and commit to db
1690AT_CHECK(mimencode -u firstfile.b64, [], [stdout])
1691AT_CHECK(mv stdout firstfile, [], [ignore])
1692AT_CHECK(cp firstfile testfile, [], [ignore])
1693AT_CHECK(MONOTONE add testfile, [], [ignore], [ignore])
1694AT_CHECK(MONOTONE --branch=testbranch commit blah-blah, [], [ignore], [ignore])
1695AT_CHECK(mv testfile firstfile, [], [ignore])
1696
1697# decode second file
1698AT_CHECK(mimencode -u secondfile.b64, [], [stdout])
1699AT_CHECK(mv stdout secondfile, [], [ignore])
1700
1701# calculate diff to second file using monotone
1702AT_CHECK(cp secondfile testfile, [], [ignore])
1703AT_CHECK(MONOTONE diff, [], [stdout])
1704AT_CHECK(mv stdout monodiff, [], [ignore])
1705
1706# look for a meaningless change
1707AT_CHECK(grep [^-$] monodiff, [1], [stdout])
1708
1709AT_CLEANUP

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status