[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacsclient as svn mergetool
From: |
Joakim Jalap |
Subject: |
emacsclient as svn mergetool |
Date: |
Mon, 16 Nov 2015 13:37:22 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Hello,
I'm trying to use emacsclient as a mergetool in svn. I use the following
script as the value of svn:mergetool:
#!/bin/sh
run_emacs_cmd() {
emacsclient $C_OR_T --eval "$EVALSTR" 2>&1
}
run_diff2() {
EVALSTR="(ediff-files \"$1\" \"$2\")"
run_emacs_cmd
}
run_diff3() {
EVALSTR="(ediff-files3 \"$1\" \"$2\" \"$3\")"
run_emacs_cmd
}
run_merge() {
EVALSTR="(ediff-merge-files-with-ancestor \"$3\" \"$2\" \"$1\" nil \"$4\")"
run_emacs_cmd
}
# Are we running in X?
if [ -z "$DISPLAY" ]; then
C_OR_T="-t"
else
C_OR_T="-c"
fi
case ${#} in
3)
run_diff2 "$1" "$2";;
4)
run_diff3 "$1" "$2" "$3";;
5)
run_merge "$1" "$2" "$3" "$4";;
*)
echo "Usage ${0} [FILE1 FILE2] [FILE1 BASE FILE2] [BASE THEIRS MINE MERGED]"
exit 1
;;
esac
if [ ! $(egrep -c '^(<<<<<<<|=======|>>>>>>>|####### Ancestor)' ${_MERGED}) = 0
]; then
_MERGEDSAVE=$(${_MKTEMP} --tmpdir `${_BASENAME} ${_MERGED}`.XXXXXXXXXX)
${_CP} ${_MERGED} ${_MERGEDSAVE}
echo 1>&2 "Oops! Conflict markers detected in $_MERGED."
echo 1>&2 "Saved your changes to ${_MERGEDSAVE}"
echo 1>&2 "Exiting with code 1."
exit 1
fi
exit 0
It works pretty well in that running 'svn resolve' actually opens an
ediff merge session in a new emacsclient. The problem is when I'm done
with the merge. I quit the ediff merge session, but when I try to close
the client with C-x # it says "No server buffers remain to edit". If I
kill the client with C-x C-c, I'm returned to the terminal I ran 'svn
merge' from, but it seems the client hasn't actually exited, since I get
no prompt.
So now I can kill the client with C-c from the terminal, unfortunately
this means that svn thinks the merge failed, since the exit status is
not 0 (I presume). So then I have to run 'svn merge' again, and now mark
the conflict as resolved.
So my question is: how do I make 'emacsclient -c --eval
(ediff-merge-files-with-ancestor ...)' return? I would like to do my
merging, quit the ediff session, and then simply type C-x # or something
like that to quit the client and return to svn. Does anybody know how?
Does anybody else use emacsclient as svn mergetool?
TIA
Joakim
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacsclient as svn mergetool,
Joakim Jalap <=