# Different three-way merge tools below. Uncomment the preferred one.
# Note that the 'output' file contains the same data as 'branch1'. This
# is useful for tools that do not take an output parameter
-merger: diff3 -L local -L older -L remote -m -E \
+merger: diff3 -L current -L ancestor -L patched -m -E \
"%(branch1)s" "%(ancestor)s" "%(branch2)s" > "%(output)s"
-#merger: xxdiff --title1 local --title2 older --title3 remote \
+#merger: xxdiff --title1 current --title2 ancestor --title3 patched \
# --show-merged-pane -m -E -O -X -M "%(output)s" \
# "%(branch1)s" "%(ancestor)s" "%(branch2)s"
# Leave the original files in the working tree in case of a merge conflict
keeporig: yes
+
+# Extensions for the files involved in a three-way merge (ancestor,
+# current, patched)
+#extensions: .ancestor .current .patched
from stgit.utils import *
from stgit import stack, git, basedir
+from stgit.config import config, file_extensions
crt_series = None
def resolved(filename, reset = None):
if reset:
- reset_file = filename + '.' + reset
+ reset_file = filename + file_extensions()[reset]
if os.path.isfile(reset_file):
if os.path.isfile(filename):
os.remove(filename)
git.update_cache([filename], force = True)
- for ext in ['.local', '.older', '.remote']:
+ for ext in file_extensions().values():
fn = filename + ext
if os.path.isfile(fn):
os.remove(fn)
from stgit.commands.common import *
from stgit.utils import *
from stgit import stack, git, basedir
+from stgit.config import file_extensions
help = 'mark a file conflict as solved'
Mark a merge conflict as resolved. The conflicts can be seen with the
'status' command, the corresponding files being prefixed with a
-'C'. This command also removes any <file>.{local,remote,older} files."""
+'C'. This command also removes any <file>.{ancestor,current,patched}
+files."""
options = [make_option('-a', '--all',
help = 'mark all conflicts as solved',
action = 'store_true'),
- make_option('-r', '--reset', metavar = '(local|remote|older)',
+ make_option('-r', '--reset', metavar = '(ancestor|current|patched)',
help = 'reset the file(s) to the given state')]
def func(parser, options, args):
"""Mark the conflict as resolved
"""
- if options.reset and options.reset not in ['local', 'remote', 'older']:
+ if options.reset \
+ and options.reset not in file_extensions():
raise CmdException, 'Unknown reset state: %s' % options.reset
if options.all:
config.set('stgit', 'smtpserver', 'localhost:25')
config.set('stgit', 'smtpdelay', '2')
config.set('stgit', 'merger',
- 'diff3 -L local -L older -L remote -m -E ' \
+ 'diff3 -L current -L ancestor -L patched -m -E ' \
'"%(branch1)s" "%(ancestor)s" "%(branch2)s" > "%(output)s"')
config.set('stgit', 'keeporig', 'yes')
+config.set('stgit', 'extensions', '.ancestor .current .patched')
# Read the configuration files (if any) and override the default settings
config.read('/etc/stgitrc')
if config.has_section('gitmergeonefile'):
for option, value in config.items('gitmergeonefile'):
config.set('stgit', option, value)
+
+
+# cached extensions
+__extensions = None
+
+def file_extensions():
+ """Returns a dictionary with the conflict file extensions
+ """
+ global __extensions
+
+ if not __extensions:
+ cfg_ext = config.get('stgit', 'extensions').split()
+ if len(cfg_ext) != 3:
+ raise CmdException, '"extensions" configuration error'
+
+ __extensions = { 'ancestor': cfg_ext[0],
+ 'current': cfg_ext[1],
+ 'patched': cfg_ext[2] }
+
+ return __extensions
import sys, os
from stgit import basedir
-from stgit.config import config
+from stgit.config import config, file_extensions
from stgit.utils import append_string
global orig, src1, src2
if orig_hash:
- orig = '%s.older' % path
+ orig = path + file_extensions()['ancestor']
tmp = __output('git-unpack-file %s' % orig_hash)
os.chmod(tmp, int(orig_mode, 8))
os.renames(tmp, orig)
if file1_hash:
- src1 = '%s.local' % path
+ src1 = path + file_extensions()['current']
tmp = __output('git-unpack-file %s' % file1_hash)
os.chmod(tmp, int(file1_mode, 8))
os.renames(tmp, src1)
if file2_hash:
- src2 = '%s.remote' % path
+ src2 = path + file_extensions()['patched']
tmp = __output('git-unpack-file %s' % file2_hash)
os.chmod(tmp, int(file2_mode, 8))
os.renames(tmp, src2)