view tests/basic.t @ 37:cf3fe04cd96b

Initial work on testing
author Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl>
date Sat, 24 Sep 2016 15:51:58 +0200
parents
children f371747bb8fc
line wrap: on
line source


Let's test all_paths operations.

Some locations used during testing:

  $ WORK_DIR=${WORK_DIR-`pwd`/work}
  $ rm -rf $WORK_DIR

  $ export BASE=$WORK_DIR/base
  $ export REP1=$WORK_DIR/rep1
  $ export REP2=$WORK_DIR/rep2
  $ export REP3=$WORK_DIR/rep3

First we need appropriate Mercurial configuration file (and variable
which ensures it is used).

  $ export HGRCPATH=$WORK_DIR/hgrc
  $ mkdir -p $HGRCPATH

  $ cat > $HGRCPATH/basic.rc << EOF
  > [ui]
  > username = Andy Default <default@nowhere.net>
  > [extensions]
  > all_paths =
  > EOF

We need some repositories to test.

  $ hg init "$BASE"
  $ hg init "$REP1"
  $ hg init "$REP2"
  $ hg init "$REP3"

  $ cat > $BASE/.hg/hgrc
  > [paths]
  > remote1=$REP1
  > remote2=$REP2
  > remote3=$REP3
  > EOF

Let's test pushing

  $ echo > $BASE/file.txt
  > Some text
  > EOF

  $ hg --cwd $BASE add
  $ hg --cwd $BASE commit -m 'First'

  $ hg --cwd $BASE pushall

  $ hg --cwd $REP1 log

  $ hg --cwd $REP2 log
  
  $ hg --cwd $REP3 log

Let's also test pulling 

  $ hg --cwd $REP1 update

  $ echo > $REP1/rep1.txt
  > Another text
  > EOF

  $ hg --cwd $REP1 add
  $ hg --cwd $REP1 commit -m "In repo1"


  $ hg --cwd $REP2 update

  $ echo >> $REP2/file.txt
  > From repo2…
  > EOF

  $ hg --cwd $REP2 add
  $ hg --cwd $REP2 commit -m "In repo2"

  $ hg --cwd $BASE incomingall

  $ hg --cwd $BASE pullall

  $ hg --cwd $BASE log

  $ hg --cwd $BASE outgoingall

Without remotes those commands do nothing

  $ hg --cwd $REP3 pullall

  $ hg --cwd $REP3 pushall

  $ hg --cwd $REP3 incomingall

  $ hg --cwd $REP3 outgoingall

Finally let's test that push options work

  $ echo > $BASE/br1.txt
  > Br1 text
  > EOF

  $ hg --cwd $BASE branch br1
  $ hg --cwd $BASE add
  $ hg --cwd $BASE commit -m 'Br1'

  $ hg --cwd $BASE update default
  $ echo >> $BASE/file.txt
  > later text
  > EOF
  $ hg --cwd $BASE commit -m 'Normal''
 
  $ hg --cwd $BASE pushall -r default -f

  $ hg --cwd $REP1 log

  $ hg --cwd $REP2 log
  
  $ hg --cwd $REP3 log