Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 24104:b6f434729b97
trydiff: set filename variables to None even when not opts.git or losedatafn
There is not much left of the first block "if opts.git or losedatafn"
block now. The next patch will move the call to getfilectx() out of
that block. We will then be using the defined-ness of 'f1' to tell
whether the file existed in ctx1 (and under what name). We will need
this information whether or not opts.git or losedatafn was set, so
just remove that guard. The only operation in the block that is not
cheap is the call to getfilectx(), but that has an extra 'if opts.git'
guard already.
--ignore-space-change proves that only 'if opts.git or losedatafn:'
was removed.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 22 Jan 2015 23:13:48 -0800 |
parents | c666c85f71ba |
children | 0f8baebcdbea |
comparison
equal
deleted
inserted
replaced
24103:c666c85f71ba | 24104:b6f434729b97 |
---|---|
1778 if f not in addedset: | 1778 if f not in addedset: |
1779 content1 = getfilectx(f, ctx1).data() | 1779 content1 = getfilectx(f, ctx1).data() |
1780 if f not in removedset: | 1780 if f not in removedset: |
1781 content2 = getfilectx(f, ctx2).data() | 1781 content2 = getfilectx(f, ctx2).data() |
1782 f1, f2 = f, f | 1782 f1, f2 = f, f |
1783 if opts.git or losedatafn: | 1783 if f in addedset: |
1784 if f in addedset: | 1784 f1 = None |
1785 f1 = None | 1785 if f in copy: |
1786 if f in copy: | |
1787 if opts.git: | |
1788 f1 = copy[f] | |
1789 if f1 in removedset and f1 not in gone: | |
1790 copyop = 'rename' | |
1791 gone.add(f1) | |
1792 else: | |
1793 copyop = 'copy' | |
1794 content1 = getfilectx(f1, ctx1).data() | |
1795 elif f in removedset: | |
1796 f2 = None | |
1797 if opts.git: | 1786 if opts.git: |
1798 # have we already reported a copy above? | 1787 f1 = copy[f] |
1799 if (f in copyto and copyto[f] in addedset | 1788 if f1 in removedset and f1 not in gone: |
1800 and copy[copyto[f]] == f): | 1789 copyop = 'rename' |
1801 continue | 1790 gone.add(f1) |
1791 else: | |
1792 copyop = 'copy' | |
1793 content1 = getfilectx(f1, ctx1).data() | |
1794 elif f in removedset: | |
1795 f2 = None | |
1796 if opts.git: | |
1797 # have we already reported a copy above? | |
1798 if (f in copyto and copyto[f] in addedset | |
1799 and copy[copyto[f]] == f): | |
1800 continue | |
1802 | 1801 |
1803 flag1 = None | 1802 flag1 = None |
1804 flag2 = None | 1803 flag2 = None |
1805 binary = False | 1804 binary = False |
1806 if opts.git or losedatafn: | 1805 if opts.git or losedatafn: |