tests/test-share.t
changeset 23548 141baca16059
parent 22046 7a9cbb315d84
child 23614 cd79fb4d75fd
equal deleted inserted replaced
23547:21446f4d5c62 23548:141baca16059
   126   $ hg id -r tip
   126   $ hg id -r tip
   127   c2e0ac586386 tip
   127   c2e0ac586386 tip
   128 
   128 
   129   $ cd ..
   129   $ cd ..
   130 
   130 
       
   131 
       
   132 test sharing bookmarks (manually add bookmarks.shared file for now)
       
   133 
       
   134   $ hg share repo1 repo3 && touch repo3/.hg/bookmarks.shared
       
   135   updating working directory
       
   136   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   137   $ cd repo1
       
   138   $ hg bookmark bm1
       
   139   $ hg bookmarks
       
   140    * bm1                       2:c2e0ac586386
       
   141   $ cd ../repo2
       
   142   $ hg book bm2
       
   143   $ hg bookmarks
       
   144    * bm2                       3:0e6e70d1d5f1
       
   145   $ cd ../repo3
       
   146   $ hg bookmarks
       
   147      bm1                       2:c2e0ac586386
       
   148   $ hg book bm3
       
   149   $ hg bookmarks
       
   150      bm1                       2:c2e0ac586386
       
   151    * bm3                       2:c2e0ac586386
       
   152   $ cd ../repo1
       
   153   $ hg bookmarks
       
   154    * bm1                       2:c2e0ac586386
       
   155      bm3                       2:c2e0ac586386
       
   156 
       
   157 test that commits work
       
   158 
       
   159   $ echo 'shared bookmarks' > a
       
   160   $ hg commit -m 'testing shared bookmarks'
       
   161   $ hg bookmarks
       
   162    * bm1                       3:b87954705719
       
   163      bm3                       2:c2e0ac586386
       
   164   $ cd ../repo3
       
   165   $ hg bookmarks
       
   166      bm1                       3:b87954705719
       
   167    * bm3                       2:c2e0ac586386
       
   168   $ echo 'more shared bookmarks' > a
       
   169   $ hg commit -m 'testing shared bookmarks'
       
   170   created new head
       
   171   $ hg bookmarks
       
   172      bm1                       3:b87954705719
       
   173    * bm3                       4:62f4ded848e4
       
   174   $ cd ../repo1
       
   175   $ hg bookmarks
       
   176    * bm1                       3:b87954705719
       
   177      bm3                       4:62f4ded848e4
       
   178   $ cd ..
       
   179 
       
   180 test pushing bookmarks works
       
   181 
       
   182   $ hg clone repo3 repo4
       
   183   updating to branch default
       
   184   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   185   $ cd repo4
       
   186   $ hg boo bm4
       
   187   $ echo foo > b
       
   188   $ hg commit -m 'foo in b'
       
   189   $ hg boo
       
   190      bm1                       3:b87954705719
       
   191      bm3                       4:62f4ded848e4
       
   192    * bm4                       5:92793bfc8cad
       
   193   $ hg push -B bm4
       
   194   pushing to $TESTTMP/repo3 (glob)
       
   195   searching for changes
       
   196   adding changesets
       
   197   adding manifests
       
   198   adding file changes
       
   199   added 1 changesets with 1 changes to 1 files
       
   200   exporting bookmark bm4
       
   201   $ cd ../repo1
       
   202   $ hg bookmarks
       
   203    * bm1                       3:b87954705719
       
   204      bm3                       4:62f4ded848e4
       
   205      bm4                       5:92793bfc8cad
       
   206   $ cd ../repo3
       
   207   $ hg bookmarks
       
   208      bm1                       3:b87954705719
       
   209    * bm3                       4:62f4ded848e4
       
   210      bm4                       5:92793bfc8cad
       
   211   $ cd ..
       
   212 
       
   213 test behavior when sharing a shared repo
       
   214 
       
   215   $ hg share repo3 repo5 && touch repo5/.hg/bookmarks.shared
       
   216   updating working directory
       
   217   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   218   $ cd repo5
       
   219   $ hg book
       
   220      bm1                       3:b87954705719
       
   221      bm3                       4:62f4ded848e4
       
   222      bm4                       5:92793bfc8cad
       
   223   $ cd ..
       
   224 
       
   225 test what happens when an active bookmark is deleted
       
   226 
       
   227   $ cd repo1
       
   228   $ hg boo -d bm3
       
   229   $ hg boo
       
   230    * bm1                       3:b87954705719
       
   231      bm4                       5:92793bfc8cad
       
   232   $ cd ../repo3
       
   233   $ hg boo
       
   234      bm1                       3:b87954705719
       
   235      bm4                       5:92793bfc8cad
       
   236   $ cd ..
       
   237 
       
   238 verify that bookmarks are not written on failed transaction
       
   239 
       
   240   $ cat > failpullbookmarks.py << EOF
       
   241   > """A small extension that makes bookmark pulls fail, for testing"""
       
   242   > from mercurial import extensions, exchange, error
       
   243   > def _pullbookmarks(orig, pullop):
       
   244   >     orig(pullop)
       
   245   >     raise error.HookAbort('forced failure by extension')
       
   246   > def extsetup(ui):
       
   247   >     extensions.wrapfunction(exchange, '_pullbookmarks', _pullbookmarks)
       
   248   > EOF
       
   249   $ cd repo4
       
   250   $ hg boo
       
   251      bm1                       3:b87954705719
       
   252      bm3                       4:62f4ded848e4
       
   253    * bm4                       5:92793bfc8cad
       
   254   $ cd ../repo3
       
   255   $ hg boo
       
   256      bm1                       3:b87954705719
       
   257      bm4                       5:92793bfc8cad
       
   258   $ hg --config "extensions.failpullbookmarks=$TESTTMP/failpullbookmarks.py" pull $TESTTMP/repo4
       
   259   pulling from $TESTTMP/repo4 (glob)
       
   260   searching for changes
       
   261   no changes found
       
   262   adding remote bookmark bm3
       
   263   abort: forced failure by extension
       
   264   [255]
       
   265   $ hg boo
       
   266      bm1                       3:b87954705719
       
   267      bm4                       5:92793bfc8cad
       
   268   $ hg pull $TESTTMP/repo4
       
   269   pulling from $TESTTMP/repo4 (glob)
       
   270   searching for changes
       
   271   no changes found
       
   272   adding remote bookmark bm3
       
   273   $ hg boo
       
   274      bm1                       3:b87954705719
       
   275    * bm3                       4:62f4ded848e4
       
   276      bm4                       5:92793bfc8cad
       
   277   $ cd ..
       
   278 
       
   279 verify bookmark behavior after unshare
       
   280 
       
   281   $ cd repo3
       
   282   $ hg unshare
       
   283   $ hg boo
       
   284      bm1                       3:b87954705719
       
   285    * bm3                       4:62f4ded848e4
       
   286      bm4                       5:92793bfc8cad
       
   287   $ hg boo -d bm4
       
   288   $ hg boo bm5
       
   289   $ hg boo
       
   290      bm1                       3:b87954705719
       
   291      bm3                       4:62f4ded848e4
       
   292    * bm5                       4:62f4ded848e4
       
   293   $ cd ../repo1
       
   294   $ hg boo
       
   295    * bm1                       3:b87954705719
       
   296      bm3                       4:62f4ded848e4
       
   297      bm4                       5:92793bfc8cad
       
   298   $ cd ..
       
   299 
   131 Explicitly kill daemons to let the test exit on Windows
   300 Explicitly kill daemons to let the test exit on Windows
   132 
   301 
   133   $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
   302   $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
   134 
   303