I recently had a similar need, and hacked together a solution with a shell script.
The problem, for me, was that p4 resolve
wants to be interactive, but I just wanted to see the conflicts in a file.
I didn't want to run p4 resolve -f
since that would mark the file as resolved in Perforce.
I just wanted to view the conflicts, maybe email them to someone else, without really doing the resolve. You can do this interactively with the (e)dit
and (s)kip
commands of p4 resolve
, but I wanted a hands-off version.
Save this script as p4-dump-conflicts
:
#!/usr/bin/env bash
function cat_to_file() {
cat "$@" > "$OUTFILE"
}
export -f cat_to_file
destFileName=$(dirname "$1")/CONFLICTS_$(basename "$1")
OUTFILE="$destFileName" P4EDITOR=cat_to_file p4 resolve "$1" <<END_INPUT
e
s
END_INPUT
If you run p4-dump-conflicts myfile
, it will write out CONFLICTS_myfile
, containing the conflict markers. It will leave the file un-resolved in Perforce, though.
Note: Only works for one file, as-is.
For your question in particular, you could process the CONFLICTS_xxx file however you want, then use the results of that for the final merge resolution.