mercurial/patch.py
changeset 4899 1b7bbc4349e7
parent 4898 bc905a6c0e76
child 4900 e56c7e05c7e6
equal deleted inserted replaced
4898:bc905a6c0e76 4899:1b7bbc4349e7
   826             break
   826             break
   827         if current_hunk:
   827         if current_hunk:
   828             if x.startswith('\ '):
   828             if x.startswith('\ '):
   829                 current_hunk.fix_newline()
   829                 current_hunk.fix_newline()
   830             ret = current_file.apply(current_hunk, reverse)
   830             ret = current_file.apply(current_hunk, reverse)
   831             if ret > 0:
   831             if ret >= 0:
   832                 err = 1
   832                 changed.setdefault(current_file.fname, (None, None))
       
   833                 if ret > 0:
       
   834                     err = 1
   833             current_hunk = None
   835             current_hunk = None
   834             gitworkdone = False
   836             gitworkdone = False
   835         if ((sourcefile or state == BFILE) and ((not context and x[0] == '@') or
   837         if ((sourcefile or state == BFILE) and ((not context and x[0] == '@') or
   836             ((context or context == None) and x.startswith('***************')))):
   838             ((context or context == None) and x.startswith('***************')))):
   837             try:
   839             try:
   848                     current_file = patchfile(ui, sourcefile)
   850                     current_file = patchfile(ui, sourcefile)
   849                 else:
   851                 else:
   850                     current_file = selectfile(afile, bfile, current_hunk,
   852                     current_file = selectfile(afile, bfile, current_hunk,
   851                                               strip, reverse)
   853                                               strip, reverse)
   852                     current_file = patchfile(ui, current_file)
   854                     current_file = patchfile(ui, current_file)
   853                 changed.setdefault(current_file.fname, (None, None))
       
   854         elif state == BFILE and x.startswith('GIT binary patch'):
   855         elif state == BFILE and x.startswith('GIT binary patch'):
   855             current_hunk = binhunk(changed[bfile[2:]][1])
   856             current_hunk = binhunk(changed[bfile[2:]][1])
   856             if not current_file:
   857             if not current_file:
   857                 if sourcefile:
   858                 if sourcefile:
   858                     current_file = patchfile(ui, sourcefile)
   859                     current_file = patchfile(ui, sourcefile)
   915             current_file = None
   916             current_file = None
   916             hunknum = 0
   917             hunknum = 0
   917     if current_hunk:
   918     if current_hunk:
   918         if current_hunk.complete():
   919         if current_hunk.complete():
   919             ret = current_file.apply(current_hunk, reverse)
   920             ret = current_file.apply(current_hunk, reverse)
   920             if ret > 0:
   921             if ret >= 0:
   921                 err = 1
   922                 changed.setdefault(current_file.fname, (None, None))
       
   923                 if ret > 0:
       
   924                     err = 1
   922         else:
   925         else:
   923             fname = current_file and current_file.fname or None
   926             fname = current_file and current_file.fname or None
   924             raise PatchError(_("malformed patch %s %s") % (fname,
   927             raise PatchError(_("malformed patch %s %s") % (fname,
   925                              current_hunk.desc))
   928                              current_hunk.desc))
   926     if current_file:
   929     if current_file: