tests/test-rhg.t
author Pulkit Goyal <7895pulkit@gmail.com>
Wed, 09 Sep 2020 16:49:19 +0530
changeset 45530 6877b0ee5f9d
parent 45451 a6a000ab135b
child 45535 f17caf8f3fef
permissions -rw-r--r--
mergestate: introduce a new ACTION_KEEP_NEW `ACTION_KEEP` is overloaded and it's hard to figure out how we end up with this KEEP, what was the state of things. In a previous patch, we introduced `ACTION_KEEP_ABSENT` which represents files which are kept absent in the working directory. There is another special case where we keep the file when it's not present on both ancestor and remote side. We introduce a dedicated action for that. The goal is to use these information to make bid merge smarter. Differential Revision: https://phab.mercurial-scm.org/D9002

#require rust

Define an rhg function that will only run if rhg exists
  $ rhg() {
  > if [ -f "$RUNTESTDIR/../rust/target/debug/rhg" ]; then
  >   "$RUNTESTDIR/../rust/target/debug/rhg" "$@"
  > else
  >   echo "skipped: Cannot find rhg. Try to run cargo build in rust/rhg."
  >   exit 80
  > fi
  > }

Unimplemented command
  $ rhg unimplemented-command
  error: Found argument 'unimplemented-command' which wasn't expected, or isn't valid in this context
  
  USAGE:
      rhg <SUBCOMMAND>
  
  For more information try --help
  [252]

Finding root
  $ rhg root
  abort: no repository found in '$TESTTMP' (.hg not found)!
  [255]

  $ hg init repository
  $ cd repository
  $ rhg root
  $TESTTMP/repository

Unwritable file descriptor
  $ rhg root > /dev/full
  abort: No space left on device (os error 28)
  [255]

Deleted repository
  $ rm -rf `pwd`
  $ rhg root
  abort: error getting current working directory: $ENOENT$
  [255]

Listing tracked files
  $ cd $TESTTMP
  $ hg init repository
  $ cd repository
  $ for i in 1 2 3; do
  >   echo $i >> file$i
  >   hg add file$i
  > done
  > hg commit -m "commit $i" -q

Listing tracked files from root
  $ rhg files
  file1
  file2
  file3

Listing tracked files from subdirectory
  $ mkdir -p path/to/directory
  $ cd path/to/directory
  $ rhg files
  ../../../file1
  ../../../file2
  ../../../file3

Listing tracked files through broken pipe
  $ rhg files | head -n 1
  ../../../file1