Mercurial > hg-allpaths
changeset 43:a1fb32ff4532
Further work on tests
author | Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl> |
---|---|
date | Sat, 24 Sep 2016 23:31:49 +0200 |
parents | 7b4bc975644c |
children | 2d6c7e0c1b2f |
files | tests/config-items.t tests/facing_problems.t tests/ignore_and_prioritize.t |
diffstat | 3 files changed, 130 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/config-items.t Sat Sep 24 23:19:27 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ - -TODO: testing priorities and skips \ No newline at end of file
--- a/tests/facing_problems.t Sat Sep 24 23:19:27 2016 +0200 +++ b/tests/facing_problems.t Sat Sep 24 23:31:49 2016 +0200 @@ -1,2 +1,129 @@ -TODO: test when some repo raises errors (is missing, unrelated etc) \ No newline at end of file +Let's test behaviour when there are problems - some repo is missing, +another is unrelated. + +Some locations used during testing: + + $ WORK_DIR=${WORK_DIR-`pwd`/work} + $ rm -rf $WORK_DIR + + $ export BASE=$WORK_DIR/base + $ export GOOD1=$WORK_DIR/good1 + $ export UNREL=$WORK_DIR/unrelated + $ export MISSING=$WORK_DIR/missing + $ export GOOD2=$WORK_DIR/good2 + +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] + > mercurial_all_paths = + > EOF + +We need some repositories to test. + + $ hg init "$BASE" + $ hg init "$GOOD1" + $ hg init "$UNREL" + $ hg init "$GOOD2" + + $ cat > $BASE/.hg/hgrc << EOF + > [paths] + > good1=$GOOD1 + > unrel=$UNREL + > missing=$MISSING + > good2=$GOOD2 + > EOF + + $ cat > $UNREL/something.txt << EOF + > This gonnna be unrelated. + > EOF + $ hg --cwd $UNREL add + adding something.txt + $ hg --cwd $UNREL commit -m "Unrelated" + +Let's test pushing + + $ cat > $BASE/file.txt << EOF + > Some text + > EOF + $ hg --cwd $BASE add + adding file.txt + $ hg --cwd $BASE commit -m 'First' + + $ hg --cwd $BASE pushall + pushing to */good1 (glob) + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + pushing to */unrelated (glob) + searching for changes + abort: repository is unrelated + [255] + + $ hg --cwd $GOOD1 log -T '{rev}: {desc}\n' + 0: First + + $ hg --cwd $GOOD2 log -T '{rev}: {desc}\n' + 0: First + + $ hg --cwd $UNREL log -T '{rev}: {desc}\n' + 0: Unrelated + +Let's also test pulling + + $ hg --cwd $GOOD1 update + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cat > $GOOD1/rep1.txt << EOF + > Another text + > EOF + $ hg --cwd $GOOD1 add + adding rep1.txt + $ hg --cwd $GOOD1 commit -m "In repo1" + + $ hg --cwd $UNREL update + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cat > $UNREL/unr.txt << EOF + > Another text + > EOF + $ hg --cwd $UNREL add + adding unr.txt + $ hg --cwd $UNREL commit -m "In unrel" + + $ hg --cwd $GOOD2 update + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cat > $GOOD2/rep1.txt << EOF + > Another text + > EOF + $ hg --cwd $GOOD2 add + adding rep1.txt + $ hg --cwd $GOOD2 commit -m "In good2" + + $ hg --cwd $BASE incomingall + comparing with */rep1 (glob) + searching for changes + changeset: 1:* (glob) + tag: tip + user: Andy Default <default@nowhere.net> + date: .* (re) + summary: In repo1 + + comparing with */rep2 (glob) + searching for changes + changeset: 1:* (glob) + tag: tip + user: Andy Default <default@nowhere.net> + date: .* (re) + summary: In repo2 + + $ hg --cwd $BASE pullall + + $ hg --cwd $BASE log -T '{rev}: {desc}\n'