##// END OF EJS Templates
patch: turn patch() touched files dict into a set
Patrick Mezard -
r14564:65f4512e default
parent child Browse files
Show More
@@ -617,7 +617,7 b' class queue(object):'
617 def patch(self, repo, patchfile):
617 def patch(self, repo, patchfile):
618 '''Apply patchfile to the working directory.
618 '''Apply patchfile to the working directory.
619 patchfile: name of patch file'''
619 patchfile: name of patch file'''
620 files = {}
620 files = set()
621 try:
621 try:
622 fuzz = patchmod.patch(self.ui, repo, patchfile, strip=1,
622 fuzz = patchmod.patch(self.ui, repo, patchfile, strip=1,
623 files=files, eolmode=None)
623 files=files, eolmode=None)
@@ -227,7 +227,7 b' class transplanter(object):'
227 raise util.Abort(_('can only omit patchfile if merging'))
227 raise util.Abort(_('can only omit patchfile if merging'))
228 if patchfile:
228 if patchfile:
229 try:
229 try:
230 files = {}
230 files = set()
231 patch.patch(self.ui, repo, patchfile, files=files, eolmode=None)
231 patch.patch(self.ui, repo, patchfile, files=files, eolmode=None)
232 files = list(files)
232 files = list(files)
233 if not files:
233 if not files:
@@ -3106,7 +3106,7 b' def import_(ui, repo, patch1, *patches, '
3106 if opts.get('exact') or opts.get('import_branch'):
3106 if opts.get('exact') or opts.get('import_branch'):
3107 repo.dirstate.setbranch(branch or 'default')
3107 repo.dirstate.setbranch(branch or 'default')
3108
3108
3109 files = {}
3109 files = set()
3110 patch.patch(ui, repo, tmpname, strip=strip, files=files,
3110 patch.patch(ui, repo, tmpname, strip=strip, files=files,
3111 eolmode=None, similarity=sim / 100.0)
3111 eolmode=None, similarity=sim / 100.0)
3112 files = list(files)
3112 files = list(files)
@@ -1223,7 +1223,7 b' def _applydiff(ui, fp, patcher, backend,'
1223 continue
1223 continue
1224 ret = current_file.apply(values)
1224 ret = current_file.apply(values)
1225 if ret >= 0:
1225 if ret >= 0:
1226 changed.setdefault(current_file.fname, None)
1226 changed.add(current_file.fname)
1227 if ret > 0:
1227 if ret > 0:
1228 err = 1
1228 err = 1
1229 elif state == 'file':
1229 elif state == 'file':
@@ -1236,7 +1236,7 b' def _applydiff(ui, fp, patcher, backend,'
1236 path = pstrip(gp.path)
1236 path = pstrip(gp.path)
1237 if gp.oldpath:
1237 if gp.oldpath:
1238 copysource = pstrip(gp.oldpath)
1238 copysource = pstrip(gp.oldpath)
1239 changed[path] = gp
1239 changed.add(path)
1240 if gp.op == 'RENAME':
1240 if gp.op == 'RENAME':
1241 backend.unlink(copysource)
1241 backend.unlink(copysource)
1242 if not first_hunk:
1242 if not first_hunk:
@@ -1306,7 +1306,7 b' def _externalpatch(ui, repo, patcher, pa'
1306 if line.startswith('patching file '):
1306 if line.startswith('patching file '):
1307 pf = util.parsepatchoutput(line)
1307 pf = util.parsepatchoutput(line)
1308 printed_file = False
1308 printed_file = False
1309 files.setdefault(pf, None)
1309 files.add(pf)
1310 elif line.find('with fuzz') >= 0:
1310 elif line.find('with fuzz') >= 0:
1311 fuzz = True
1311 fuzz = True
1312 if not printed_file:
1312 if not printed_file:
@@ -1340,7 +1340,7 b' def internalpatch(ui, repo, patchobj, st'
1340 returns whether patch was applied with fuzz factor."""
1340 returns whether patch was applied with fuzz factor."""
1341
1341
1342 if files is None:
1342 if files is None:
1343 files = {}
1343 files = set()
1344 if eolmode is None:
1344 if eolmode is None:
1345 eolmode = ui.config('patch', 'eol', 'strict')
1345 eolmode = ui.config('patch', 'eol', 'strict')
1346 if eolmode.lower() not in eolmodes:
1346 if eolmode.lower() not in eolmodes:
@@ -1359,7 +1359,7 b' def internalpatch(ui, repo, patchobj, st'
1359 finally:
1359 finally:
1360 if fp != patchobj:
1360 if fp != patchobj:
1361 fp.close()
1361 fp.close()
1362 files.update(dict.fromkeys(backend.close()))
1362 files.update(backend.close())
1363 store.close()
1363 store.close()
1364 if ret < 0:
1364 if ret < 0:
1365 raise PatchError(_('patch failed to apply'))
1365 raise PatchError(_('patch failed to apply'))
@@ -1380,7 +1380,7 b' def patch(ui, repo, patchname, strip=1, '
1380 """
1380 """
1381 patcher = ui.config('ui', 'patch')
1381 patcher = ui.config('ui', 'patch')
1382 if files is None:
1382 if files is None:
1383 files = {}
1383 files = set()
1384 try:
1384 try:
1385 if patcher:
1385 if patcher:
1386 return _externalpatch(ui, repo, patcher, patchname, strip,
1386 return _externalpatch(ui, repo, patcher, patchname, strip,
General Comments 0
You need to be logged in to leave comments. Login now