--- a/tests/test-subrepo Mon Aug 16 20:44:33 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-#!/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
-
-# issue2232 - committing a subrepo without .hgsub
-hg ci -mbad s
-
-hg -R s ci -Ams0
-hg sum
-hg ci -m1
-
-# issue 2022 - update -C
-echo b > s/a
-hg sum
-hg co -C 1
-hg sum
-
-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 sum
-hg ci -m2
-hg sum
-
-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 | sed 's|from .*/sub|from .../sub|g'
-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'
-# should pull t
-hg up | sed 's|from .*/sub|from .../sub|g'
-cat t/t
-
-echo % bogus subrepo path aborts
-echo 'bogus=[boguspath' >> .hgsub
-hg ci -m 'bogus subrepo path'
-
-echo % issue 1986
-cd ..
-rm -rf sub
-hg init main
-cd main
-
-hg init s # subrepo layout
-cd s #
-echo a > a # o 5 br
-hg ci -Am1 # /|
-hg branch br # o | 4 default
-echo a >> a # | |
-hg ci -m1 # | o 3 br
-hg up default # |/|
-echo b > b # o | 2 default
-hg ci -Am1 # | |
-hg up br # | o 1 br
-hg merge tip # |/
-hg ci -m1 # o 0 default
-hg up 2
-echo c > c
-hg ci -Am1
-hg up 3
-hg merge 4
-hg ci -m1
-
-cd .. # main repo layout:
-echo 's = s' > .hgsub #
-hg -R s up 2 # * <-- try to merge default into br again
-hg ci -Am1 # .`|
-hg branch br # . o 5 br --> substate = 5
-echo b > b # . |
-hg -R s up 3 # o | 4 default --> substate = 4
-hg ci -Am1 # | |
-hg up default # | o 3 br --> substate = 2
-echo c > c # |/|
-hg ci -Am1 # o | 2 default --> substate = 2
-hg up 1 # | |
-hg merge 2 # | o 1 br --> substate = 3
-hg ci -m1 # |/
-hg up 2 # o 0 default --> substate = 2
-hg -R s up 4
-echo d > d
-hg ci -Am1
-hg up 3
-hg -R s up 5
-echo e > e
-hg ci -Am1
-
-hg up 5
-hg merge 4 # try to merge default into br again
-cd ..
-
-echo % test subrepo delete from .hgsubstate
-hg init testdelete
-mkdir testdelete/nested testdelete/nested2
-hg init testdelete/nested
-hg init testdelete/nested2
-echo test > testdelete/nested/foo
-echo test > testdelete/nested2/foo
-hg -R testdelete/nested add
-hg -R testdelete/nested2 add
-hg -R testdelete/nested ci -m test
-hg -R testdelete/nested2 ci -m test
-echo nested = nested > testdelete/.hgsub
-echo nested2 = nested2 >> testdelete/.hgsub
-hg -R testdelete add
-hg -R testdelete ci -m "nested 1 & 2 added"
-echo nested = nested > testdelete/.hgsub
-hg -R testdelete ci -m "nested 2 deleted"
-cat testdelete/.hgsubstate | sed "s:.* ::"
-hg -R testdelete remove testdelete/.hgsub
-hg -R testdelete ci -m ".hgsub deleted"
-cat testdelete/.hgsubstate
-
-echo % test repository cloning
-mkdir mercurial mercurial2
-hg init nested_absolute
-echo test > nested_absolute/foo
-hg -R nested_absolute add
-hg -R nested_absolute ci -mtest
-cd mercurial
-hg init nested_relative
-echo test2 > nested_relative/foo2
-hg -R nested_relative add
-hg -R nested_relative ci -mtest2
-hg init main
-echo "nested_relative = ../nested_relative" > main/.hgsub
-echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub
-hg -R main add
-hg -R main ci -m "add subrepos"
-cd ..
-hg clone mercurial/main mercurial2/main
-cat mercurial2/main/nested_absolute/.hg/hgrc \
- mercurial2/main/nested_relative/.hg/hgrc \
- | "$TESTDIR/filtertmp.py"
-rm -rf mercurial mercurial2
-
-echo % issue 1977
-hg init repo
-hg init repo/s
-echo a > repo/s/a
-hg -R repo/s ci -Am0
-echo s = s > repo/.hgsub
-hg -R repo ci -Am1
-hg clone repo repo2 | sed 's|from .*/sub|from .../sub|g'
-hg -q -R repo2 pull -u
-echo 1 > repo2/s/a
-hg -R repo2/s ci -m2
-hg -q -R repo2/s push
-hg -R repo2/s up -C 0
-echo 2 > repo2/s/a
-hg -R repo2/s ci -m3
-hg -R repo2 ci -m3
-hg -q -R repo2 push
-hg -R repo update
-rm -rf repo2 repo
-
-exit 0
--- a/tests/test-subrepo.out Mon Aug 16 20:44:33 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,304 +0,0 @@
-% first revision, no sub
-adding a
-% add first sub
-abort: can't commit subrepos without .hgsub
-adding a
-parent: 0:f7b1eb17ad24 tip
- 0
-branch: default
-commit: 1 added, 1 subrepos
-update: (current)
-committing subrepository s
-parent: 1:7cf8cfea66e4 tip
- 1
-branch: default
-commit: 1 subrepos
-update: (current)
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-parent: 1:7cf8cfea66e4 tip
- 1
-branch: default
-commit: (clean)
-update: (current)
-% add sub sub
-parent: 1:7cf8cfea66e4 tip
- 1
-branch: default
-commit: 1 subrepos
-update: (current)
-committing subrepository s
-committing subrepository s/ss
-parent: 2:df30734270ae tip
- 2
-branch: default
-commit: (clean)
-update: (current)
-% bump sub rev
-committing subrepository s
-% 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
-updating: .hgsubstate 1/1 files (100.00%)
-subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
- subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
-getting subrepo t
-resolving manifests
- overwrite True partial False
- ancestor 60ca1237c194+ local 60ca1237c194+ remote 6747d179aa9a
- t: remote is newer -> g
-updating: t 1/1 files (100.00%)
-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
-updating: .hgsubstate 1/1 files (100.00%)
-subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4
- subrepo t: both sides changed, merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg
-merging subrepo t
- 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
-updating: t 1/1 files (100.00%)
-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 update -C' 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 to branch default
-pulling subrepo s from .../sub/t/s
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 4 changesets with 5 changes to 3 files
-pulling subrepo s/ss from .../sub/t/s/ss
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-pulling subrepo t from .../sub/t/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 ...sub/t/s/ss
-searching for changes
-no changes found
-pushing ...sub/t/s
-searching for changes
-no changes found
-pushing ...sub/t/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 on branch 'default'!
-(did you forget to merge? use push -f to force)
-pushing ...sub/t
-pushing ...sub/t/s/ss
-searching for changes
-no changes found
-pushing ...sub/t/s
-searching for changes
-pushing ...sub/t
-pushing ...sub/t/s/ss
-searching for changes
-no changes found
-pushing ...sub/t/s
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files (+1 heads)
-pushing ...sub/t/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
-% 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 from .../sub/t/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
-% bogus subrepo path aborts
-abort: missing ] in subrepo source
-% issue 1986
-adding a
-marked working directory as branch br
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-adding b
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-adding c
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-adding .hgsub
-committing subrepository s
-marked working directory as branch br
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-adding b
-committing subrepository s
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-adding c
-2 files updated, 0 files merged, 1 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-adding d
-committing subrepository s
-2 files updated, 0 files merged, 1 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-adding e
-committing subrepository s
-0 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)
-% test subrepo delete from .hgsubstate
-adding testdelete/nested/foo
-adding testdelete/nested2/foo
-adding testdelete/.hgsub
-committing subrepository nested2
-committing subrepository nested
-nested
-% test repository cloning
-adding nested_absolute/foo
-adding nested_relative/foo2
-adding main/.hgsub
-committing subrepository nested_relative
-committing subrepository nested_absolute
-updating to branch default
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-[paths]
-default = $HGTMP/test-subrepo/sub/mercurial/nested_absolute
-[paths]
-default = $HGTMP/test-subrepo/sub/mercurial/nested_relative
-% issue 1977
-adding a
-adding .hgsub
-committing subrepository s
-updating to branch default
-pulling subrepo s from .../sub/repo/s
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-committing subrepository s
-abort: push creates new remote heads on branch 'default'!
-(did you forget to merge? use push -f to force)
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-subrepo.t Tue Aug 17 16:52:05 2010 +0200
@@ -0,0 +1,584 @@
+ $ rm -rf sub
+ $ mkdir sub
+ $ cd sub
+ $ hg init t
+ $ cd t
+
+first revision, no sub
+
+ $ echo a > a
+ $ hg ci -Am0
+ adding a
+
+add first sub
+
+ $ echo s = s > .hgsub
+ $ hg add .hgsub
+ $ hg init s
+ $ echo a > s/a
+
+issue2232 - committing a subrepo without .hgsub
+
+ $ hg ci -mbad s
+ abort: can't commit subrepos without .hgsub
+
+ $ hg -R s ci -Ams0
+ adding a
+ $ hg sum
+ parent: 0:f7b1eb17ad24 tip
+ 0
+ branch: default
+ commit: 1 added, 1 subrepos
+ update: (current)
+ $ hg ci -m1
+ committing subrepository s
+
+issue 2022 - update -C
+
+ $ echo b > s/a
+ $ hg sum
+ parent: 1:7cf8cfea66e4 tip
+ 1
+ branch: default
+ commit: 1 subrepos
+ update: (current)
+ $ hg co -C 1
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ hg sum
+ parent: 1:7cf8cfea66e4 tip
+ 1
+ branch: default
+ commit: (clean)
+ update: (current)
+
+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 sum
+ parent: 1:7cf8cfea66e4 tip
+ 1
+ branch: default
+ commit: 1 subrepos
+ update: (current)
+ $ hg ci -m2
+ committing subrepository s
+ committing subrepository s/ss
+ $ hg sum
+ parent: 2:df30734270ae tip
+ 2
+ branch: default
+ commit: (clean)
+ update: (current)
+
+bump sub rev
+
+ $ echo b > s/a
+ $ hg -R s ci -ms1
+ $ hg ci -m3
+ committing subrepository s
+
+leave sub dirty
+
+ $ echo c > s/a
+ $ hg ci -m4
+ committing subrepository s
+ $ hg tip -R s
+ changeset: 3:1c833a7a9e3a
+ tag: tip
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: 4
+
+
+check caching
+
+ $ hg co 0
+ 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+ $ hg debugsub
+
+restore
+
+ $ hg co
+ 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ hg debugsub
+ path s
+ source s
+ revision 1c833a7a9e3a4445c711aaf0f012379cd0d4034e
+
+new branch for merge tests
+
+ $ hg co 1
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ echo t = t >> .hgsub
+ $ hg init t
+ $ echo t > t/t
+ $ hg -R t add t
+ adding t/t
+
+5
+
+ $ hg ci -m5 # add sub
+ committing subrepository t
+ created new head
+ $ echo t2 > t/t
+
+6
+
+ $ hg st -R s
+ $ hg ci -m6 # change sub
+ committing subrepository t
+ $ hg debugsub
+ path s
+ source s
+ revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
+ path t
+ source t
+ revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
+ $ echo t3 > t/t
+
+7
+
+ $ hg ci -m7 # change sub again for conflict test
+ committing subrepository t
+ $ hg rm .hgsub
+
+8
+
+ $ hg ci -m8 # remove sub
+
+merge tests
+
+ $ hg co -C 3
+ 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ hg merge 5 # test adding
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ (branch merge, don't forget to commit)
+ $ hg debugsub
+ path s
+ source s
+ revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
+ path t
+ source t
+ revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382
+ $ hg ci -m9
+ created new head
+ $ hg merge 6 --debug # test change
+ searching for copies back to rev 2
+ resolving manifests
+ overwrite None partial False
+ ancestor 1f14a2e2d3ec local f0d2028bf86d+ remote 1831e14459c4
+ .hgsubstate: versions differ -> m
+ updating: .hgsubstate 1/1 files (100.00%)
+ subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
+ subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
+ getting subrepo t
+ resolving manifests
+ overwrite True partial False
+ ancestor 60ca1237c194+ local 60ca1237c194+ remote 6747d179aa9a
+ t: remote is newer -> g
+ updating: t 1/1 files (100.00%)
+ getting t
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ (branch merge, don't forget to commit)
+ $ hg debugsub
+ path s
+ source s
+ revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
+ path t
+ source t
+ revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
+ $ echo conflict > t/t
+ $ hg ci -m10
+ committing subrepository t
+ $ HGMERGE=internal:merge hg merge --debug 7 # test conflict
+ searching for copies back to rev 2
+ resolving manifests
+ overwrite None partial False
+ ancestor 1831e14459c4 local e45c8b14af55+ remote f94576341bcf
+ .hgsubstate: versions differ -> m
+ updating: .hgsubstate 1/1 files (100.00%)
+ subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4
+ subrepo t: both sides changed, merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg
+ merging subrepo t
+ 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
+ updating: t 1/1 files (100.00%)
+ 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 update -C' to abandon
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ (branch merge, don't forget to commit)
+
+should conflict
+
+ $ cat t/t
+ <<<<<<< local
+ conflict
+ =======
+ t3
+ >>>>>>> other
+
+clone
+
+ $ cd ..
+ $ hg clone t tc
+ updating to branch default
+ pulling subrepo s from .*/sub/t/s
+ requesting all changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 4 changesets with 5 changes to 3 files
+ pulling subrepo s/ss from .*/sub/t/s/ss
+ requesting all changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 1 changesets with 1 changes to 1 files
+ pulling subrepo t from .*/sub/t/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
+ $ cd tc
+ $ hg debugsub
+ path s
+ source s
+ revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
+ path t
+ source t
+ revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e
+
+push
+
+ $ echo bah > t/t
+ $ hg ci -m11
+ committing subrepository t
+ $ hg push
+ pushing .*sub/t
+ pushing .*sub/t/s/ss
+ searching for changes
+ no changes found
+ pushing .*sub/t/s
+ searching for changes
+ no changes found
+ pushing .*sub/t/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
+
+ $ echo bah > s/a
+ $ hg ci -m12
+ committing subrepository s
+ $ hg push
+ pushing .*sub/t
+ pushing .*sub/t/s/ss
+ searching for changes
+ no changes found
+ pushing .*sub/t/s
+ searching for changes
+ abort: push creates new remote heads on branch 'default'!
+ (did you forget to merge? use push -f to force)
+ $ hg push -f
+ pushing .*sub/t
+ pushing .*sub/t/s/ss
+ searching for changes
+ no changes found
+ pushing .*sub/t/s
+ searching for changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 1 changesets with 1 changes to 1 files (+1 heads)
+ pushing .*sub/t/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
+
+update
+
+ $ cd ../t
+ $ hg up -C # discard our earlier merge
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ echo blah > t/t
+ $ hg ci -m13
+ committing subrepository t
+
+pull
+
+ $ cd ../tc
+ $ hg 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)
+
+should pull t
+
+ $ hg up
+ pulling subrepo t from .*/sub/t/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
+ $ cat t/t
+ blah
+
+bogus subrepo path aborts
+
+ $ echo 'bogus=[boguspath' >> .hgsub
+ $ hg ci -m 'bogus subrepo path'
+ abort: missing ] in subrepo source
+
+issue 1986
+
+# subrepo layout
+#
+# o 5 br
+# /|
+# o | 4 default
+# | |
+# | o 3 br
+# |/|
+# o | 2 default
+# | |
+# | o 1 br
+# |/
+# o 0 default
+
+ $ cd ..
+ $ rm -rf sub
+ $ hg init main
+ $ cd main
+ $ hg init s
+ $ cd s
+ $ echo a > a
+ $ hg ci -Am1
+ adding a
+ $ hg branch br
+ marked working directory as branch br
+ $ echo a >> a
+ $ hg ci -m1
+ $ hg up default
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ echo b > b
+ $ hg ci -Am1
+ adding b
+ $ hg up br
+ 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ hg merge tip
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ (branch merge, don't forget to commit)
+ $ hg ci -m1
+ $ hg up 2
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ echo c > c
+ $ hg ci -Am1
+ adding c
+ $ hg up 3
+ 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ hg merge 4
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ (branch merge, don't forget to commit)
+ $ hg ci -m1
+
+# main repo layout:
+#
+# * <-- try to merge default into br again
+# .`|
+# . o 5 br --> substate = 5
+# . |
+# o | 4 default --> substate = 4
+# | |
+# | o 3 br --> substate = 2
+# |/|
+# o | 2 default --> substate = 2
+# | |
+# | o 1 br --> substate = 3
+# |/
+# o 0 default --> substate = 2
+
+ $ cd ..
+ $ echo 's = s' > .hgsub
+ $ hg -R s up 2
+ 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ hg ci -Am1
+ adding .hgsub
+ committing subrepository s
+ $ hg branch br
+ marked working directory as branch br
+ $ echo b > b
+ $ hg -R s up 3
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ hg ci -Am1
+ adding b
+ committing subrepository s
+ $ hg up default
+ 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ echo c > c
+ $ hg ci -Am1
+ adding c
+ $ hg up 1
+ 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ hg merge 2
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ (branch merge, don't forget to commit)
+ $ hg ci -m1
+ $ hg up 2
+ 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ hg -R s up 4
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ echo d > d
+ $ hg ci -Am1
+ adding d
+ committing subrepository s
+ $ hg up 3
+ 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+ $ hg -R s up 5
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ echo e > e
+ $ hg ci -Am1
+ adding e
+ committing subrepository s
+
+ $ hg up 5
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ hg merge 4 # try to merge default into br again
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ (branch merge, don't forget to commit)
+ $ cd ..
+
+test subrepo delete from .hgsubstate
+
+ $ hg init testdelete
+ $ mkdir testdelete/nested testdelete/nested2
+ $ hg init testdelete/nested
+ $ hg init testdelete/nested2
+ $ echo test > testdelete/nested/foo
+ $ echo test > testdelete/nested2/foo
+ $ hg -R testdelete/nested add
+ adding testdelete/nested/foo
+ $ hg -R testdelete/nested2 add
+ adding testdelete/nested2/foo
+ $ hg -R testdelete/nested ci -m test
+ $ hg -R testdelete/nested2 ci -m test
+ $ echo nested = nested > testdelete/.hgsub
+ $ echo nested2 = nested2 >> testdelete/.hgsub
+ $ hg -R testdelete add
+ adding testdelete/.hgsub
+ $ hg -R testdelete ci -m "nested 1 & 2 added"
+ committing subrepository nested2
+ committing subrepository nested
+ $ echo nested = nested > testdelete/.hgsub
+ $ hg -R testdelete ci -m "nested 2 deleted"
+ $ cat testdelete/.hgsubstate
+ bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
+ $ hg -R testdelete remove testdelete/.hgsub
+ $ hg -R testdelete ci -m ".hgsub deleted"
+ $ cat testdelete/.hgsubstate
+
+test repository cloning
+
+ $ mkdir mercurial mercurial2
+ $ hg init nested_absolute
+ $ echo test > nested_absolute/foo
+ $ hg -R nested_absolute add
+ adding nested_absolute/foo
+ $ hg -R nested_absolute ci -mtest
+ $ cd mercurial
+ $ hg init nested_relative
+ $ echo test2 > nested_relative/foo2
+ $ hg -R nested_relative add
+ adding nested_relative/foo2
+ $ hg -R nested_relative ci -mtest2
+ $ hg init main
+ $ echo "nested_relative = ../nested_relative" > main/.hgsub
+ $ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub
+ $ hg -R main add
+ adding main/.hgsub
+ $ hg -R main ci -m "add subrepos"
+ committing subrepository nested_relative
+ committing subrepository nested_absolute
+ $ cd ..
+ $ hg clone mercurial/main mercurial2/main
+ updating to branch default
+ 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ cat mercurial2/main/nested_absolute/.hg/hgrc \
+ > mercurial2/main/nested_relative/.hg/hgrc
+ [paths]
+ default = .*/test-subrepo.t/sub/mercurial/nested_absolute
+ [paths]
+ default = .*/test-subrepo.t/sub/mercurial/nested_relative
+ $ rm -rf mercurial mercurial2
+
+issue 1977
+
+ $ hg init repo
+ $ hg init repo/s
+ $ echo a > repo/s/a
+ $ hg -R repo/s ci -Am0
+ adding a
+ $ echo s = s > repo/.hgsub
+ $ hg -R repo ci -Am1
+ adding .hgsub
+ committing subrepository s
+ $ hg clone repo repo2
+ updating to branch default
+ pulling subrepo s from .*/sub/repo/s
+ requesting all changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 1 changesets with 1 changes to 1 files
+ 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ hg -q -R repo2 pull -u
+ $ echo 1 > repo2/s/a
+ $ hg -R repo2/s ci -m2
+ $ hg -q -R repo2/s push
+ $ hg -R repo2/s up -C 0
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ echo 2 > repo2/s/a
+ $ hg -R repo2/s ci -m3
+ created new head
+ $ hg -R repo2 ci -m3
+ committing subrepository s
+ $ hg -q -R repo2 push
+ abort: push creates new remote heads on branch 'default'!
+ (did you forget to merge? use push -f to force)
+ $ hg -R repo update
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ rm -rf repo2 repo
+
+ $ exit 0