comparison mercurial/patch.py @ 14321:003d63bb4fa5

scmutil: drop some aliases in cmdutil
author Matt Mackall <mpm@selenic.com>
date Fri, 13 May 2011 14:48:48 -0500
parents 00a881581400
children e8debe1eb255
comparison
equal deleted inserted replaced
14320:3438417a6657 14321:003d63bb4fa5
9 import cStringIO, email.Parser, os, errno, re 9 import cStringIO, email.Parser, os, errno, re
10 import tempfile, zlib 10 import tempfile, zlib
11 11
12 from i18n import _ 12 from i18n import _
13 from node import hex, nullid, short 13 from node import hex, nullid, short
14 import base85, mdiff, scmutil, util, diffhelpers, copies, encoding, wdutil 14 import base85, mdiff, scmutil, util, diffhelpers, copies, encoding
15 15
16 gitre = re.compile('diff --git a/(.*) b/(.*)') 16 gitre = re.compile('diff --git a/(.*) b/(.*)')
17 17
18 class PatchError(Exception): 18 class PatchError(Exception):
19 pass 19 pass
1179 elif gp.op == 'DELETE': 1179 elif gp.op == 'DELETE':
1180 removes.add(gp.path) 1180 removes.add(gp.path)
1181 1181
1182 wctx = repo[None] 1182 wctx = repo[None]
1183 for src, dst in copies: 1183 for src, dst in copies:
1184 wdutil.dirstatecopy(ui, repo, wctx, src, dst, cwd=cwd) 1184 scmutil.dirstatecopy(ui, repo, wctx, src, dst, cwd=cwd)
1185 if (not similarity) and removes: 1185 if (not similarity) and removes:
1186 wctx.remove(sorted(removes), True) 1186 wctx.remove(sorted(removes), True)
1187 1187
1188 for f in patches: 1188 for f in patches:
1189 gp = patches[f] 1189 gp = patches[f]
1193 # patch won't create empty files 1193 # patch won't create empty files
1194 if gp.op == 'ADD' and not os.path.lexists(dst): 1194 if gp.op == 'ADD' and not os.path.lexists(dst):
1195 flags = (isexec and 'x' or '') + (islink and 'l' or '') 1195 flags = (isexec and 'x' or '') + (islink and 'l' or '')
1196 repo.wwrite(gp.path, '', flags) 1196 repo.wwrite(gp.path, '', flags)
1197 util.setflags(dst, islink, isexec) 1197 util.setflags(dst, islink, isexec)
1198 wdutil.addremove(repo, cfiles, similarity=similarity) 1198 scmutil.addremove(repo, cfiles, similarity=similarity)
1199 files = patches.keys() 1199 files = patches.keys()
1200 files.extend([r for r in removes if r not in files]) 1200 files.extend([r for r in removes if r not in files])
1201 return sorted(files) 1201 return sorted(files)
1202 1202
1203 def _externalpatch(patcher, patchname, ui, strip, cwd, files): 1203 def _externalpatch(patcher, patchname, ui, strip, cwd, files):