mercurial/crecord.py
changeset 25557 52c552a05414
parent 25556 40f0e9e5b821
child 25807 2cccaf937a7a
equal deleted inserted replaced
25556:40f0e9e5b821 25557:52c552a05414
  1466                 chunk.write(f)
  1466                 chunk.write(f)
  1467                 f.write('\n'.join(['# ' + i for i in phelp.splitlines()]))
  1467                 f.write('\n'.join(['# ' + i for i in phelp.splitlines()]))
  1468                 f.close()
  1468                 f.close()
  1469                 # start the editor and wait for it to complete
  1469                 # start the editor and wait for it to complete
  1470                 editor = self.ui.geteditor()
  1470                 editor = self.ui.geteditor()
  1471                 self.ui.system("%s \"%s\"" % (editor, patchfn),
  1471                 ret = self.ui.system("%s \"%s\"" % (editor, patchfn),
  1472                           environ={'hguser': self.ui.username()},
  1472                           environ={'hguser': self.ui.username()})
  1473                           onerr=util.Abort, errprefix=_("edit failed"))
  1473                 if ret != 0:
       
  1474                     self.errorstr = "Editor exited with status %d" % ret
       
  1475                     return None
  1474                 # remove comment lines
  1476                 # remove comment lines
  1475                 patchfp = open(patchfn)
  1477                 patchfp = open(patchfn)
  1476                 ncpatchfp = cStringIO.StringIO()
  1478                 ncpatchfp = cStringIO.StringIO()
  1477                 for line in patchfp:
  1479                 for line in patchfp:
  1478                     if not line.startswith('#'):
  1480                     if not line.startswith('#'):
  1493         if not isinstance(item, uihunk):
  1495         if not isinstance(item, uihunk):
  1494             return
  1496             return
  1495 
  1497 
  1496         beforeadded, beforeremoved = item.added, item.removed
  1498         beforeadded, beforeremoved = item.added, item.removed
  1497         newpatches = editpatchwitheditor(self, item)
  1499         newpatches = editpatchwitheditor(self, item)
       
  1500         if newpatches is None:
       
  1501             if not test:
       
  1502                 updateui(self)
       
  1503             return
  1498         header = item.header
  1504         header = item.header
  1499         editedhunkindex = header.hunks.index(item)
  1505         editedhunkindex = header.hunks.index(item)
  1500         hunksbefore = header.hunks[:editedhunkindex]
  1506         hunksbefore = header.hunks[:editedhunkindex]
  1501         hunksafter = header.hunks[editedhunkindex + 1:]
  1507         hunksafter = header.hunks[editedhunkindex + 1:]
  1502         newpatchheader = newpatches[0]
  1508         newpatchheader = newpatches[0]