##// END OF EJS Templates
patch.py: don't mark files as changed unless they have actually been changed
Bryan O'Sullivan -
r4899:1b7bbc43 default
parent child Browse files
Show More
@@ -828,8 +828,10 b' def applydiff(ui, fp, changed, strip=1, '
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
@@ -850,7 +852,6 b' def applydiff(ui, fp, changed, strip=1, '
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:
@@ -917,8 +918,10 b' def applydiff(ui, fp, changed, strip=1, '
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,
General Comments 0
You need to be logged in to leave comments. Login now