tests/test-audit-path.t
author Adrian Buehlmann <adrian@cadifra.com>
Sun, 17 Apr 2011 11:37:11 +0200
changeset 13950 14d0553bd48b
parent 13910 93452579df9e
child 14116 cd3032437064
permissions -rw-r--r--
help: do not show full help text for command on option errors Example $ hg clone --jump foo bar hg clone: option --jump not recognized hg clone [OPTION]... SOURCE [DEST] make a copy of an existing repository options: -U --noupdate the clone will include an empty working copy (only a repository) -u --updaterev REV revision, tag or branch to check out -r --rev REV [+] include the specified changeset -b --branch BRANCH [+] clone only the specified branch --pull use pull protocol to copy metadata --uncompressed use uncompressed transfer (fast over LAN) -e --ssh CMD specify ssh command to use --remotecmd CMD specify hg command to run on the remote side --insecure do not verify server certificate (ignoring web.cacerts config) [+] marked option can be specified multiple times use "hg help clone" to show the full help text Motivation for this change If the user already has specified the command, he probably already knows the command to some extent. Apparently, he has a problem with the options, so we show him just the synopsis with the short help and the details about the options, with a hint on the last line how to get the full help text. Why is Mercurial better with this change? Experts who just forgot about the details of an option don't get that much text thrown at them, while the newbies still get a hint on the last line how to get the full help text.

  $ hg init

should fail

  $ hg add .hg/00changelog.i
  abort: path contains illegal component: .hg/00changelog.i
  [255]

  $ mkdir a
  $ echo a > a/a
  $ hg ci -Ama
  adding a/a
  $ ln -s a b
  $ echo b > a/b

should fail

  $ hg add b/b
  abort: path 'b/b' traverses symbolic link 'b'
  [255]

should succeed

  $ hg add b

should still fail - maybe

  $ hg add b/b
  abort: path 'b/b' traverses symbolic link 'b'
  [255]

unbundle tampered bundle

  $ hg init target
  $ cd target
  $ hg unbundle $TESTDIR/tampered.hg
  adding changesets
  adding manifests
  adding file changes
  added 5 changesets with 6 changes to 6 files (+4 heads)
  (run 'hg heads' to see heads, 'hg merge' to merge)

attack .hg/test

  $ hg manifest -r0
  .hg/test
  $ hg update -Cr0
  abort: path contains illegal component: .hg/test
  [255]

attack foo/.hg/test

  $ hg manifest -r1
  foo/.hg/test
  $ hg update -Cr1
  abort: path 'foo/.hg/test' is inside nested repo 'foo'
  [255]

attack back/test where back symlinks to ..

  $ hg manifest -r2
  back
  back/test
  $ hg update -Cr2
  abort: path 'back/test' traverses symbolic link 'back'
  [255]

attack ../test

  $ hg manifest -r3
  ../test
  $ hg update -Cr3
  abort: path contains illegal component: ../test
  [255]

attack /tmp/test

  $ hg manifest -r4
  /tmp/test
  $ hg update -Cr4
  abort: No such file or directory: $TESTTMP/target//tmp/test
  [255]