Show More
@@ -939,11 +939,16 b' def perffncacheencode(ui, repo, **opts):' | |||
|
939 | 939 | timer(d) |
|
940 | 940 | fm.end() |
|
941 | 941 | |
|
942 | def _bdiffworker(q, ready, done): | |
|
942 | def _bdiffworker(q, blocks, xdiff, ready, done): | |
|
943 | 943 | while not done.is_set(): |
|
944 | 944 | pair = q.get() |
|
945 | 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 | 952 | q.task_done() |
|
948 | 953 | pair = q.get() |
|
949 | 954 | q.task_done() # for the None one |
@@ -954,6 +959,8 b' def _bdiffworker(q, ready, done):' | |||
|
954 | 959 | ('', 'count', 1, 'number of revisions to test (when using --startrev)'), |
|
955 | 960 | ('', 'alldata', False, 'test bdiffs for all associated revisions'), |
|
956 | 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 | 966 | '-c|-m|FILE REV') |
@@ -969,6 +976,11 b' def perfbdiff(ui, repo, file_, rev=None,' | |||
|
969 | 976 | measure bdiffs for all changes related to that changeset (manifest |
|
970 | 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 | 984 | if opts['alldata']: |
|
973 | 985 | opts['changelog'] = True |
|
974 | 986 | |
@@ -977,6 +989,8 b' def perfbdiff(ui, repo, file_, rev=None,' | |||
|
977 | 989 | elif rev is None: |
|
978 | 990 | raise error.CommandError('perfbdiff', 'invalid arguments') |
|
979 | 991 | |
|
992 | blocks = opts['blocks'] | |
|
993 | xdiff = opts['xdiff'] | |
|
980 | 994 | textpairs = [] |
|
981 | 995 | |
|
982 | 996 | r = cmdutil.openrevlog(repo, 'perfbdiff', file_, opts) |
@@ -1007,7 +1021,12 b' def perfbdiff(ui, repo, file_, rev=None,' | |||
|
1007 | 1021 | if not withthreads: |
|
1008 | 1022 | def d(): |
|
1009 | 1023 | for pair in textpairs: |
|
1010 |
|
|
|
1024 | if xdiff: | |
|
1025 | mdiff.bdiff.xdiffblocks(*pair) | |
|
1026 | elif blocks: | |
|
1027 | mdiff.bdiff.blocks(*pair) | |
|
1028 | else: | |
|
1029 | mdiff.textdiff(*pair) | |
|
1011 | 1030 | else: |
|
1012 | 1031 | q = util.queue() |
|
1013 | 1032 | for i in xrange(threads): |
@@ -1015,7 +1034,8 b' def perfbdiff(ui, repo, file_, rev=None,' | |||
|
1015 | 1034 | ready = threading.Condition() |
|
1016 | 1035 | done = threading.Event() |
|
1017 | 1036 | for i in xrange(threads): |
|
1018 |
threading.Thread(target=_bdiffworker, |
|
|
1037 | threading.Thread(target=_bdiffworker, | |
|
1038 | args=(q, blocks, xdiff, ready, done)).start() | |
|
1019 | 1039 | q.join() |
|
1020 | 1040 | def d(): |
|
1021 | 1041 | for pair in textpairs: |
General Comments 0
You need to be logged in to leave comments.
Login now