Mercurial > hg
view contrib/simplemerge @ 9925:9dfe34bf42c7
findrenames: first loop over the removed files, it's faster
Getting the file from the working dir is less expensive than getting it from
the repo history, hence the speedup.
benchmarked on crew repo with:
rm -rf * ; hg up -C ; for i in `find . -name "*.py"` ; do mv $i $i.new;done
followed by:
hg addremove -s 100
before: Time: real 68.760 secs (user 65.760+0.000 sys 2.490+0.000)
after : Time: real 28.890 secs (user 26.920+0.000 sys 1.450+0.000)
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Tue, 24 Nov 2009 17:26:42 +0100 |
parents | bb9f13974d8e |
children | 659f34b833b9 |
line wrap: on
line source
#!/usr/bin/env python from mercurial import demandimport demandimport.enable() import os, sys from mercurial.i18n import _ from mercurial import simplemerge, fancyopts, util, ui options = [('L', 'label', [], _('labels to use on conflict markers')), ('a', 'text', None, _('treat all files as text')), ('p', 'print', None, _('print results instead of overwriting LOCAL')), ('', 'no-minimal', None, _('do not try to minimize conflict regions')), ('h', 'help', None, _('display help and exit')), ('q', 'quiet', None, _('suppress output'))] usage = _('''simplemerge [OPTS] LOCAL BASE OTHER Simple three-way file merge utility with a minimal feature set. Apply to LOCAL the changes necessary to go from BASE to OTHER. By default, LOCAL is overwritten with the results of this operation. ''') class ParseError(Exception): """Exception raised on errors in parsing the command line.""" def showhelp(): sys.stdout.write(usage) sys.stdout.write('\noptions:\n') out_opts = [] for shortopt, longopt, default, desc in options: out_opts.append(('%2s%s' % (shortopt and '-%s' % shortopt, longopt and ' --%s' % longopt), '%s' % desc)) opts_len = max([len(opt[0]) for opt in out_opts]) for first, second in out_opts: sys.stdout.write(' %-*s %s\n' % (opts_len, first, second)) try: for fp in (sys.stdin, sys.stdout, sys.stderr): util.set_binary(fp) opts = {} try: args = fancyopts.fancyopts(sys.argv[1:], options, opts) except fancyopts.getopt.GetoptError, e: raise ParseError(e) if opts['help']: showhelp() sys.exit(0) if len(args) != 3: raise ParseError(_('wrong number of arguments')) sys.exit(simplemerge.simplemerge(ui.ui(), *args, **opts)) except ParseError, e: sys.stdout.write("%s: %s\n" % (sys.argv[0], e)) showhelp() sys.exit(1) except util.Abort, e: sys.stderr.write("abort: %s\n" % e) sys.exit(255) except KeyboardInterrupt: sys.exit(255)