# HG changeset patch # User Adrian Buehlmann # Date 2010-08-10 11:21:28 # Node ID fd66a181f5750dd868ac14360d40660a581cc9ba # Parent 8ef250726cf09125c2e0e52947a82a4efa72666e tests: unify test-clone diff --git a/tests/test-clone.out b/tests/test-clone.out deleted file mode 100644 --- a/tests/test-clone.out +++ /dev/null @@ -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 diff --git a/tests/test-clone b/tests/test-clone.t old mode 100755 new mode 100644 rename from tests/test-clone rename to tests/test-clone.t --- a/tests/test-clone +++ b/tests/test-clone.t @@ -1,212 +1,433 @@ -#!/bin/sh +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: -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 + $ 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 -echo -echo % default operation -hg clone . ../b -cd ../b -cat a -hg verify +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 ../.. -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 +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: -echo -echo % default destination -mkdir ../d -cd ../d -hg clone ../a -cd a -hg cat a + $ 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 *** -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 +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 + -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,.*/,,' +Repo a has two heads: -echo -echo % use --pull -hg clone --pull a g -hg -R g verify + $ 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: -echo -echo % clone to '.' -mkdir h -cd h -hg clone ../a . -cd .. + $ 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: -echo -echo -echo % "*** tests for option -u ***" -echo + $ 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 -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 .. +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: -echo -echo % "testing clone -U -u 1 a ua (must abort)" -hg clone -U -u 1 a 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 : + + $ 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 + -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 +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: -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 + $ 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: -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 + $ 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 #: + + $ 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 -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 +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 : -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 + $ 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): -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 + $ 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 -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 + $ rm -r ua + + +Testing -r : + + $ 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 + -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 +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 + -cat < simpleclone.py -from mercurial import ui, hg -myui = ui.ui() -repo = hg.repository(myui, 'a') -hg.clone(myui, repo, dest="ua") -EOF +Testing issue2267: -python simpleclone.py -rm -r ua + $ cat < simpleclone.py + > from mercurial import ui, hg + > myui = ui.ui() + > repo = hg.repository(myui, 'a') + > hg.clone(myui, repo, dest="ua") + > EOF -exit 0 + $ python simpleclone.py + updating to branch default + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ rm -r ua +