Mercurial > hg > mercurial-crew-with-dirclash
comparison contrib/hgdiff @ 3398:0f308690bda8
Fixed contrib/hgdiff script to pass diffopts in the new format.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Sun, 15 Oct 2006 20:56:38 +0200 |
parents | e7e6504c4989 |
children | ea7b982b6c08 |
comparison
equal
deleted
inserted
replaced
3397:f0415b61949d | 3398:0f308690bda8 |
---|---|
3 import os, sys, struct, stat | 3 import os, sys, struct, stat |
4 import difflib | 4 import difflib |
5 import re | 5 import re |
6 from optparse import OptionParser | 6 from optparse import OptionParser |
7 from mercurial.bdiff import bdiff, blocks | 7 from mercurial.bdiff import bdiff, blocks |
8 from mercurial.mdiff import bunidiff | 8 from mercurial.mdiff import bunidiff, diffopts |
9 | 9 |
10 VERSION="0.2" | 10 VERSION="0.3" |
11 usage = "usage: %prog [options] file1 file2" | 11 usage = "usage: %prog [options] file1 file2" |
12 parser = OptionParser(usage=usage) | 12 parser = OptionParser(usage=usage) |
13 | 13 |
14 parser.add_option("-d", "--difflib", action="store_true", default=False) | 14 parser.add_option("-d", "--difflib", action="store_true", default=False) |
15 parser.add_option('-x', '--count', default=1) | 15 parser.add_option('-x', '--count', default=1) |
55 l1 = t1.splitlines(1) | 55 l1 = t1.splitlines(1) |
56 l2 = t2.splitlines(1) | 56 l2 = t2.splitlines(1) |
57 if options.difflib: | 57 if options.difflib: |
58 l = difflib.unified_diff(l1, l2, file1, file2) | 58 l = difflib.unified_diff(l1, l2, file1, file2) |
59 else: | 59 else: |
60 l = bunidiff(t1, t2, l1, l2, file1, file2, context=options.context, | 60 l = bunidiff(t1, t2, l1, l2, file1, file2, |
61 showfunc=options.show_c_function, | 61 diffopts(context=options.context, |
62 ignorews=options.ignore_all_space) | 62 showfunc=options.show_c_function, |
63 ignorews=options.ignore_all_space)) | |
63 for x in l: | 64 for x in l: |
64 if x[-1] != '\n': | 65 if x[-1] != '\n': |
65 x += "\n\ No newline at end of file\n" | 66 x += "\n\ No newline at end of file\n" |
66 print x, | 67 print x, |
67 | 68 |