Show More
@@ -286,7 +286,7 b' def addremove(repo, pats=[], opts={}, dr' | |||||
286 | similarity = float(opts.get('similarity') or 0) |
|
286 | similarity = float(opts.get('similarity') or 0) | |
287 | # we'd use status here, except handling of symlinks and ignore is tricky |
|
287 | # we'd use status here, except handling of symlinks and ignore is tricky | |
288 | added, unknown, deleted, removed = [], [], [], [] |
|
288 | added, unknown, deleted, removed = [], [], [], [] | |
289 |
audit_path = scmutil.path |
|
289 | audit_path = scmutil.pathauditor(repo.root) | |
290 | m = match(repo, pats, opts) |
|
290 | m = match(repo, pats, opts) | |
291 | for abs in repo.walk(m): |
|
291 | for abs in repo.walk(m): | |
292 | target = repo.wjoin(abs) |
|
292 | target = repo.wjoin(abs) |
@@ -3618,7 +3618,7 b' def revert(ui, repo, *pats, **opts):' | |||||
3618 | fc = ctx[f] |
|
3618 | fc = ctx[f] | |
3619 | repo.wwrite(f, fc.data(), fc.flags()) |
|
3619 | repo.wwrite(f, fc.data(), fc.flags()) | |
3620 |
|
3620 | |||
3621 |
audit_path = scmutil.path |
|
3621 | audit_path = scmutil.pathauditor(repo.root) | |
3622 | for f in remove[0]: |
|
3622 | for f in remove[0]: | |
3623 | if repo.dirstate[f] == 'a': |
|
3623 | if repo.dirstate[f] == 'a': | |
3624 | repo.dirstate.forget(f) |
|
3624 | repo.dirstate.forget(f) |
@@ -30,7 +30,7 b' class localrepository(repo.repository):' | |||||
30 | self.root = os.path.realpath(util.expandpath(path)) |
|
30 | self.root = os.path.realpath(util.expandpath(path)) | |
31 | self.path = os.path.join(self.root, ".hg") |
|
31 | self.path = os.path.join(self.root, ".hg") | |
32 | self.origroot = path |
|
32 | self.origroot = path | |
33 |
self.auditor = scmutil.path |
|
33 | self.auditor = scmutil.pathauditor(self.root, self._checknested) | |
34 | self.opener = scmutil.opener(self.path) |
|
34 | self.opener = scmutil.opener(self.path) | |
35 | self.wopener = scmutil.opener(self.root) |
|
35 | self.wopener = scmutil.opener(self.root) | |
36 | self.baseui = baseui |
|
36 | self.baseui = baseui |
@@ -302,7 +302,7 b' def applyupdates(repo, action, wctx, mct' | |||||
302 | repo.ui.debug("removing %s\n" % f) |
|
302 | repo.ui.debug("removing %s\n" % f) | |
303 | os.unlink(repo.wjoin(f)) |
|
303 | os.unlink(repo.wjoin(f)) | |
304 |
|
304 | |||
305 |
audit_path = scmutil.path |
|
305 | audit_path = scmutil.pathauditor(repo.root) | |
306 |
|
306 | |||
307 | numupdates = len(action) |
|
307 | numupdates = len(action) | |
308 | for i, a in enumerate(action): |
|
308 | for i, a in enumerate(action): |
@@ -57,7 +57,7 b' class casecollisionauditor(object):' | |||||
57 | self._ui.warn(_("warning: %s\n") % msg) |
|
57 | self._ui.warn(_("warning: %s\n") % msg) | |
58 | map[fl] = f |
|
58 | map[fl] = f | |
59 |
|
59 | |||
60 |
class path |
|
60 | class pathauditor(object): | |
61 | '''ensure that a filesystem path contains no banned components. |
|
61 | '''ensure that a filesystem path contains no banned components. | |
62 | the following properties of a path are checked: |
|
62 | the following properties of a path are checked: | |
63 |
|
63 | |||
@@ -169,7 +169,7 b' class opener(abstractopener):' | |||||
169 | def __init__(self, base, audit=True): |
|
169 | def __init__(self, base, audit=True): | |
170 | self.base = base |
|
170 | self.base = base | |
171 | if audit: |
|
171 | if audit: | |
172 |
self.auditor = path |
|
172 | self.auditor = pathauditor(base) | |
173 | else: |
|
173 | else: | |
174 | self.auditor = util.always |
|
174 | self.auditor = util.always | |
175 | self.createmode = None |
|
175 | self.createmode = None | |
@@ -276,7 +276,7 b' def canonpath(root, cwd, myname, auditor' | |||||
276 | name = os.path.join(root, cwd, name) |
|
276 | name = os.path.join(root, cwd, name) | |
277 | name = os.path.normpath(name) |
|
277 | name = os.path.normpath(name) | |
278 | if auditor is None: |
|
278 | if auditor is None: | |
279 |
auditor = path |
|
279 | auditor = pathauditor(root) | |
280 | if name != rootsep and name.startswith(rootsep): |
|
280 | if name != rootsep and name.startswith(rootsep): | |
281 | name = name[len(rootsep):] |
|
281 | name = name[len(rootsep):] | |
282 | auditor(name) |
|
282 | auditor(name) |
@@ -235,7 +235,7 b' def subrepo(ctx, path):' | |||||
235 | import hg as h |
|
235 | import hg as h | |
236 | hg = h |
|
236 | hg = h | |
237 |
|
237 | |||
238 |
scmutil.path |
|
238 | scmutil.pathauditor(ctx._repo.root)(path) | |
239 | state = ctx.substate.get(path, nullstate) |
|
239 | state = ctx.substate.get(path, nullstate) | |
240 | if state[2] not in types: |
|
240 | if state[2] not in types: | |
241 | raise util.Abort(_('unknown subrepo type %s') % state[2]) |
|
241 | raise util.Abort(_('unknown subrepo type %s') % state[2]) |
General Comments 0
You need to be logged in to leave comments.
Login now