##// END OF EJS Templates
perf: teach perfbdiff to call blocks() and to use xdiff...
Gregory Szorc -
r36784:d382344c default
parent child Browse files
Show More
@@ -939,11 +939,16 b' def perffncacheencode(ui, repo, **opts):'
939 timer(d)
939 timer(d)
940 fm.end()
940 fm.end()
941
941
942 def _bdiffworker(q, ready, done):
942 def _bdiffworker(q, blocks, xdiff, ready, done):
943 while not done.is_set():
943 while not done.is_set():
944 pair = q.get()
944 pair = q.get()
945 while pair is not None:
945 while pair is not None:
946 mdiff.textdiff(*pair)
946 if xdiff:
947 mdiff.bdiff.xdiffblocks(*pair)
948 elif blocks:
949 mdiff.bdiff.blocks(*pair)
950 else:
951 mdiff.textdiff(*pair)
947 q.task_done()
952 q.task_done()
948 pair = q.get()
953 pair = q.get()
949 q.task_done() # for the None one
954 q.task_done() # for the None one
@@ -954,6 +959,8 b' def _bdiffworker(q, ready, done):'
954 ('', 'count', 1, 'number of revisions to test (when using --startrev)'),
959 ('', 'count', 1, 'number of revisions to test (when using --startrev)'),
955 ('', 'alldata', False, 'test bdiffs for all associated revisions'),
960 ('', 'alldata', False, 'test bdiffs for all associated revisions'),
956 ('', 'threads', 0, 'number of thread to use (disable with 0)'),
961 ('', 'threads', 0, 'number of thread to use (disable with 0)'),
962 ('', 'blocks', False, 'test computing diffs into blocks'),
963 ('', 'xdiff', False, 'use xdiff algorithm'),
957 ],
964 ],
958
965
959 '-c|-m|FILE REV')
966 '-c|-m|FILE REV')
@@ -969,6 +976,11 b' def perfbdiff(ui, repo, file_, rev=None,'
969 measure bdiffs for all changes related to that changeset (manifest
976 measure bdiffs for all changes related to that changeset (manifest
970 and filelogs).
977 and filelogs).
971 """
978 """
979 opts = pycompat.byteskwargs(opts)
980
981 if opts['xdiff'] and not opts['blocks']:
982 raise error.CommandError('perfbdiff', '--xdiff requires --blocks')
983
972 if opts['alldata']:
984 if opts['alldata']:
973 opts['changelog'] = True
985 opts['changelog'] = True
974
986
@@ -977,6 +989,8 b' def perfbdiff(ui, repo, file_, rev=None,'
977 elif rev is None:
989 elif rev is None:
978 raise error.CommandError('perfbdiff', 'invalid arguments')
990 raise error.CommandError('perfbdiff', 'invalid arguments')
979
991
992 blocks = opts['blocks']
993 xdiff = opts['xdiff']
980 textpairs = []
994 textpairs = []
981
995
982 r = cmdutil.openrevlog(repo, 'perfbdiff', file_, opts)
996 r = cmdutil.openrevlog(repo, 'perfbdiff', file_, opts)
@@ -1007,7 +1021,12 b' def perfbdiff(ui, repo, file_, rev=None,'
1007 if not withthreads:
1021 if not withthreads:
1008 def d():
1022 def d():
1009 for pair in textpairs:
1023 for pair in textpairs:
1010 mdiff.textdiff(*pair)
1024 if xdiff:
1025 mdiff.bdiff.xdiffblocks(*pair)
1026 elif blocks:
1027 mdiff.bdiff.blocks(*pair)
1028 else:
1029 mdiff.textdiff(*pair)
1011 else:
1030 else:
1012 q = util.queue()
1031 q = util.queue()
1013 for i in xrange(threads):
1032 for i in xrange(threads):
@@ -1015,7 +1034,8 b' def perfbdiff(ui, repo, file_, rev=None,'
1015 ready = threading.Condition()
1034 ready = threading.Condition()
1016 done = threading.Event()
1035 done = threading.Event()
1017 for i in xrange(threads):
1036 for i in xrange(threads):
1018 threading.Thread(target=_bdiffworker, args=(q, ready, done)).start()
1037 threading.Thread(target=_bdiffworker,
1038 args=(q, blocks, xdiff, ready, done)).start()
1019 q.join()
1039 q.join()
1020 def d():
1040 def d():
1021 for pair in textpairs:
1041 for pair in textpairs:
General Comments 0
You need to be logged in to leave comments. Login now