| 1 |
$! |
| 2 |
$! Custom merge tool to help solve merge conflict in OpenVMS |
| 3 |
$! We recommand to solve this on other system |
| 4 |
$! |
| 5 |
$ set proc/par=extend |
| 6 |
$ mine = p1 |
| 7 |
$ orig = p2 |
| 8 |
$ theirs = p3 |
| 9 |
$ tovms :== $ MERCURIAL_ROOT:[vms]tovms |
| 10 |
$ merged = p1 + ".hgmerge" |
| 11 |
$ tovms 'merged' |
| 12 |
$ merged = tmpfn |
| 13 |
$ |
| 14 |
$ define DECC$UNIX_LEVEL 90 |
| 15 |
$ gdiff3 :== $ MERCURIAL_ROOT:[vms]gdiff3 |
| 16 |
$ gdiff == "$ MERCURIAL_ROOT:[VMS]gdiff" |
| 17 |
$! gdiff -u 'orig' 'mine' |
| 18 |
$! gdiff -u 'orig' 'theirs' |
| 19 |
$ if (f$search("''merged'") .nes. "") then - |
| 20 |
delete 'merged';* |
| 21 |
$ define sys$output 'merged' |
| 22 |
$ gdiff3 -"L" mine -"L" original -"L" theirs -"E" -m 'mine' 'orig' 'theirs' |
| 23 |
$ status = $status |
| 24 |
$ deassign sys$output |
| 25 |
$ convert/fdl=mercurial_root:[vms]stmlf.fdl 'merged' 'merged' |
| 26 |
$ purge/nolog 'merged' |
| 27 |
$! No conflicts found. Merge done. |
| 28 |
$ if status .eqs. "%X006C8009" |
| 29 |
$ then |
| 30 |
$ tovms 'p1' |
| 31 |
$ mine = tmpfn |
| 32 |
$ rename 'merged' 'mine' |
| 33 |
$ purge/nolog 'mine' |
| 34 |
$ write sys$output "Merged ''mine'" |
| 35 |
$ exit 1 |
| 36 |
$ endif |
| 37 |
$ |
| 38 |
$! In all other cases, diff3 has found conflicts, added the proper conflict |
| 39 |
$! markers to the merged file and we should now edit this file. Fire up an |
| 40 |
$! editor with the merged file and let the user manually resolve the conflicts. |
| 41 |
$! When the editor exits successfully, there should be no conflict markers in |
| 42 |
$! the merged file, otherwise we consider this merge failed. |
| 43 |
$ |
| 44 |
$ if status .eqs. "%X006C8013" |
| 45 |
$ then |
| 46 |
$ deassign sys$input |
| 47 |
$ edit 'merged' |
| 48 |
$ open fi 'merged' |
| 49 |
$ loop: |
| 50 |
$ read fi srec/end=endloop |
| 51 |
$ rec7 = f$extract(0, 7, srec) |
| 52 |
$ if rec7 .eqs. "<<<<<<<" then goto conflict |
| 53 |
$ if rec7 .eqs. "|||||||" then goto conflict |
| 54 |
$ if rec7 .eqs. "=======" then goto conflict |
| 55 |
$ if rec7 .eqs. ">>>>>>>" then goto conflict |
| 56 |
$ goto loop |
| 57 |
$ endloop: |
| 58 |
$ close fi |
| 59 |
$ tovms 'p1' |
| 60 |
$ mine = tmpfn |
| 61 |
$ rename 'merged' 'mine' |
| 62 |
$ purge/nolog 'mine' |
| 63 |
$ exit |
| 64 |
$ endif |
| 65 |
$ if (f$search("''merged'") .nes. "") then - |
| 66 |
delete 'merged';* |
| 67 |
$ write sys$output "serious diff3 error, while trying to merge ''mine'" |
| 68 |
$ exit 44 |
| 69 |
$ |
| 70 |
$ conflict: |
| 71 |
$ close fi |
| 72 |
$ if (f$search("''merged'") .nes. "") then - |
| 73 |
delete 'merged';* |
| 74 |
$ write sys$output - |
| 75 |
"conflict markers still found in the working-copy. Merge aborted for ''mine'" |
| 76 |
$ exit 44 |