1796 addedset.add(f) |
1796 addedset.add(f) |
1797 modifiedset.remove(f) |
1797 modifiedset.remove(f) |
1798 for f in sorted(modified + added + removed): |
1798 for f in sorted(modified + added + removed): |
1799 to = None |
1799 to = None |
1800 tn = None |
1800 tn = None |
1801 dodiff = True |
1801 binarydiff = False |
1802 header = [] |
1802 header = [] |
1803 if f not in addedset: |
1803 if f not in addedset: |
1804 to = getfilectx(f, ctx1).data() |
1804 to = getfilectx(f, ctx1).data() |
1805 if f not in removedset: |
1805 if f not in removedset: |
1806 tn = getfilectx(f, ctx2).data() |
1806 tn = getfilectx(f, ctx2).data() |
1852 continue |
1852 continue |
1853 else: |
1853 else: |
1854 header.append('deleted file mode %s\n' % |
1854 header.append('deleted file mode %s\n' % |
1855 gitmode[ctx1.flags(f)]) |
1855 gitmode[ctx1.flags(f)]) |
1856 if util.binary(to): |
1856 if util.binary(to): |
1857 dodiff = 'binary' |
1857 binarydiff = True |
1858 elif not to or util.binary(to): |
1858 elif not to or util.binary(to): |
1859 # regular diffs cannot represent empty file deletion |
1859 # regular diffs cannot represent empty file deletion |
1860 losedatafn(f) |
1860 losedatafn(f) |
1861 else: |
1861 else: |
1862 oflag = ctx1.flags(f) |
1862 oflag = ctx1.flags(f) |
1863 nflag = ctx2.flags(f) |
1863 nflag = ctx2.flags(f) |
1864 binary = util.binary(to) or util.binary(tn) |
1864 binary = util.binary(to) or util.binary(tn) |
1865 if opts.git: |
1865 if opts.git: |
1866 addmodehdr(header, gitmode[oflag], gitmode[nflag]) |
1866 addmodehdr(header, gitmode[oflag], gitmode[nflag]) |
1867 if binary: |
1867 if binary: |
1868 dodiff = 'binary' |
1868 binarydiff = True |
1869 elif binary or nflag != oflag: |
1869 elif binary or nflag != oflag: |
1870 losedatafn(f) |
1870 losedatafn(f) |
1871 |
1871 |
1872 if opts.git or revs: |
1872 if opts.git or revs: |
1873 header.insert(0, diffline(join(a), join(b), revs)) |
1873 header.insert(0, diffline(join(a), join(b), revs)) |
1874 if dodiff == 'binary' and not opts.nobinary: |
1874 if binarydiff and not opts.nobinary: |
1875 text = mdiff.b85diff(to, tn) |
1875 text = mdiff.b85diff(to, tn) |
1876 if text and opts.git: |
1876 if text and opts.git: |
1877 addindexmeta(header, gitindex(to), gitindex(tn)) |
1877 addindexmeta(header, gitindex(to), gitindex(tn)) |
1878 else: |
1878 else: |
1879 text = mdiff.unidiff(to, date1, |
1879 text = mdiff.unidiff(to, date1, |