607 |
607 |
608 verify pathauditor blocks evil filepaths |
608 verify pathauditor blocks evil filepaths |
609 $ cat > evil-commit.py <<EOF |
609 $ cat > evil-commit.py <<EOF |
610 > from mercurial import ui, hg, context, node |
610 > from mercurial import ui, hg, context, node |
611 > notrc = u".h\u200cg".encode('utf-8') + '/hgrc' |
611 > notrc = u".h\u200cg".encode('utf-8') + '/hgrc' |
612 > u = ui.ui() |
612 > u = ui.ui.load() |
613 > r = hg.repository(u, '.') |
613 > r = hg.repository(u, '.') |
614 > def filectxfn(repo, memctx, path): |
614 > def filectxfn(repo, memctx, path): |
615 > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned') |
615 > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned') |
616 > c = context.memctx(r, [r['tip'].node(), node.nullid], |
616 > c = context.memctx(r, [r['tip'].node(), node.nullid], |
617 > 'evil', [notrc], filectxfn, 0) |
617 > 'evil', [notrc], filectxfn, 0) |
631 $ hg rollback -f |
631 $ hg rollback -f |
632 repository tip rolled back to revision 2 (undo commit) |
632 repository tip rolled back to revision 2 (undo commit) |
633 $ cat > evil-commit.py <<EOF |
633 $ cat > evil-commit.py <<EOF |
634 > from mercurial import ui, hg, context, node |
634 > from mercurial import ui, hg, context, node |
635 > notrc = "HG~1/hgrc" |
635 > notrc = "HG~1/hgrc" |
636 > u = ui.ui() |
636 > u = ui.ui.load() |
637 > r = hg.repository(u, '.') |
637 > r = hg.repository(u, '.') |
638 > def filectxfn(repo, memctx, path): |
638 > def filectxfn(repo, memctx, path): |
639 > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned') |
639 > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned') |
640 > c = context.memctx(r, [r['tip'].node(), node.nullid], |
640 > c = context.memctx(r, [r['tip'].node(), node.nullid], |
641 > 'evil', [notrc], filectxfn, 0) |
641 > 'evil', [notrc], filectxfn, 0) |
649 $ hg rollback -f |
649 $ hg rollback -f |
650 repository tip rolled back to revision 2 (undo commit) |
650 repository tip rolled back to revision 2 (undo commit) |
651 $ cat > evil-commit.py <<EOF |
651 $ cat > evil-commit.py <<EOF |
652 > from mercurial import ui, hg, context, node |
652 > from mercurial import ui, hg, context, node |
653 > notrc = "HG8B6C~2/hgrc" |
653 > notrc = "HG8B6C~2/hgrc" |
654 > u = ui.ui() |
654 > u = ui.ui.load() |
655 > r = hg.repository(u, '.') |
655 > r = hg.repository(u, '.') |
656 > def filectxfn(repo, memctx, path): |
656 > def filectxfn(repo, memctx, path): |
657 > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned') |
657 > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned') |
658 > c = context.memctx(r, [r['tip'].node(), node.nullid], |
658 > c = context.memctx(r, [r['tip'].node(), node.nullid], |
659 > 'evil', [notrc], filectxfn, 0) |
659 > 'evil', [notrc], filectxfn, 0) |