changeset 8816:a7c4eb0cc0ed

subrepo: add a test
author Matt Mackall <mpm@selenic.com>
date Mon, 15 Jun 2009 02:51:10 -0500
parents e87b0fc4750b
children 6c9dce20ed70
files tests/test-subrepo tests/test-subrepo.out
diffstat 2 files changed, 305 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-subrepo	Mon Jun 15 02:51:10 2009 -0500
@@ -0,0 +1,106 @@
+#!/bin/sh
+
+rm -rf sub
+mkdir sub
+cd sub
+hg init t
+cd t
+
+echo % first revision, no sub
+echo a > a
+hg ci -Am0
+
+echo % add first sub
+echo s = s > .hgsub
+hg add .hgsub
+hg init s
+echo a > s/a
+hg -R s ci -Ams0
+hg ci -m1
+
+echo % add sub sub
+echo ss = ss > s/.hgsub
+hg init s/ss
+echo a > s/ss/a
+hg -R s add s/.hgsub
+hg -R s/ss add s/ss/a
+hg ci -m2
+
+echo % bump sub rev
+echo b > s/a
+hg -R s ci -ms1
+hg ci -m3
+
+echo % leave sub dirty
+echo c > s/a
+hg ci -m4
+hg tip -R s
+
+echo % check caching
+hg co 0
+hg debugsub
+echo % restore
+hg co
+hg debugsub
+
+echo % new branch for merge tests
+hg co 1
+echo t = t >> .hgsub
+hg init t
+echo t > t/t
+hg -R t add t
+echo % 5
+hg ci -m5 # add sub
+echo t2 > t/t
+echo % 6
+hg st -R s
+hg ci -m6 # change sub
+hg debugsub
+echo t3 > t/t
+echo % 7
+hg ci -m7 # change sub again for conflict test
+hg rm .hgsub
+echo % 8
+hg ci -m8 # remove sub
+
+echo % merge tests
+hg co -C 3
+hg merge 5 # test adding
+hg debugsub
+hg ci -m9
+hg merge 6 --debug # test change
+hg debugsub
+echo conflict > t/t
+hg ci -m10
+HGMERGE=internal:merge hg merge --debug 7 # test conflict
+echo % should conflict
+cat t/t
+
+echo % clone
+cd ..
+hg clone t tc
+cd tc
+hg debugsub
+
+echo % push
+echo bah > t/t
+hg ci -m11
+hg push | sed 's/ .*sub/ ...sub/g'
+
+echo % push -f
+echo bah > s/a
+hg ci -m12
+hg push | sed 's/ .*sub/ ...sub/g'
+hg push -f | sed 's/ .*sub/ ...sub/g'
+
+echo % update
+cd ../t
+hg up -C # discard our earlier merge
+echo blah > t/t
+hg ci -m13
+
+echo % pull
+cd ../tc
+hg pull | sed 's/ .*sub/ ...sub/g'
+hg up # should pull t
+cat t/t
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-subrepo.out	Mon Jun 15 02:51:10 2009 -0500
@@ -0,0 +1,199 @@
+% first revision, no sub
+adding a
+% add first sub
+adding a
+committing subrepository s
+nothing changed
+% add sub sub
+committing subrepository s
+committing subrepository ss
+% bump sub rev
+committing subrepository s
+nothing changed
+% leave sub dirty
+committing subrepository s
+changeset:   3:1c833a7a9e3a
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     4
+
+% check caching
+0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+% restore
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+path s
+ source   s
+ revision 1c833a7a9e3a4445c711aaf0f012379cd0d4034e
+% new branch for merge tests
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+adding t/t
+% 5
+committing subrepository t
+created new head
+% 6
+committing subrepository t
+path s
+ source   s
+ revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
+path t
+ source   t
+ revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
+% 7
+committing subrepository t
+% 8
+% merge tests
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+path s
+ source   s
+ revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
+path t
+ source   t
+ revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382
+created new head
+  searching for copies back to rev 2
+resolving manifests
+ overwrite None partial False
+ ancestor 1f14a2e2d3ec local f0d2028bf86d+ remote 1831e14459c4
+ .hgsubstate: versions differ -> m
+resolving manifests
+ overwrite True partial False
+ ancestor 60ca1237c194+ local 60ca1237c194+ remote 6747d179aa9a
+ t: remote is newer -> g
+getting t
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+path s
+ source   s
+ revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
+path t
+ source   t
+ revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
+committing subrepository t
+  searching for copies back to rev 2
+resolving manifests
+ overwrite None partial False
+ ancestor 1831e14459c4 local e45c8b14af55+ remote f94576341bcf
+ .hgsubstate: versions differ -> m
+  searching for copies back to rev 2
+resolving manifests
+ overwrite None partial False
+ ancestor 6747d179aa9a local 20a0db6fbf6c+ remote 7af322bc1198
+ t: versions differ -> m
+preserving t for resolve of t
+picked tool 'internal:merge' for t (binary False symlink False)
+merging t
+my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
+warning: conflicts during merge.
+merging t failed!
+0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+use 'hg resolve' to retry unresolved file merges or 'hg up --clean' to abandon
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+% should conflict
+<<<<<<< local
+conflict
+=======
+t3
+>>>>>>> other
+% clone
+updating working directory
+pulling subrepo s
+requesting all changes
+adding changesets
+adding manifests
+adding file changes
+added 4 changesets with 5 changes to 3 files
+pulling subrepo ss
+requesting all changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files
+pulling subrepo t
+requesting all changes
+adding changesets
+adding manifests
+adding file changes
+added 4 changesets with 4 changes to 1 files (+1 heads)
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+path s
+ source   s
+ revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
+path t
+ source   t
+ revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e
+% push
+committing subrepository t
+pushing ...sub/t
+pushing ...subrepo ss
+searching for changes
+no changes found
+pushing ...subrepo s
+searching for changes
+no changes found
+pushing ...subrepo t
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files
+% push -f
+committing subrepository s
+abort: push creates new remote heads!
+pushing ...sub/t
+pushing ...subrepo ss
+searching for changes
+no changes found
+pushing ...subrepo s
+searching for changes
+(did you forget to merge? use push -f to force)
+pushing ...subrepo t
+searching for changes
+no changes found
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files
+pushing ...sub/t
+pushing ...subrepo ss
+searching for changes
+no changes found
+pushing ...subrepo s
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files (+1 heads)
+pushing ...subrepo t
+searching for changes
+no changes found
+searching for changes
+no changes found
+% update
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+committing subrepository t
+% pull
+pulling ...sub/t
+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)
+pulling subrepo t
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+blah