Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 23665:a90499a6ad8d
trydiff: use 'ctx1.flags()' for symmetry with 'ctx2.flags()'
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 23 Dec 2014 16:16:26 -0800 |
parents | 377124ba6b10 |
children | e864353f8c6b |
comparison
equal
deleted
inserted
replaced
23664:377124ba6b10 | 23665:a90499a6ad8d |
---|---|
1783 line = '' | 1783 line = '' |
1784 return line | 1784 return line |
1785 | 1785 |
1786 date1 = util.datestr(ctx1.date()) | 1786 date1 = util.datestr(ctx1.date()) |
1787 date2 = util.datestr(ctx2.date()) | 1787 date2 = util.datestr(ctx2.date()) |
1788 man1 = ctx1.manifest() | |
1789 | 1788 |
1790 gone = set() | 1789 gone = set() |
1791 gitmode = {'l': '120000', 'x': '100755', '': '100644'} | 1790 gitmode = {'l': '120000', 'x': '100755', '': '100644'} |
1792 | 1791 |
1793 copyto = dict([(v, k) for k, v in copy.items()]) | 1792 copyto = dict([(v, k) for k, v in copy.items()]) |
1819 if opts.git: | 1818 if opts.git: |
1820 if f in copy: | 1819 if f in copy: |
1821 a = copy[f] | 1820 a = copy[f] |
1822 else: | 1821 else: |
1823 a = copyto[f] | 1822 a = copyto[f] |
1824 omode = gitmode[man1.flags(a)] | 1823 omode = gitmode[ctx1.flags(a)] |
1825 addmodehdr(header, omode, mode) | 1824 addmodehdr(header, omode, mode) |
1826 if a in removedset and a not in gone: | 1825 if a in removedset and a not in gone: |
1827 op = 'rename' | 1826 op = 'rename' |
1828 gone.add(a) | 1827 gone.add(a) |
1829 else: | 1828 else: |
1857 (f in copyto and copyto[f] in addedset | 1856 (f in copyto and copyto[f] in addedset |
1858 and copy[copyto[f]] == f)): | 1857 and copy[copyto[f]] == f)): |
1859 dodiff = False | 1858 dodiff = False |
1860 else: | 1859 else: |
1861 header.append('deleted file mode %s\n' % | 1860 header.append('deleted file mode %s\n' % |
1862 gitmode[man1.flags(f)]) | 1861 gitmode[ctx1.flags(f)]) |
1863 if util.binary(to): | 1862 if util.binary(to): |
1864 dodiff = 'binary' | 1863 dodiff = 'binary' |
1865 elif not to or util.binary(to): | 1864 elif not to or util.binary(to): |
1866 # regular diffs cannot represent empty file deletion | 1865 # regular diffs cannot represent empty file deletion |
1867 losedatafn(f) | 1866 losedatafn(f) |
1868 else: | 1867 else: |
1869 oflag = man1.flags(f) | 1868 oflag = ctx1.flags(f) |
1870 nflag = ctx2.flags(f) | 1869 nflag = ctx2.flags(f) |
1871 binary = util.binary(to) or util.binary(tn) | 1870 binary = util.binary(to) or util.binary(tn) |
1872 if opts.git: | 1871 if opts.git: |
1873 addmodehdr(header, gitmode[oflag], gitmode[nflag]) | 1872 addmodehdr(header, gitmode[oflag], gitmode[nflag]) |
1874 if binary: | 1873 if binary: |