indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers.
REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2624 AFFECTED FILES contrib/perf.py CHANGE DETAILS diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -939,11 +939,16 @@ timer(d) fm.end() -def _bdiffworker(q, ready, done): +def _bdiffworker(q, blocks, xdiff, ready, done): while not done.is_set(): pair = q.get() while pair is not None: - mdiff.textdiff(*pair) + if xdiff: + mdiff.bdiff.xdiffblocks(*pair) + elif blocks: + mdiff.bdiff.blocks(*pair) + else: + mdiff.textdiff(*pair) q.task_done() pair = q.get() q.task_done() # for the None one @@ -954,6 +959,8 @@ ('', 'count', 1, 'number of revisions to test (when using --startrev)'), ('', 'alldata', False, 'test bdiffs for all associated revisions'), ('', 'threads', 0, 'number of thread to use (disable with 0)'), + ('', 'blocks', False, 'test computing diffs into blocks'), + ('', 'xdiff', False, 'use xdiff algorithm'), ], '-c|-m|FILE REV') @@ -969,14 +976,21 @@ measure bdiffs for all changes related to that changeset (manifest and filelogs). """ + opts = pycompat.byteskwargs(opts) + + if opts['xdiff'] and not opts['blocks']: + raise error.CommandError('perfbdiff', '--xdiff requires --blocks') + if opts['alldata']: opts['changelog'] = True if opts.get('changelog') or opts.get('manifest'): file_, rev = None, file_ elif rev is None: raise error.CommandError('perfbdiff', 'invalid arguments') + blocks = opts['blocks'] + xdiff = opts['xdiff'] textpairs = [] r = cmdutil.openrevlog(repo, 'perfbdiff', file_, opts) @@ -1007,15 +1021,21 @@ if not withthreads: def d(): for pair in textpairs: - mdiff.textdiff(*pair) + if xdiff: + mdiff.bdiff.xdiffblocks(*pair) + elif blocks: + mdiff.bdiff.blocks(*pair) + else: + mdiff.textdiff(*pair) else: q = util.queue() for i in xrange(threads): q.put(None) ready = threading.Condition() done = threading.Event() for i in xrange(threads): - threading.Thread(target=_bdiffworker, args=(q, ready, done)).start() + threading.Thread(target=_bdiffworker, + args=(q, blocks, xdiff, ready, done)).start() q.join() def d(): for pair in textpairs: To: indygreg, #hg-reviewers Cc: mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel