merge: do early copy to deal with issue636
Without copies/renames, merges source names are 1:1 with their
targets. Copies and renames introduce the possibility that there will
be two merges with the same input but different output. By doing the
copy to the destination name before the merge, the actual merge
becomes 1:1 again, and no source is the input to two different merges.
- add a preliminary scan to applyupdates to do copies
- for the merge action, pass the old name (for finding ancestors) and
the new name (for input to the merge) to filemerge
- eliminate the old post-merge copy
- lookup file contents from new name in filemerge
- pass new name to external merge helper
- report merge failure at new name
- add a test
#!/usr/bin/env python
"""Test the running system for features availability. Exit with zero
if all features are there, non-zero otherwise.
"""
import optparse
import os
import sys
def has_symlink():
return hasattr(os, "symlink")
checks = {
"symlink": (has_symlink, "symbolic links"),
}
def list_features():
for name, feature in checks.iteritems():
desc = feature[1]
print name + ':', desc
parser = optparse.OptionParser("%prog [options] [features]")
parser.add_option("--list-features", action="store_true",
help="list available features")
parser.add_option("-q", "--quiet", action="store_true",
help="check features silently")
if __name__ == '__main__':
options, args = parser.parse_args()
if options.list_features:
list_features()
sys.exit(0)
quiet = options.quiet
failures = 0
def error(msg):
global failures
if not quiet:
sys.stderr.write(msg + '\n')
failures += 1
for feature in args:
if feature not in checks:
error('hghave: unknown feature: ' + feature)
continue
check, desc = checks[feature]
if not check():
error('hghave: missing feature: ' + desc)
if failures != 0:
sys.exit(1)