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) |
@@ -99,7 +99,7 b' def annotate(ui, repo, *pats, **opts):' | |||||
99 | if opts.get('follow'): |
|
99 | if opts.get('follow'): | |
100 | # --follow is deprecated and now just an alias for -f/--file |
|
100 | # --follow is deprecated and now just an alias for -f/--file | |
101 | # to mimic the behavior of Mercurial before version 1.5 |
|
101 | # to mimic the behavior of Mercurial before version 1.5 | |
102 |
opts['file'] = |
|
102 | opts['file'] = True | |
103 |
|
103 | |||
104 | datefunc = ui.quiet and util.shortdate or util.datestr |
|
104 | datefunc = ui.quiet and util.shortdate or util.datestr | |
105 | getdate = util.cachefunc(lambda x: datefunc(x[0].date())) |
|
105 | getdate = util.cachefunc(lambda x: datefunc(x[0].date())) | |
@@ -116,7 +116,7 b' def annotate(ui, repo, *pats, **opts):' | |||||
116 |
|
116 | |||
117 | if (not opts.get('user') and not opts.get('changeset') |
|
117 | if (not opts.get('user') and not opts.get('changeset') | |
118 | and not opts.get('date') and not opts.get('file')): |
|
118 | and not opts.get('date') and not opts.get('file')): | |
119 |
opts['number'] = |
|
119 | opts['number'] = True | |
120 |
|
120 | |||
121 | linenumber = opts.get('line_number') is not None |
|
121 | linenumber = opts.get('line_number') is not None | |
122 | if linenumber and (not opts.get('changeset')) and (not opts.get('number')): |
|
122 | if linenumber and (not opts.get('changeset')) and (not opts.get('number')): | |
@@ -3620,7 +3620,7 b' def revert(ui, repo, *pats, **opts):' | |||||
3620 | fc = ctx[f] |
|
3620 | fc = ctx[f] | |
3621 | repo.wwrite(f, fc.data(), fc.flags()) |
|
3621 | repo.wwrite(f, fc.data(), fc.flags()) | |
3622 |
|
3622 | |||
3623 |
audit_path = scmutil.path |
|
3623 | audit_path = scmutil.pathauditor(repo.root) | |
3624 | for f in remove[0]: |
|
3624 | for f in remove[0]: | |
3625 | if repo.dirstate[f] == 'a': |
|
3625 | if repo.dirstate[f] == 'a': | |
3626 | repo.dirstate.forget(f) |
|
3626 | repo.dirstate.forget(f) |
@@ -54,10 +54,10 b' def bisect(changelog, state):' | |||||
54 | return badrev, None |
|
54 | return badrev, None | |
55 | return badrev, ancestors |
|
55 | return badrev, ancestors | |
56 |
|
56 | |||
57 |
good = |
|
57 | good = False | |
58 | badrev, ancestors = buildancestors(state['bad'], state['good']) |
|
58 | badrev, ancestors = buildancestors(state['bad'], state['good']) | |
59 | if not ancestors: # looking for bad to good transition? |
|
59 | if not ancestors: # looking for bad to good transition? | |
60 |
good = |
|
60 | good = True | |
61 | badrev, ancestors = buildancestors(state['good'], state['bad']) |
|
61 | badrev, ancestors = buildancestors(state['good'], state['bad']) | |
62 | bad = changelog.node(badrev) |
|
62 | bad = changelog.node(badrev) | |
63 | if not ancestors: # now we're confused |
|
63 | if not ancestors: # now we're confused |
@@ -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): |
@@ -406,7 +406,7 b' class patchfile(object):' | |||||
406 | self.ui.warn(_("unable to find '%s' for patching\n") % self.fname) |
|
406 | self.ui.warn(_("unable to find '%s' for patching\n") % self.fname) | |
407 |
|
407 | |||
408 | self.hash = {} |
|
408 | self.hash = {} | |
409 |
self.dirty = |
|
409 | self.dirty = False | |
410 | self.offset = 0 |
|
410 | self.offset = 0 | |
411 | self.skew = 0 |
|
411 | self.skew = 0 | |
412 | self.rej = [] |
|
412 | self.rej = [] | |
@@ -539,7 +539,7 b' class patchfile(object):' | |||||
539 | else: |
|
539 | else: | |
540 | self.lines[:] = h.new() |
|
540 | self.lines[:] = h.new() | |
541 | self.offset += len(h.new()) |
|
541 | self.offset += len(h.new()) | |
542 |
self.dirty = |
|
542 | self.dirty = True | |
543 | return 0 |
|
543 | return 0 | |
544 |
|
544 | |||
545 | horig = h |
|
545 | horig = h | |
@@ -567,7 +567,7 b' class patchfile(object):' | |||||
567 | else: |
|
567 | else: | |
568 | self.lines[start : start + h.lena] = h.new() |
|
568 | self.lines[start : start + h.lena] = h.new() | |
569 | self.offset += h.lenb - h.lena |
|
569 | self.offset += h.lenb - h.lena | |
570 |
self.dirty = |
|
570 | self.dirty = True | |
571 | return 0 |
|
571 | return 0 | |
572 |
|
572 | |||
573 | # ok, we couldn't match the hunk. Lets look for offsets and fuzz it |
|
573 | # ok, we couldn't match the hunk. Lets look for offsets and fuzz it | |
@@ -592,7 +592,7 b' class patchfile(object):' | |||||
592 | self.lines[l : l + len(old)] = newlines |
|
592 | self.lines[l : l + len(old)] = newlines | |
593 | self.offset += len(newlines) - len(old) |
|
593 | self.offset += len(newlines) - len(old) | |
594 | self.skew = l - orig_start |
|
594 | self.skew = l - orig_start | |
595 |
self.dirty = |
|
595 | self.dirty = True | |
596 | offset = l - orig_start - fuzzlen |
|
596 | offset = l - orig_start - fuzzlen | |
597 | if fuzzlen: |
|
597 | if fuzzlen: | |
598 | msg = _("Hunk #%d succeeded at %d " |
|
598 | msg = _("Hunk #%d succeeded at %d " | |
@@ -1132,8 +1132,8 b' def _applydiff(ui, fp, patcher, copyfn, ' | |||||
1132 | first_hunk, strip) |
|
1132 | first_hunk, strip) | |
1133 | current_file = patcher(ui, current_file, opener, |
|
1133 | current_file = patcher(ui, current_file, opener, | |
1134 | missing=missing, eolmode=eolmode) |
|
1134 | missing=missing, eolmode=eolmode) | |
1135 |
except PatchError, |
|
1135 | except PatchError, inst: | |
1136 |
ui.warn(str( |
|
1136 | ui.warn(str(inst) + '\n') | |
1137 | current_file = None |
|
1137 | current_file = None | |
1138 | rejects += 1 |
|
1138 | rejects += 1 | |
1139 | continue |
|
1139 | continue |
@@ -506,7 +506,7 b' class revlog(object):' | |||||
506 | # Turn heads into a dictionary so we can remove 'fake' heads. |
|
506 | # Turn heads into a dictionary so we can remove 'fake' heads. | |
507 | # Also, later we will be using it to filter out the heads we can't |
|
507 | # Also, later we will be using it to filter out the heads we can't | |
508 | # find from roots. |
|
508 | # find from roots. | |
509 |
heads = dict.fromkeys(heads, |
|
509 | heads = dict.fromkeys(heads, False) | |
510 | # Start at the top and keep marking parents until we're done. |
|
510 | # Start at the top and keep marking parents until we're done. | |
511 | nodestotag = set(heads) |
|
511 | nodestotag = set(heads) | |
512 | # Remember where the top was so we can use it as a limit later. |
|
512 | # Remember where the top was so we can use it as a limit later. | |
@@ -596,16 +596,16 b' class revlog(object):' | |||||
596 | # We're trying to figure out which heads are reachable |
|
596 | # We're trying to figure out which heads are reachable | |
597 | # from roots. |
|
597 | # from roots. | |
598 | # Mark this head as having been reached |
|
598 | # Mark this head as having been reached | |
599 |
heads[n] = |
|
599 | heads[n] = True | |
600 | elif ancestors is None: |
|
600 | elif ancestors is None: | |
601 | # Otherwise, we're trying to discover the heads. |
|
601 | # Otherwise, we're trying to discover the heads. | |
602 | # Assume this is a head because if it isn't, the next step |
|
602 | # Assume this is a head because if it isn't, the next step | |
603 | # will eventually remove it. |
|
603 | # will eventually remove it. | |
604 |
heads[n] = |
|
604 | heads[n] = True | |
605 | # But, obviously its parents aren't. |
|
605 | # But, obviously its parents aren't. | |
606 | for p in self.parents(n): |
|
606 | for p in self.parents(n): | |
607 | heads.pop(p, None) |
|
607 | heads.pop(p, None) | |
608 |
heads = [n for n in heads.iter |
|
608 | heads = [n for n, flag in heads.iteritems() if flag] | |
609 | roots = list(roots) |
|
609 | roots = list(roots) | |
610 | assert orderedout |
|
610 | assert orderedout | |
611 | assert roots |
|
611 | assert roots |
@@ -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