mercurial/patch.py
changeset 24021 f51a822dcf3b
parent 24020 cc81e6da0757
child 24022 da63f557d0dc
equal deleted inserted replaced
24020:cc81e6da0757 24021:f51a822dcf3b
  1751         aprefix = bprefix = ''
  1751         aprefix = bprefix = ''
  1752     else:
  1752     else:
  1753         aprefix = 'a/'
  1753         aprefix = 'a/'
  1754         bprefix = 'b/'
  1754         bprefix = 'b/'
  1755 
  1755 
  1756     def diffline(a, b, revs):
  1756     def diffline(f, revs):
  1757         if not repo.ui.quiet:
  1757         if not repo.ui.quiet:
  1758             if revs:
  1758             if revs:
  1759                 revinfo = ' '.join(["-r %s" % rev for rev in revs])
  1759                 revinfo = ' '.join(["-r %s" % rev for rev in revs])
  1760                 line = 'diff %s %s\n' % (revinfo, a)
  1760                 line = 'diff %s %s\n' % (revinfo, f)
  1761             else:
  1761             else:
  1762                 line = 'diff %s\n' % a
  1762                 line = 'diff %s\n' % f
  1763         else:
  1763         else:
  1764             line = ''
  1764             line = ''
  1765         return line
  1765         return line
  1766 
  1766 
  1767     date1 = util.datestr(ctx1.date())
  1767     date1 = util.datestr(ctx1.date())
  1844 
  1844 
  1845         path1 = posixpath.join(prefix, f1)
  1845         path1 = posixpath.join(prefix, f1)
  1846         path2 = posixpath.join(prefix, f2)
  1846         path2 = posixpath.join(prefix, f2)
  1847         header = []
  1847         header = []
  1848         if revs:
  1848         if revs:
  1849             header.append(diffline(path1, path2, revs))
  1849             header.append(diffline(path1, revs))
  1850         elif opts.git:
  1850         elif opts.git:
  1851             header.append('diff --git %s%s %s%s\n' %
  1851             header.append('diff --git %s%s %s%s\n' %
  1852                           (aprefix, path1, bprefix, path2))
  1852                           (aprefix, path1, bprefix, path2))
  1853             if content1 is None: # added
  1853             if content1 is None: # added
  1854                 header.append('new file mode %s\n' % gitmode[flag2])
  1854                 header.append('new file mode %s\n' % gitmode[flag2])