tests/test-merge-revert.t
author Matt Mackall <mpm@selenic.com>
Tue, 01 Sep 2015 16:08:07 -0500
branchstable
changeset 26120 1a45e49a6bed
parent 12279 28e2e3804f2e
child 49621 55c6ebd11cb9
permissions -rw-r--r--
hgweb: fix trust of templates path (BC) Long ago we disabled trust of the templates path with a comment describing the (insecure) behavior before the change. At some later refactor, the code was apparently changed back to match the comment, unaware that the intent of the comment was to describe the behavior to avoid. This change disables the trust and updates the comment to explicitly say not only what the old problem was, but also that it was in fact a problem and the action taken to prevent it. Impact: prior to this change, if you had a UNIX-based hgweb server where users can write hgrc files, those users could potentially read any file readable by the web server. This is marked as a backwards compatibility issue because people may have configured templates without proper trust settings. Issue spotted by Greg Szorc.

  $ hg init

  $ echo "added file1" > file1
  $ echo "added file2" > file2
  $ hg add file1 file2
  $ hg commit -m "added file1 and file2"

  $ echo "changed file1" >> file1
  $ hg commit -m "changed file1"

  $ hg -q log
  1:08a16e8e4408
  0:d29c767a4b52
  $ hg id
  08a16e8e4408 tip

  $ hg update -C 0
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg id
  d29c767a4b52
  $ echo "changed file1" >> file1
  $ hg id
  d29c767a4b52+

  $ hg revert --all
  reverting file1
  $ hg diff
  $ hg status
  ? file1.orig
  $ hg id
  d29c767a4b52

  $ hg update
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg diff
  $ hg status
  ? file1.orig
  $ hg id
  08a16e8e4408 tip

  $ hg update -C 0
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ echo "changed file1" >> file1

  $ hg update
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg diff
  $ hg status
  ? file1.orig
  $ hg id
  08a16e8e4408 tip

  $ hg revert --all
  $ hg diff
  $ hg status
  ? file1.orig
  $ hg id
  08a16e8e4408 tip

  $ hg revert -r tip --all
  $ hg diff
  $ hg status
  ? file1.orig
  $ hg id
  08a16e8e4408 tip

  $ hg update -C
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg diff
  $ hg status
  ? file1.orig
  $ hg id
  08a16e8e4408 tip