mercurial/patch.py
changeset 16683 525fdb738975
parent 16662 ea7bf1d49bce
child 16686 67964cda8701
equal deleted inserted replaced
16676:654b9e1966f7 16683:525fdb738975
   856             self.lenb = 1
   856             self.lenb = 1
   857         else:
   857         else:
   858             self.lenb = int(self.lenb)
   858             self.lenb = int(self.lenb)
   859         self.starta = int(self.starta)
   859         self.starta = int(self.starta)
   860         self.startb = int(self.startb)
   860         self.startb = int(self.startb)
   861         diffhelpers.addlines(lr, self.hunk, self.lena, self.lenb, self.a, self.b)
   861         diffhelpers.addlines(lr, self.hunk, self.lena, self.lenb, self.a,
       
   862                              self.b)
   862         # if we hit eof before finishing out the hunk, the last line will
   863         # if we hit eof before finishing out the hunk, the last line will
   863         # be zero length.  Lets try to fix it up.
   864         # be zero length.  Lets try to fix it up.
   864         while len(self.hunk[-1]) == 0:
   865         while len(self.hunk[-1]) == 0:
   865             del self.hunk[-1]
   866             del self.hunk[-1]
   866             del self.a[-1]
   867             del self.a[-1]
  1618 
  1619 
  1619     copy = {}
  1620     copy = {}
  1620     if opts.git or opts.upgrade:
  1621     if opts.git or opts.upgrade:
  1621         copy = copies.pathcopies(ctx1, ctx2)
  1622         copy = copies.pathcopies(ctx1, ctx2)
  1622 
  1623 
  1623     difffn = lambda opts, losedata: trydiff(repo, revs, ctx1, ctx2,
  1624     difffn = (lambda opts, losedata:
  1624                  modified, added, removed, copy, getfilectx, opts, losedata, prefix)
  1625                   trydiff(repo, revs, ctx1, ctx2, modified, added, removed,
       
  1626                           copy, getfilectx, opts, losedata, prefix))
  1625     if opts.upgrade and not opts.git:
  1627     if opts.upgrade and not opts.git:
  1626         try:
  1628         try:
  1627             def losedata(fn):
  1629             def losedata(fn):
  1628                 if not losedatafn or not losedatafn(fn=fn):
  1630                 if not losedatafn or not losedatafn(fn=fn):
  1629                     raise GitDiffRequired()
  1631                     raise GitDiffRequired()
  1860         output.append(' %s%s |  %*s %s%s\n' %
  1862         output.append(' %s%s |  %*s %s%s\n' %
  1861                       (filename, ' ' * (maxname - encoding.colwidth(filename)),
  1863                       (filename, ' ' * (maxname - encoding.colwidth(filename)),
  1862                        countwidth, count, pluses, minuses))
  1864                        countwidth, count, pluses, minuses))
  1863 
  1865 
  1864     if stats:
  1866     if stats:
  1865         output.append(_(' %d files changed, %d insertions(+), %d deletions(-)\n')
  1867         output.append(_(' %d files changed, %d insertions(+), '
       
  1868                         '%d deletions(-)\n')
  1866                       % (len(stats), totaladds, totalremoves))
  1869                       % (len(stats), totaladds, totalremoves))
  1867 
  1870 
  1868     return ''.join(output)
  1871     return ''.join(output)
  1869 
  1872 
  1870 def diffstatui(*args, **kw):
  1873 def diffstatui(*args, **kw):