##// END OF EJS Templates
trydiff: use sets, not lists, for containment checks...
Martin von Zweigbergk -
r23661:dbd60f8d default
parent child Browse files
Show More
@@ -1794,6 +1794,7 b' def trydiff(repo, revs, ctx1, ctx2, modi'
1794 1794 if opts.git:
1795 1795 revs = None
1796 1796
1797 modifiedset, addedset, removedset = set(modified), set(added), set(removed)
1797 1798 for f in sorted(modified + added + removed):
1798 1799 to = None
1799 1800 tn = None
@@ -1801,11 +1802,11 b' def trydiff(repo, revs, ctx1, ctx2, modi'
1801 1802 header = []
1802 1803 if f in man1:
1803 1804 to = getfilectx(f, ctx1).data()
1804 if f not in removed:
1805 if f not in removedset:
1805 1806 tn = getfilectx(f, ctx2).data()
1806 1807 a, b = f, f
1807 1808 if opts.git or losedatafn:
1808 if f in added or (f in modified and to is None):
1809 if f in addedset or (f in modifiedset and to is None):
1809 1810 mode = gitmode[ctx2.flags(f)]
1810 1811 if f in copy or f in copyto:
1811 1812 if opts.git:
@@ -1815,7 +1816,7 b' def trydiff(repo, revs, ctx1, ctx2, modi'
1815 1816 a = copyto[f]
1816 1817 omode = gitmode[man1.flags(a)]
1817 1818 addmodehdr(header, omode, mode)
1818 if a in removed and a not in gone:
1819 if a in removedset and a not in gone:
1819 1820 op = 'rename'
1820 1821 gone.add(a)
1821 1822 else:
@@ -1841,12 +1842,12 b' def trydiff(repo, revs, ctx1, ctx2, modi'
1841 1842 if not opts.git and not tn:
1842 1843 # regular diffs cannot represent new empty file
1843 1844 losedatafn(f)
1844 elif f in removed or (f in modified and tn is None):
1845 elif f in removedset or (f in modifiedset and tn is None):
1845 1846 if opts.git:
1846 1847 # have we already reported a copy above?
1847 if ((f in copy and copy[f] in added
1848 if ((f in copy and copy[f] in addedset
1848 1849 and copyto[copy[f]] == f) or
1849 (f in copyto and copyto[f] in added
1850 (f in copyto and copyto[f] in addedset
1850 1851 and copy[copyto[f]] == f)):
1851 1852 dodiff = False
1852 1853 else:
General Comments 0
You need to be logged in to leave comments. Login now