Mercurial > hg
comparison mercurial/patch.py @ 23752:70d8be6299ab
trydiff: make addindexmeta() unconditionally add index meta
The conditional-ness is not clear from the name and there is only one
caller, so it's clearer to check on the call site. Moving it also
makes addindexmeta() no longer close on the 'opts' variable.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 07 Jan 2015 08:54:26 -0800 |
parents | 30c6e85aac77 |
children | e30c6aa6f2a2 |
comparison
equal
deleted
inserted
replaced
23751:30c6e85aac77 | 23752:70d8be6299ab |
---|---|
1746 if omode != nmode: | 1746 if omode != nmode: |
1747 header.append('old mode %s\n' % omode) | 1747 header.append('old mode %s\n' % omode) |
1748 header.append('new mode %s\n' % nmode) | 1748 header.append('new mode %s\n' % nmode) |
1749 | 1749 |
1750 def addindexmeta(meta, oindex, nindex): | 1750 def addindexmeta(meta, oindex, nindex): |
1751 if opts.git: | 1751 meta.append('index %s..%s\n' % (oindex, nindex)) |
1752 meta.append('index %s..%s\n' % (oindex, nindex)) | |
1753 | 1752 |
1754 def gitindex(text): | 1753 def gitindex(text): |
1755 if not text: | 1754 if not text: |
1756 text = "" | 1755 text = "" |
1757 l = len(text) | 1756 l = len(text) |
1873 if dodiff: | 1872 if dodiff: |
1874 if opts.git or revs: | 1873 if opts.git or revs: |
1875 header.insert(0, diffline(join(a), join(b), revs)) | 1874 header.insert(0, diffline(join(a), join(b), revs)) |
1876 if dodiff == 'binary' and not opts.nobinary: | 1875 if dodiff == 'binary' and not opts.nobinary: |
1877 text = mdiff.b85diff(to, tn) | 1876 text = mdiff.b85diff(to, tn) |
1878 if text: | 1877 if text and opts.git: |
1879 addindexmeta(header, gitindex(to), gitindex(tn)) | 1878 addindexmeta(header, gitindex(to), gitindex(tn)) |
1880 else: | 1879 else: |
1881 text = mdiff.unidiff(to, date1, | 1880 text = mdiff.unidiff(to, date1, |
1882 tn, date2, | 1881 tn, date2, |
1883 join(a), join(b), opts=opts) | 1882 join(a), join(b), opts=opts) |