Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 17943:66b9832331c9
diff: swap and simplify diffline args
Args order swapped, since a, b are more important than revs
(which is only used on non-git format), and change to read opts
from context.
author | Guillermo P?rez <bisho@fb.com> |
---|---|
date | Thu, 15 Nov 2012 13:52:51 -0800 |
parents | 5e655418aa8d |
children | 7ac2a7720724 |
comparison
equal
deleted
inserted
replaced
17942:5e655418aa8d | 17943:66b9832331c9 |
---|---|
1661 copy, getfilectx, opts, losedatafn, prefix): | 1661 copy, getfilectx, opts, losedatafn, prefix): |
1662 | 1662 |
1663 def join(f): | 1663 def join(f): |
1664 return os.path.join(prefix, f) | 1664 return os.path.join(prefix, f) |
1665 | 1665 |
1666 def diffline(revs, a, b, opts): | 1666 def diffline(a, b, revs): |
1667 if repo.ui.quiet and not opts.git: | 1667 if repo.ui.quiet and not opts.git: |
1668 return '' | 1668 return '' |
1669 parts = ['diff'] | 1669 parts = ['diff'] |
1670 if opts.git: | 1670 if opts.git: |
1671 parts.append('--git') | 1671 parts.append('--git') |
1761 elif binary or nflag != oflag: | 1761 elif binary or nflag != oflag: |
1762 losedatafn(f) | 1762 losedatafn(f) |
1763 | 1763 |
1764 if dodiff: | 1764 if dodiff: |
1765 if opts.git or revs: | 1765 if opts.git or revs: |
1766 header.insert(0, diffline(revs, join(a), join(b), opts)) | 1766 header.insert(0, diffline(join(a), join(b), revs)) |
1767 if dodiff == 'binary': | 1767 if dodiff == 'binary': |
1768 text = mdiff.b85diff(to, tn) | 1768 text = mdiff.b85diff(to, tn) |
1769 else: | 1769 else: |
1770 text = mdiff.unidiff(to, date1, | 1770 text = mdiff.unidiff(to, date1, |
1771 # ctx2 date may be dynamic | 1771 # ctx2 date may be dynamic |