##// END OF EJS Templates
hg: perform update after pulling during clone with share (issue5103)...
Gregory Szorc -
r28632:a2c2dd39 stable
parent child Browse files
Show More
@@ -236,20 +236,7 b' def share(ui, source, dest=None, update='
236
236
237 r = repository(ui, destwvfs.base)
237 r = repository(ui, destwvfs.base)
238 postshare(srcrepo, r, bookmarks=bookmarks)
238 postshare(srcrepo, r, bookmarks=bookmarks)
239
239 _postshareupdate(r, update, checkout=checkout)
240 if update:
241 r.ui.status(_("updating working directory\n"))
242 if update is not True:
243 checkout = update
244 for test in (checkout, 'default', 'tip'):
245 if test is None:
246 continue
247 try:
248 uprev = r.lookup(test)
249 break
250 except error.RepoLookupError:
251 continue
252 _update(r, uprev)
253
240
254 def postshare(sourcerepo, destrepo, bookmarks=True):
241 def postshare(sourcerepo, destrepo, bookmarks=True):
255 """Called after a new shared repo is created.
242 """Called after a new shared repo is created.
@@ -272,6 +259,27 b' def postshare(sourcerepo, destrepo, book'
272 fp.write('bookmarks\n')
259 fp.write('bookmarks\n')
273 fp.close()
260 fp.close()
274
261
262 def _postshareupdate(repo, update, checkout=None):
263 """Maybe perform a working directory update after a shared repo is created.
264
265 ``update`` can be a boolean or a revision to update to.
266 """
267 if not update:
268 return
269
270 repo.ui.status(_("updating working directory\n"))
271 if update is not True:
272 checkout = update
273 for test in (checkout, 'default', 'tip'):
274 if test is None:
275 continue
276 try:
277 uprev = repo.lookup(test)
278 break
279 except error.RepoLookupError:
280 continue
281 _update(repo, uprev)
282
275 def copystore(ui, srcrepo, destpath):
283 def copystore(ui, srcrepo, destpath):
276 '''copy files from store of srcrepo in destpath
284 '''copy files from store of srcrepo in destpath
277
285
@@ -361,7 +369,7 b' def clonewithshare(ui, peeropts, sharepa'
361 rev=rev, update=False, stream=stream)
369 rev=rev, update=False, stream=stream)
362
370
363 sharerepo = repository(ui, path=sharepath)
371 sharerepo = repository(ui, path=sharepath)
364 share(ui, sharerepo, dest=dest, update=update, bookmarks=False)
372 share(ui, sharerepo, dest=dest, update=False, bookmarks=False)
365
373
366 # We need to perform a pull against the dest repo to fetch bookmarks
374 # We need to perform a pull against the dest repo to fetch bookmarks
367 # and other non-store data that isn't shared by default. In the case of
375 # and other non-store data that isn't shared by default. In the case of
@@ -371,6 +379,8 b' def clonewithshare(ui, peeropts, sharepa'
371 destrepo = repository(ui, path=dest)
379 destrepo = repository(ui, path=dest)
372 exchange.pull(destrepo, srcpeer, heads=revs)
380 exchange.pull(destrepo, srcpeer, heads=revs)
373
381
382 _postshareupdate(destrepo, update)
383
374 return srcpeer, peer(ui, peeropts, dest)
384 return srcpeer, peer(ui, peeropts, dest)
375
385
376 def clone(ui, peeropts, source, dest=None, pull=False, rev=None,
386 def clone(ui, peeropts, source, dest=None, pull=False, rev=None,
@@ -774,11 +774,11 b' Clone from repo with content should resu'
774 adding manifests
774 adding manifests
775 adding file changes
775 adding file changes
776 added 3 changesets with 3 changes to 1 files
776 added 3 changesets with 3 changes to 1 files
777 updating working directory
778 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
779 searching for changes
777 searching for changes
780 no changes found
778 no changes found
781 adding remote bookmark bookA
779 adding remote bookmark bookA
780 updating working directory
781 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
782
782
783 The shared repo should have been created
783 The shared repo should have been created
784
784
@@ -804,8 +804,6 b' Clone with existing share dir should res'
804
804
805 $ hg --config share.pool=share clone source1b share-dest1b
805 $ hg --config share.pool=share clone source1b share-dest1b
806 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
806 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
807 updating working directory
808 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
809 searching for changes
807 searching for changes
810 adding changesets
808 adding changesets
811 adding manifests
809 adding manifests
@@ -813,6 +811,8 b' Clone with existing share dir should res'
813 added 4 changesets with 4 changes to 1 files (+4 heads)
811 added 4 changesets with 4 changes to 1 files (+4 heads)
814 adding remote bookmark head1
812 adding remote bookmark head1
815 adding remote bookmark head2
813 adding remote bookmark head2
814 updating working directory
815 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
816
816
817 $ ls share
817 $ ls share
818 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
818 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
@@ -831,6 +831,17 b' Default path should be source, not share'
831 $ hg -R share-dest1b config paths.default
831 $ hg -R share-dest1b config paths.default
832 $TESTTMP/source1a (glob)
832 $TESTTMP/source1a (glob)
833
833
834 Checked out revision should be head of default branch
835
836 $ hg -R share-dest1b log -r .
837 changeset: 4:99f71071f117
838 bookmark: head2
839 parent: 0:b5f04eac9d8f
840 user: test
841 date: Thu Jan 01 00:00:00 1970 +0000
842 summary: head2
843
844
834 Clone from unrelated repo should result in new share
845 Clone from unrelated repo should result in new share
835
846
836 $ hg --config share.pool=share clone source2 share-dest2
847 $ hg --config share.pool=share clone source2 share-dest2
@@ -840,10 +851,10 b' Clone from unrelated repo should result '
840 adding manifests
851 adding manifests
841 adding file changes
852 adding file changes
842 added 2 changesets with 2 changes to 1 files
853 added 2 changesets with 2 changes to 1 files
854 searching for changes
855 no changes found
843 updating working directory
856 updating working directory
844 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
857 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
845 searching for changes
846 no changes found
847
858
848 $ ls share
859 $ ls share
849 22aeff664783fd44c6d9b435618173c118c3448e
860 22aeff664783fd44c6d9b435618173c118c3448e
@@ -858,11 +869,11 b' remote naming mode works as advertised'
858 adding manifests
869 adding manifests
859 adding file changes
870 adding file changes
860 added 3 changesets with 3 changes to 1 files
871 added 3 changesets with 3 changes to 1 files
861 updating working directory
862 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
863 searching for changes
872 searching for changes
864 no changes found
873 no changes found
865 adding remote bookmark bookA
874 adding remote bookmark bookA
875 updating working directory
876 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
866
877
867 $ ls shareremote
878 $ ls shareremote
868 195bb1fcdb595c14a6c13e0269129ed78f6debde
879 195bb1fcdb595c14a6c13e0269129ed78f6debde
@@ -874,12 +885,12 b' remote naming mode works as advertised'
874 adding manifests
885 adding manifests
875 adding file changes
886 adding file changes
876 added 6 changesets with 6 changes to 1 files (+4 heads)
887 added 6 changesets with 6 changes to 1 files (+4 heads)
877 updating working directory
878 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
879 searching for changes
888 searching for changes
880 no changes found
889 no changes found
881 adding remote bookmark head1
890 adding remote bookmark head1
882 adding remote bookmark head2
891 adding remote bookmark head2
892 updating working directory
893 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
883
894
884 $ ls shareremote
895 $ ls shareremote
885 195bb1fcdb595c14a6c13e0269129ed78f6debde
896 195bb1fcdb595c14a6c13e0269129ed78f6debde
@@ -893,10 +904,10 b' request to clone a single revision is re'
893 adding manifests
904 adding manifests
894 adding file changes
905 adding file changes
895 added 2 changesets with 2 changes to 1 files
906 added 2 changesets with 2 changes to 1 files
907 no changes found
908 adding remote bookmark head1
896 updating working directory
909 updating working directory
897 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
910 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
898 no changes found
899 adding remote bookmark head1
900
911
901 $ hg -R share-1arev log -G
912 $ hg -R share-1arev log -G
902 @ changeset: 1:4a8dc1ab4c13
913 @ changeset: 1:4a8dc1ab4c13
@@ -916,8 +927,6 b' making another clone should only pull do'
916
927
917 $ hg --config share.pool=sharerevs clone -r 99f71071f117 source1b share-1brev
928 $ hg --config share.pool=sharerevs clone -r 99f71071f117 source1b share-1brev
918 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
929 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
919 updating working directory
920 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
921 searching for changes
930 searching for changes
922 adding changesets
931 adding changesets
923 adding manifests
932 adding manifests
@@ -925,9 +934,11 b' making another clone should only pull do'
925 added 1 changesets with 1 changes to 1 files (+1 heads)
934 added 1 changesets with 1 changes to 1 files (+1 heads)
926 adding remote bookmark head1
935 adding remote bookmark head1
927 adding remote bookmark head2
936 adding remote bookmark head2
937 updating working directory
938 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
928
939
929 $ hg -R share-1brev log -G
940 $ hg -R share-1brev log -G
930 o changeset: 2:99f71071f117
941 @ changeset: 2:99f71071f117
931 | bookmark: head2
942 | bookmark: head2
932 | tag: tip
943 | tag: tip
933 | parent: 0:b5f04eac9d8f
944 | parent: 0:b5f04eac9d8f
@@ -935,7 +946,7 b' making another clone should only pull do'
935 | date: Thu Jan 01 00:00:00 1970 +0000
946 | date: Thu Jan 01 00:00:00 1970 +0000
936 | summary: head2
947 | summary: head2
937 |
948 |
938 | @ changeset: 1:4a8dc1ab4c13
949 | o changeset: 1:4a8dc1ab4c13
939 |/ bookmark: head1
950 |/ bookmark: head1
940 | user: test
951 | user: test
941 | date: Thu Jan 01 00:00:00 1970 +0000
952 | date: Thu Jan 01 00:00:00 1970 +0000
@@ -955,9 +966,9 b' Request to clone a single branch is resp'
955 adding manifests
966 adding manifests
956 adding file changes
967 adding file changes
957 added 2 changesets with 2 changes to 1 files
968 added 2 changesets with 2 changes to 1 files
969 no changes found
958 updating working directory
970 updating working directory
959 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
971 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
960 no changes found
961
972
962 $ hg -R share-1bbranch1 log -G
973 $ hg -R share-1bbranch1 log -G
963 o changeset: 1:5f92a6c1a1b1
974 o changeset: 1:5f92a6c1a1b1
@@ -975,13 +986,13 b' Request to clone a single branch is resp'
975
986
976 $ hg --config share.pool=sharebranch clone -b branch2 source1b share-1bbranch2
987 $ hg --config share.pool=sharebranch clone -b branch2 source1b share-1bbranch2
977 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
988 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
978 updating working directory
979 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
980 searching for changes
989 searching for changes
981 adding changesets
990 adding changesets
982 adding manifests
991 adding manifests
983 adding file changes
992 adding file changes
984 added 1 changesets with 1 changes to 1 files (+1 heads)
993 added 1 changesets with 1 changes to 1 files (+1 heads)
994 updating working directory
995 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
985
996
986 $ hg -R share-1bbranch2 log -G
997 $ hg -R share-1bbranch2 log -G
987 o changeset: 2:6bacf4683960
998 o changeset: 2:6bacf4683960
@@ -1056,18 +1067,18 b" Cloning into pooled storage doesn't race"
1056 adding manifests
1067 adding manifests
1057 adding file changes
1068 adding file changes
1058 added 3 changesets with 3 changes to 1 files
1069 added 3 changesets with 3 changes to 1 files
1059 updating working directory
1060 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1061 searching for changes
1070 searching for changes
1062 no changes found
1071 no changes found
1063 adding remote bookmark bookA
1072 adding remote bookmark bookA
1073 updating working directory
1074 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1064
1075
1065 $ cat race2.log
1076 $ cat race2.log
1066 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1077 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1067 updating working directory
1068 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1069 waiting for lock on repository share-destrace2 held by * (glob)
1078 waiting for lock on repository share-destrace2 held by * (glob)
1070 got lock after \d+ seconds (re)
1079 got lock after \d+ seconds (re)
1071 searching for changes
1080 searching for changes
1072 no changes found
1081 no changes found
1073 adding remote bookmark bookA
1082 adding remote bookmark bookA
1083 updating working directory
1084 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
General Comments 0
You need to be logged in to leave comments. Login now