##// END OF EJS Templates
trydiff: collect all lossiness checks in one place...
Martin von Zweigbergk -
r24057:696d0fd7 default
parent child Browse files
Show More
@@ -1796,17 +1796,7 b' def trydiff(repo, revs, ctx1, ctx2, modi'
1796 else:
1796 else:
1797 copyop = 'copy'
1797 copyop = 'copy'
1798 content1 = getfilectx(f1, ctx1).data()
1798 content1 = getfilectx(f1, ctx1).data()
1799 else:
1800 losedatafn(f)
1801 else:
1802 if not opts.git and flag2:
1803 losedatafn(f)
1804 binary = util.binary(content1) or util.binary(content2)
1799 binary = util.binary(content1) or util.binary(content2)
1805 if not opts.git and binary:
1806 losedatafn(f)
1807 if not opts.git and not content2:
1808 # regular diffs cannot represent new empty file
1809 losedatafn(f)
1810 elif f in removedset:
1800 elif f in removedset:
1811 if opts.git:
1801 if opts.git:
1812 # have we already reported a copy above?
1802 # have we already reported a copy above?
@@ -1818,14 +1808,24 b' def trydiff(repo, revs, ctx1, ctx2, modi'
1818 binary = util.binary(content1)
1808 binary = util.binary(content1)
1819 else:
1809 else:
1820 binary = util.binary(content1)
1810 binary = util.binary(content1)
1821 if not content1 or binary:
1822 # regular diffs cannot represent empty file deletion
1823 losedatafn(f)
1824 else:
1811 else:
1825 flag1 = ctx1.flags(f)
1812 flag1 = ctx1.flags(f)
1826 flag2 = ctx2.flags(f)
1813 flag2 = ctx2.flags(f)
1827 binary = util.binary(content1) or util.binary(content2)
1814 binary = util.binary(content1) or util.binary(content2)
1828 if not opts.git and (binary or flag2 != flag1):
1815
1816 if losedatafn and not opts.git:
1817 if (binary or
1818 # copy/rename
1819 f in copy or
1820 # empty file creation
1821 (content1 is None and not content2) or
1822 # empty file deletion
1823 (not content1 and content2 is None) or
1824 # create with flags
1825 (content1 is None and flag2) or
1826 # change flags
1827 (content1 is not None and content2 is not None and
1828 flag1 != flag2)):
1829 losedatafn(f)
1829 losedatafn(f)
1830
1830
1831 path1 = posixpath.join(prefix, f1)
1831 path1 = posixpath.join(prefix, f1)
General Comments 0
You need to be logged in to leave comments. Login now