2
# -*- coding:utf-8;mode:shell-script;mode:font-lock -*-
5
# Resolve Subversion conflicts using FileMerge.
7
# (FileMerge is a graphical diff tool in the Mac OS X Developer
10
# In your working copy, do (for example):
14
# FileMerge will open a window for each file that is in a conflict
15
# state, showing you diffs with the left/right arrows pointing to the
16
# side of each change that is selected. Diffs with gray outlines are
17
# automatically resolved. Diffs with red outlines are the conflicts.
18
# Find those and select which side you want, or pull up the split view
19
# at he bottom and edit the text to what it should be.
21
# Copyright (c) 2002 Wilfredo Sanchez Vega <wsanchez@wsanchez.net>.
22
# All rights reserved.
24
# Permission to use, copy, modify, and distribute this software for
25
# any purpose with or without fee is hereby granted, provided that the
26
# above copyright notice, this permission, and the following
27
# disclaimer notice appear in all copies.
29
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL
30
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
31
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
32
# AUTHORS BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
33
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
34
# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
35
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
36
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
48
program=$(basename "$0");
50
if [ $# != 0 ]; then echo "$@"; echo ""; fi;
52
echo "${program}: usage:";
53
echo " ${program} file1 [file2 ...]";
72
# If opendiff isn't installed, you can't launch FileMerge.
73
# If we're not in the OS X Terminal, we probably can't run FileMerge
75
if ! type opendiff >& /dev/null || [ "${TERM_PROGRAM:=}" != "Apple_Terminal" ]; then
84
local revision=$(svn info "${conflict}" | grep '^Revision: ' | sed 's|^Revision: ||');
86
local left="${conflict}.mine";
87
local right="${conflict}.r${revision}";
90
for file in $(ls "${conflict}".r*); do
91
if [ "${file}" != "${right}" ]; then
92
if [ -n "${ancestor}" ]; then
93
echo "ERROR: Multiple possible ancestor files exist for file: ${conflict}";
100
for file in "${left}" "${right}" "${ancestor}"; do
101
if [ ! -f "${file}" ]; then
102
echo "ERROR: Missing file: ${file}";
107
opendiff "${left}" "${right}" -ancestor "${ancestor}" -merge "${conflict}";
111
for conflict in $(svn status . | grep '^C' | sed 's|^C......||'); do
112
resolve "${conflict}";