Mercurial > hg
comparison contrib/hgdiff @ 9136:31177742f54a
for calls expecting bool args, pass bool instead of int
str.splitlines and email.message.as_string both expect a bool argument
defaulting at False: replace f(1) by f(True) and f(0) by f()
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Mon, 13 Jul 2009 09:50:26 +0900 |
parents | f9a80054dd3c |
children |
comparison
equal
deleted
inserted
replaced
9135:df881932362f | 9136:31177742f54a |
---|---|
36 if stat.S_ISREG(st.st_mode): | 36 if stat.S_ISREG(st.st_mode): |
37 names[os.path.join(l, x)] = (st.st_dev, st.st_ino) | 37 names[os.path.join(l, x)] = (st.st_dev, st.st_ino) |
38 | 38 |
39 def diff_files(file1, file2): | 39 def diff_files(file1, file2): |
40 if file1 is None: | 40 if file1 is None: |
41 b = file(file2).read().splitlines(1) | 41 b = file(file2).read().splitlines(True) |
42 l1 = "--- %s\n" % (file2) | 42 l1 = "--- %s\n" % (file2) |
43 l2 = "+++ %s\n" % (file2) | 43 l2 = "+++ %s\n" % (file2) |
44 l3 = "@@ -0,0 +1,%d @@\n" % len(b) | 44 l3 = "@@ -0,0 +1,%d @@\n" % len(b) |
45 l = [l1, l2, l3] + ["+" + e for e in b] | 45 l = [l1, l2, l3] + ["+" + e for e in b] |
46 elif file2 is None: | 46 elif file2 is None: |
47 a = file(file1).read().splitlines(1) | 47 a = file(file1).read().splitlines(True) |
48 l1 = "--- %s\n" % (file1) | 48 l1 = "--- %s\n" % (file1) |
49 l2 = "+++ %s\n" % (file1) | 49 l2 = "+++ %s\n" % (file1) |
50 l3 = "@@ -1,%d +0,0 @@\n" % len(a) | 50 l3 = "@@ -1,%d +0,0 @@\n" % len(a) |
51 l = [l1, l2, l3] + ["-" + e for e in a] | 51 l = [l1, l2, l3] + ["-" + e for e in a] |
52 else: | 52 else: |
53 t1 = file(file1).read() | 53 t1 = file(file1).read() |
54 t2 = file(file2).read() | 54 t2 = file(file2).read() |
55 l1 = t1.splitlines(1) | 55 l1 = t1.splitlines(True) |
56 l2 = t2.splitlines(1) | 56 l2 = t2.splitlines(True) |
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, | 60 l = bunidiff(t1, t2, l1, l2, file1, file2, |
61 diffopts(context=options.context, | 61 diffopts(context=options.context, |