##// END OF EJS Templates
patch: make _addmodehdr a function under trydiff...
Guillermo Pérez -
r17945:45766e2a default
parent child Browse files
Show More
@@ -1651,18 +1651,17 b' def diffui(*args, **kw):'
1651 '''like diff(), but yields 2-tuples of (output, label) for ui.write()'''
1651 '''like diff(), but yields 2-tuples of (output, label) for ui.write()'''
1652 return difflabel(diff, *args, **kw)
1652 return difflabel(diff, *args, **kw)
1653
1653
1654
1655 def _addmodehdr(header, omode, nmode):
1656 if omode != nmode:
1657 header.append('old mode %s\n' % omode)
1658 header.append('new mode %s\n' % nmode)
1659
1660 def trydiff(repo, revs, ctx1, ctx2, modified, added, removed,
1654 def trydiff(repo, revs, ctx1, ctx2, modified, added, removed,
1661 copy, getfilectx, opts, losedatafn, prefix):
1655 copy, getfilectx, opts, losedatafn, prefix):
1662
1656
1663 def join(f):
1657 def join(f):
1664 return os.path.join(prefix, f)
1658 return os.path.join(prefix, f)
1665
1659
1660 def addmodehdr(header, omode, nmode):
1661 if omode != nmode:
1662 header.append('old mode %s\n' % omode)
1663 header.append('new mode %s\n' % nmode)
1664
1666 def diffline(a, b, revs):
1665 def diffline(a, b, revs):
1667 if opts.git:
1666 if opts.git:
1668 line = 'diff --git a/%s b/%s\n' % (a, b)
1667 line = 'diff --git a/%s b/%s\n' % (a, b)
@@ -1707,7 +1706,7 b' def trydiff(repo, revs, ctx1, ctx2, modi'
1707 else:
1706 else:
1708 a = copyto[f]
1707 a = copyto[f]
1709 omode = gitmode[man1.flags(a)]
1708 omode = gitmode[man1.flags(a)]
1710 _addmodehdr(header, omode, mode)
1709 addmodehdr(header, omode, mode)
1711 if a in removed and a not in gone:
1710 if a in removed and a not in gone:
1712 op = 'rename'
1711 op = 'rename'
1713 gone.add(a)
1712 gone.add(a)
@@ -1753,7 +1752,7 b' def trydiff(repo, revs, ctx1, ctx2, modi'
1753 nflag = ctx2.flags(f)
1752 nflag = ctx2.flags(f)
1754 binary = util.binary(to) or util.binary(tn)
1753 binary = util.binary(to) or util.binary(tn)
1755 if opts.git:
1754 if opts.git:
1756 _addmodehdr(header, gitmode[oflag], gitmode[nflag])
1755 addmodehdr(header, gitmode[oflag], gitmode[nflag])
1757 if binary:
1756 if binary:
1758 dodiff = 'binary'
1757 dodiff = 'binary'
1759 elif binary or nflag != oflag:
1758 elif binary or nflag != oflag:
General Comments 0
You need to be logged in to leave comments. Login now