Mercurial > hg-allpaths
changeset 46:e695060c716e
Tests for intended future behaviour of alternative groups and prioritizations
author | Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl> |
---|---|
date | Sun, 25 Sep 2016 09:44:23 +0200 |
parents | 237dd8c4fe78 |
children | 916b05f73b53 |
files | tests/groups-modern.t tests/ignore_and_prioritize.t |
diffstat | 2 files changed, 476 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/groups-modern.t Sun Sep 25 09:35:56 2016 +0200 +++ b/tests/groups-modern.t Sun Sep 25 09:44:23 2016 +0200 @@ -1,2 +1,315 @@ -TODO: testing newer group syntax \ No newline at end of file +Let's test group paths, configured with modern syntax. + +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 + $ export REP4=$WORK_DIR/rep4 + +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 = + > [all_paths] + > group.odd = remote1 remote3 + > group.even = remote2 remote4 + > EOF + +We need some repositories to test. + + $ hg init "$BASE" + $ hg init "$REP1" + $ hg init "$REP2" + $ hg init "$REP3" + $ hg init "$REP4" + +and configuration of groups: + + $ cat > $BASE/.hg/hgrc << EOF + > [paths] + > remote1=$REP1 + > remote2=$REP2 + > remote3=$REP3 + > remote4=$REP4 + > EOF + +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 -g odd + pushing to */rep1 (glob) + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + + pushing to */rep3 (glob) + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + + $ hg --cwd $REP1 log -T '{rev}: {desc}\n' + 0: First + + $ hg --cwd $REP2 log -T '{rev}: {desc}\n' + + $ hg --cwd $REP3 log -T '{rev}: {desc}\n' + 0: First + + $ hg --cwd $REP4 log -T '{rev}: {desc}\n' + + + $ cat >> $BASE/file.txt << EOF + > More text + > EOF + + $ hg --cwd $BASE commit -m 'Second' + + + $ hg --cwd $BASE pushall --group even + pushing to */rep2 (glob) + searching for changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 2 changes to 1 files + + pushing to */rep4 (glob) + searching for changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 2 changes to 1 files + + $ hg --cwd $REP1 log -T '{rev}: {desc}\n' + 0: First + + $ hg --cwd $REP2 log -T '{rev}: {desc}\n' + 1: Second + 0: First + + $ hg --cwd $REP3 log -T '{rev}: {desc}\n' + 0: First + + $ hg --cwd $REP4 log -T '{rev}: {desc}\n' + 1: Second + 0: First + + +Let's also test pulling + + $ hg --cwd $REP1 update + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ cat > $REP1/rep1.txt << EOF + > Another text + > EOF + + $ hg --cwd $REP1 add + adding rep1.txt + $ hg --cwd $REP1 commit -m "In repo1" + + + $ hg --cwd $REP2 update + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ cat >> $REP2/file.txt << EOF + > From repo2… + > EOF + + $ hg --cwd $REP2 commit -m "In repo2" + + $ hg --cwd $BASE incomingall --group odd + 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 */rep3 (glob) + searching for changes + no changes found + + $ hg --cwd $BASE incomingall --group even + comparing with */rep2 (glob) + searching for changes + changeset: 2:.* (re) + tag: tip + user: Andy Default <default@nowhere.net> + date: .* (re) + summary: In repo2 + + comparing with */rep4 (glob) + searching for changes + no changes found + + $ hg --cwd $BASE pullall -g odd + pulling from */rep1 (glob) + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files (+1 heads) + (run 'hg heads' to see heads, 'hg merge' to merge) + + pulling from */rep3 (glob) + searching for changes + no changes found + + $ hg --cwd $BASE log -T '{rev}: {desc}\n' + 2: In repo1 + 1: Second + 0: First + + $ hg --cwd $BASE outgoingall --group odd + comparing with */rep1 (glob) + searching for changes + changeset: 1:* (glob) + user: Andy Default <default@nowhere.net> + date: .* (re) + summary: Second + + comparing with */rep3 (glob) + searching for changes + changeset: 1:* (glob) + user: Andy Default <default@nowhere.net> + date: .* (re) + summary: Second + + changeset: 2:* (glob) + tag: tip + parent: 0:* (glob) + user: Andy Default <default@nowhere.net> + date: .* (re) + summary: In repo1 + + + $ hg --cwd $BASE outgoingall --group even + comparing with */rep2 (glob) + searching for changes + changeset: 2:* (glob) + tag: tip + parent: 0:* (glob) + user: Andy Default <default@nowhere.net> + date: .* (re) + summary: In repo1 + + comparing with */rep4 (glob) + searching for changes + changeset: 2:* (glob) + tag: tip + parent: 0:* (glob) + user: Andy Default <default@nowhere.net> + date: .* (re) + summary: In repo1 + + +Wrong groups do not work + + $ hg --cwd $BASE pullall -g unknown + abort: No paths defined in section unknown + [255] + + $ hg --cwd $BASE incomingall --group unknown + abort: No paths defined in section unknown + [255] + + $ hg --cwd $BASE outgoingall --group unknown + abort: No paths defined in section unknown + [255] + + $ hg --cwd $BASE pushall -g unknown + abort: No paths defined in section unknown + [255] + +But global access works + + $ hg --cwd $BASE pushall + HMM + + $ hg --cwd $BASE pullall + HMM + +Finally let's test that push options work + + $ cat > $BASE/br1.txt << EOF + > Br1 text + > EOF + + $ hg --cwd $BASE branch br1 + marked working directory as branch br1 + (branches are permanent and global, did you want a bookmark?) + $ hg --cwd $BASE add + adding br1.txt + $ hg --cwd $BASE commit -m 'Br1' + + $ hg --cwd $BASE update default + 2 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ cat >> $BASE/file.txt << EOF + > later text + > EOF + $ hg --cwd $BASE commit -m 'Normal' + + $ hg --cwd $BASE pushall -r default -f -g odd + pushing to */rep1 (glob) + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + + pushing to */rep3 (glob) + searching for changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 2 changes to 2 files + + $ hg --cwd $BASE log -T '{rev}: {desc}\n' + 4: Normal + 3: Br1 + 2: In repo1 + 1: Second + 0: First + + $ hg --cwd $REP1 log -T '{rev}: {desc}\n' + 2: Normal + 1: In repo1 + 0: First + + $ hg --cwd $REP2 log -T '{rev}: {desc}\n' + 2: In repo2 + 1: Second + 0: First + + $ hg --cwd $REP3 log -T '{rev}: {desc}\n' + 2: Normal + 1: In repo1 + 0: First + +.
--- a/tests/ignore_and_prioritize.t Sun Sep 25 09:35:56 2016 +0200 +++ b/tests/ignore_and_prioritize.t Sun Sep 25 09:44:23 2016 +0200 @@ -1,2 +1,163 @@ -TODO: testing priorities and skips \ No newline at end of file +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] + > mercurial_all_paths = + > [all_paths] + > ignore = unknown rep2 + > prioritize = rep3 mystery rep1 + > EOF + +We need some repositories to test. + + $ hg init "$BASE" + $ hg init "$REP1" + $ hg init "$REP2" + $ hg init "$REP3" + + $ cat > $BASE/.hg/hgrc << EOF + > [paths] + > remote1=$REP1 + > remote2=$REP2 + > remote3=$REP3 + > EOF + +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 */rep3 (glob) + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + + Skipping ignored rep2 + + pushing to */rep1 (glob) + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + + $ hg --cwd $REP1 log -T '{rev}: {desc}\n' + 0: First + + $ hg --cwd $REP2 log -T '{rev}: {desc}\n' + + $ hg --cwd $REP3 log -T '{rev}: {desc}\n' + 0: First + +Let's also test pulling + + $ hg --cwd $REP1 update + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ cat > $REP1/rep1.txt << EOF + > Another text + > EOF + + $ hg --cwd $REP1 add + adding rep1.txt + $ hg --cwd $REP1 commit -m "In repo1" + + + $ hg --cwd $REP2 update + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ cat >> $REP2/file.txt << EOF + > From repo2… + > EOF + + $ hg --cwd $REP2 add + $ hg --cwd $REP2 commit -m "In repo2" + + $ hg --cwd $BASE incomingall + comparing with */rep3 (glob) + searching for changes + no changes found + + Skipping ignored rep2 + + comparing with */rep1 (glob) + searching for changes + changeset: 1:* (glob) + tag: tip + user: Andy Default <default@nowhere.net> + date: .* (re) + summary: In repo1 + + $ hg --cwd $BASE pullall + pulling from */rep3 (glob) + searching for changes + no changes found + + Skipping ignored rep2 + + pulling from */rep1 (glob) + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + (run 'hg update' to get a working copy) + + $ hg --cwd $BASE log -T '{rev}: {desc}\n' + 1: In repo1 + 0: First + + $ hg --cwd $BASE outgoingall + comparing with */rep1 (glob) + searching for changes + changeset: 2:.* (re) + tag: tip + parent: 0:.* (re) + user: Andy Default <default@nowhere.net> + date: .* (re) + summary: In repo2 + + Skipping ignored rep2 + + comparing with */rep3 (glob) + searching for changes + changeset: 1:* (glob) + user: Andy Default <default@nowhere.net> + date: .* (re) + summary: In repo1 + + changeset: 2:* (glob) + tag: tip + parent: 0:* (glob) + user: Andy Default <default@nowhere.net> + date: .* (re) + summary: In repo2 + +