Mercurial > hg-stable
changeset 11806:fd66a181f575
tests: unify test-clone
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Tue, 10 Aug 2010 13:21:28 +0200 |
parents | 8ef250726cf0 |
children | 887e9f487b7a |
files | tests/test-clone tests/test-clone.out tests/test-clone.t |
diffstat | 3 files changed, 433 insertions(+), 528 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-clone Thu Aug 12 22:31:40 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,212 +0,0 @@ -#!/bin/sh - -echo -echo % prepare repo a -mkdir a -cd a -hg init -echo a > a -hg add a -hg commit -m test -echo first line > b -hg add b -# create a non-inlined filelog -python -c 'for x in range(10000): print x' >> data1 -for j in 0 1 2 3 4 5 6 7 8 9; do - cat data1 >> b - hg commit -m test -done -echo % "list files in store/data (should show a 'b.d')" -for i in .hg/store/data/*; do - echo $i -done - -echo -echo % default operation -hg clone . ../b -cd ../b -cat a -hg verify - -echo -echo % no update, with debug option -hg --debug clone -U . ../c -cd ../c -cat a 2>/dev/null || echo "a not present" -hg verify - -echo -echo % default destination -mkdir ../d -cd ../d -hg clone ../a -cd a -hg cat a - -echo -echo % "check that we drop the file: from the path before" -echo % "writing the .hgrc" -cd ../.. -hg clone file:a e -grep 'file:' e/.hg/hgrc - -echo -echo % check that path aliases are expanded -hg clone -q -U --config 'paths.foobar=a#0' foobar f -hg -R f showconfig paths.default | sed -e 's,.*/,,' - -echo -echo % use --pull -hg clone --pull a g -hg -R g verify - -echo -echo % clone to '.' -mkdir h -cd h -hg clone ../a . -cd .. - -echo -echo -echo % "*** tests for option -u ***" -echo - - -echo -echo % "adding some more history to repo a" -cd a -echo % "tag ref1" -hg tag ref1 -echo the quick brown fox >a -hg ci -m "hacked default" -echo % "updating back to ref1" -hg up ref1 -echo -echo % "add branch 'stable' to repo a for later tests" -hg branch stable -echo some text >a -hg ci -m "starting branch stable" -echo % "tag ref2" -hg tag ref2 -echo some more text >a -hg ci -m "another change for branch stable" -echo -echo % "updating back to ref2" -hg up ref2 -echo -echo % "parents of repo a" -hg parents -echo -echo % "repo a has two heads" -hg heads -cd .. - -echo -echo % "testing clone -U -u 1 a ua (must abort)" -hg clone -U -u 1 a ua - -echo -echo % "testing clone -u . a ua" -hg clone -u . a ua -echo -echo % "repo ua has both heads" -hg -R ua heads -echo -echo % "same revision checked out in repo a and ua" -hg -R a parents --template "{node|short}\n" -hg -R ua parents --template "{node|short}\n" -rm -r ua - -echo -echo % "testing clone --pull -u . a ua" -hg clone --pull -u . a ua -echo -echo % "repo ua has both heads" -hg -R ua heads -echo -echo % "same revision checked out in repo a and ua" -hg -R a parents --template "{node|short}\n" -hg -R ua parents --template "{node|short}\n" -rm -r ua - -echo -echo % "testing clone -u stable a ua" -hg clone -u stable a ua -echo -echo % "repo ua has both heads" -hg -R ua heads -echo -echo % "branch stable is checked out" -hg -R ua parents -rm -r ua - -echo -echo % "testing clone a ua" -hg clone a ua -echo -echo % "repo ua has both heads" -hg -R ua heads -echo -echo % "branch default is checked out" -hg -R ua parents -rm -r ua - -echo -echo % "testing clone -u . a#stable ua" -hg clone -u . a#stable ua -echo -echo % "repo ua has only branch stable" -hg -R ua heads -echo -echo % "same revision checked out in repo a and ua" -hg -R a parents --template "{node|short}\n" -hg -R ua parents --template "{node|short}\n" -rm -r ua - -echo -echo % "testing clone -u . -r stable a ua" -hg clone -u . -r stable a ua -echo -echo % "repo ua has only branch stable" -hg -R ua heads -echo -echo % "same revision checked out in repo a and ua" -hg -R a parents --template "{node|short}\n" -hg -R ua parents --template "{node|short}\n" -rm -r ua - -echo -echo % "testing clone -r stable a ua" -hg clone -r stable a ua -echo -echo % "repo ua has only branch stable" -hg -R ua heads -echo -echo % "branch stable is checked out" -hg -R ua parents -rm -r ua - -echo -echo % "testing clone -u . -r stable -r default a ua" -hg clone -u . -r stable -r default a ua -echo -echo % "repo ua has two heads" -hg -R ua heads -echo -echo % "same revision checked out in repo a and ua" -hg -R a parents --template "{node|short}\n" -hg -R ua parents --template "{node|short}\n" -rm -r ua - -cat <<EOF > simpleclone.py -from mercurial import ui, hg -myui = ui.ui() -repo = hg.repository(myui, 'a') -hg.clone(myui, repo, dest="ua") -EOF - -python simpleclone.py -rm -r ua - -exit 0
--- a/tests/test-clone.out Thu Aug 12 22:31:40 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,316 +0,0 @@ - -% prepare repo a -% list files in store/data (should show a 'b.d') -.hg/store/data/a.i -.hg/store/data/b.d -.hg/store/data/b.i - -% default operation -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -a -checking changesets -checking manifests -crosschecking files in changesets and manifests -checking files -2 files, 11 changesets, 11 total revisions - -% no update, with debug option -linked 8 files -a not present -checking changesets -checking manifests -crosschecking files in changesets and manifests -checking files -2 files, 11 changesets, 11 total revisions - -% default destination -destination directory: a -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -a - -% check that we drop the file: from the path before -% writing the .hgrc -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% check that path aliases are expanded -a#0 - -% use --pull -requesting all changes -adding changesets -adding manifests -adding file changes -added 11 changesets with 11 changes to 2 files -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -checking changesets -checking manifests -crosschecking files in changesets and manifests -checking files -2 files, 11 changesets, 11 total revisions - -% clone to . -updating to branch default -2 files updated, 0 files merged, 0 files removed, 0 files unresolved - - -% *** tests for option -u *** - - -% adding some more history to repo a -% tag ref1 -% updating back to ref1 -1 files updated, 0 files merged, 1 files removed, 0 files unresolved - -% add branch 'stable' to repo a for later tests -marked working directory as branch stable -% tag ref2 - -% updating back to ref2 -1 files updated, 0 files merged, 1 files removed, 0 files unresolved - -% parents of repo a -changeset: 13:e8ece76546a6 -branch: stable -tag: ref2 -parent: 10:a7949464abda -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: starting branch stable - - -% repo a has two heads -changeset: 15:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 12:f21241060d6a -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: hacked default - - -% testing clone -U -u 1 a ua (must abort) -abort: cannot specify both --noupdate and --updaterev - -% testing clone -u . a ua -updating to branch stable -2 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% repo ua has both heads -changeset: 15:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 12:f21241060d6a -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: hacked default - - -% same revision checked out in repo a and ua -e8ece76546a6 -e8ece76546a6 - -% testing clone --pull -u . a ua -requesting all changes -adding changesets -adding manifests -adding file changes -added 16 changesets with 16 changes to 3 files (+1 heads) -updating to branch stable -2 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% repo ua has both heads -changeset: 15:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 12:f21241060d6a -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: hacked default - - -% same revision checked out in repo a and ua -e8ece76546a6 -e8ece76546a6 - -% testing clone -u stable a ua -updating to branch stable -3 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% repo ua has both heads -changeset: 15:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 12:f21241060d6a -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: hacked default - - -% branch stable is checked out -changeset: 15:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - - -% testing clone a ua -updating to branch default -3 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% repo ua has both heads -changeset: 15:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 12:f21241060d6a -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: hacked default - - -% branch default is checked out -changeset: 12:f21241060d6a -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: hacked default - - -% testing clone -u . a#stable ua -requesting all changes -adding changesets -adding manifests -adding file changes -added 14 changesets with 14 changes to 3 files -updating to branch stable -2 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% repo ua has only branch stable -changeset: 13:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 10:a7949464abda -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: test - - -% same revision checked out in repo a and ua -e8ece76546a6 -e8ece76546a6 - -% testing clone -u . -r stable a ua -requesting all changes -adding changesets -adding manifests -adding file changes -added 14 changesets with 14 changes to 3 files -updating to branch stable -2 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% repo ua has only branch stable -changeset: 13:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 10:a7949464abda -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: test - - -% same revision checked out in repo a and ua -e8ece76546a6 -e8ece76546a6 - -% testing clone -r stable a ua -requesting all changes -adding changesets -adding manifests -adding file changes -added 14 changesets with 14 changes to 3 files -updating to branch stable -3 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% repo ua has only branch stable -changeset: 13:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 10:a7949464abda -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: test - - -% branch stable is checked out -changeset: 13:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - - -% testing clone -u . -r stable -r default a ua -requesting all changes -adding changesets -adding manifests -adding file changes -added 16 changesets with 16 changes to 3 files (+1 heads) -updating to branch stable -2 files updated, 0 files merged, 0 files removed, 0 files unresolved - -% repo ua has two heads -changeset: 15:0aae7cf88f0d -branch: stable -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: another change for branch stable - -changeset: 12:f21241060d6a -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: hacked default - - -% same revision checked out in repo a and ua -e8ece76546a6 -e8ece76546a6 -updating to branch default -3 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-clone.t Tue Aug 10 13:21:28 2010 +0200 @@ -0,0 +1,433 @@ +Prepare repo a: + + $ mkdir a + $ cd a + $ hg init + $ echo a > a + $ hg add a + $ hg commit -m test + $ echo first line > b + $ hg add b + +Create a non-inlined filelog: + + $ python -c 'for x in range(10000): print x' >> data1 + $ for j in 0 1 2 3 4 5 6 7 8 9; do + > cat data1 >> b + > hg commit -m test + > done + +List files in store/data (should show a 'b.d'): + + $ for i in .hg/store/data/*; do + > echo $i + > done + .hg/store/data/a.i + .hg/store/data/b.d + .hg/store/data/b.i + +Default operation: + + $ hg clone . ../b + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd ../b + $ cat a + a + $ hg verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 2 files, 11 changesets, 11 total revisions + +No update, with debug option: + + $ hg --debug clone -U . ../c + linked 8 files + $ cd ../c + $ cat a 2>/dev/null || echo "a not present" + a not present + $ hg verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 2 files, 11 changesets, 11 total revisions + +Default destination: + + $ mkdir ../d + $ cd ../d + $ hg clone ../a + destination directory: a + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd a + $ hg cat a + a + $ cd ../.. + +Check that we drop the 'file:' from the path before writing the .hgrc: + + $ hg clone file:a e + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ grep 'file:' e/.hg/hgrc + +Check that path aliases are expanded: + + $ hg clone -q -U --config 'paths.foobar=a#0' foobar f + $ hg -R f showconfig paths.default + .*/a#0 + +Use --pull: + + $ hg clone --pull a g + requesting all changes + adding changesets + adding manifests + adding file changes + added 11 changesets with 11 changes to 2 files + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg -R g verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 2 files, 11 changesets, 11 total revisions + +Clone to '.': + + $ mkdir h + $ cd h + $ hg clone ../a . + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd .. + + +*** Tests for option -u *** + +Adding some more history to repo a: + + $ cd a + $ hg tag ref1 + $ echo the quick brown fox >a + $ hg ci -m "hacked default" + $ hg up ref1 + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg branch stable + marked working directory as branch stable + $ echo some text >a + $ hg ci -m "starting branch stable" + $ hg tag ref2 + $ echo some more text >a + $ hg ci -m "another change for branch stable" + $ hg up ref2 + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg parents + changeset: 13:e8ece76546a6 + branch: stable + tag: ref2 + parent: 10:a7949464abda + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: starting branch stable + + +Repo a has two heads: + + $ hg heads + changeset: 15:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + changeset: 12:f21241060d6a + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: hacked default + + + $ cd .. + + +Testing --noupdate with --updaterev (must abort): + + $ hg clone --noupdate --updaterev 1 a ua + abort: cannot specify both --noupdate and --updaterev + + +Testing clone -u: + + $ hg clone -u . a ua + updating to branch stable + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Repo ua has both heads: + + $ hg -R ua heads + changeset: 15:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + changeset: 12:f21241060d6a + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: hacked default + + +Same revision checked out in repo a and ua: + + $ hg -R a parents --template "{node|short}\n" + e8ece76546a6 + $ hg -R ua parents --template "{node|short}\n" + e8ece76546a6 + + $ rm -r ua + + +Testing clone --pull -u: + + $ hg clone --pull -u . a ua + requesting all changes + adding changesets + adding manifests + adding file changes + added 16 changesets with 16 changes to 3 files (+1 heads) + updating to branch stable + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Repo ua has both heads: + + $ hg -R ua heads + changeset: 15:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + changeset: 12:f21241060d6a + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: hacked default + + +Same revision checked out in repo a and ua: + + $ hg -R a parents --template "{node|short}\n" + e8ece76546a6 + $ hg -R ua parents --template "{node|short}\n" + e8ece76546a6 + + $ rm -r ua + + +Testing clone -u <branch>: + + $ hg clone -u stable a ua + updating to branch stable + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Repo ua has both heads: + + $ hg -R ua heads + changeset: 15:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + changeset: 12:f21241060d6a + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: hacked default + + +Branch 'stable' is checked out: + + $ hg -R ua parents + changeset: 15:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + + $ rm -r ua + + +Testing default checkout: + + $ hg clone a ua + updating to branch default + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Repo ua has both heads: + + $ hg -R ua heads + changeset: 15:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + changeset: 12:f21241060d6a + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: hacked default + + +Branch 'default' is checked out: + + $ hg -R ua parents + changeset: 12:f21241060d6a + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: hacked default + + + $ rm -r ua + + +Testing #<branch>: + + $ hg clone -u . a#stable ua + requesting all changes + adding changesets + adding manifests + adding file changes + added 14 changesets with 14 changes to 3 files + updating to branch stable + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6): + + $ hg -R ua heads + changeset: 13:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + changeset: 10:a7949464abda + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: test + + +Same revision checked out in repo a and ua: + + $ hg -R a parents --template "{node|short}\n" + e8ece76546a6 + $ hg -R ua parents --template "{node|short}\n" + e8ece76546a6 + + $ rm -r ua + + +Testing -u -r <branch>: + + $ hg clone -u . -r stable a ua + requesting all changes + adding changesets + adding manifests + adding file changes + added 14 changesets with 14 changes to 3 files + updating to branch stable + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6): + + $ hg -R ua heads + changeset: 13:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + changeset: 10:a7949464abda + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: test + + +Same revision checked out in repo a and ua: + + $ hg -R a parents --template "{node|short}\n" + e8ece76546a6 + $ hg -R ua parents --template "{node|short}\n" + e8ece76546a6 + + $ rm -r ua + + +Testing -r <branch>: + + $ hg clone -r stable a ua + requesting all changes + adding changesets + adding manifests + adding file changes + added 14 changesets with 14 changes to 3 files + updating to branch stable + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6): + + $ hg -R ua heads + changeset: 13:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + changeset: 10:a7949464abda + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: test + + +Branch 'stable' is checked out: + + $ hg -R ua parents + changeset: 13:0aae7cf88f0d + branch: stable + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: another change for branch stable + + + $ rm -r ua + + +Testing issue2267: + + $ cat <<EOF > simpleclone.py + > from mercurial import ui, hg + > myui = ui.ui() + > repo = hg.repository(myui, 'a') + > hg.clone(myui, repo, dest="ua") + > EOF + + $ python simpleclone.py + updating to branch default + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ rm -r ua +