##// 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 if opts.git:
1794 if opts.git:
1795 revs = None
1795 revs = None
1796
1796
1797 modifiedset, addedset, removedset = set(modified), set(added), set(removed)
1797 for f in sorted(modified + added + removed):
1798 for f in sorted(modified + added + removed):
1798 to = None
1799 to = None
1799 tn = None
1800 tn = None
@@ -1801,11 +1802,11 b' def trydiff(repo, revs, ctx1, ctx2, modi'
1801 header = []
1802 header = []
1802 if f in man1:
1803 if f in man1:
1803 to = getfilectx(f, ctx1).data()
1804 to = getfilectx(f, ctx1).data()
1804 if f not in removed:
1805 if f not in removedset:
1805 tn = getfilectx(f, ctx2).data()
1806 tn = getfilectx(f, ctx2).data()
1806 a, b = f, f
1807 a, b = f, f
1807 if opts.git or losedatafn:
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 mode = gitmode[ctx2.flags(f)]
1810 mode = gitmode[ctx2.flags(f)]
1810 if f in copy or f in copyto:
1811 if f in copy or f in copyto:
1811 if opts.git:
1812 if opts.git:
@@ -1815,7 +1816,7 b' def trydiff(repo, revs, ctx1, ctx2, modi'
1815 a = copyto[f]
1816 a = copyto[f]
1816 omode = gitmode[man1.flags(a)]
1817 omode = gitmode[man1.flags(a)]
1817 addmodehdr(header, omode, mode)
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 op = 'rename'
1820 op = 'rename'
1820 gone.add(a)
1821 gone.add(a)
1821 else:
1822 else:
@@ -1841,12 +1842,12 b' def trydiff(repo, revs, ctx1, ctx2, modi'
1841 if not opts.git and not tn:
1842 if not opts.git and not tn:
1842 # regular diffs cannot represent new empty file
1843 # regular diffs cannot represent new empty file
1843 losedatafn(f)
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 if opts.git:
1846 if opts.git:
1846 # have we already reported a copy above?
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 and copyto[copy[f]] == f) or
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 and copy[copyto[f]] == f)):
1851 and copy[copyto[f]] == f)):
1851 dodiff = False
1852 dodiff = False
1852 else:
1853 else:
General Comments 0
You need to be logged in to leave comments. Login now