tests/test-bookmarks-corner-case.t
branchstable
changeset 42507 febf5c8215c1
parent 42506 cd73e51a1f8a
child 42508 c4d1807b165f
equal deleted inserted replaced
42506:cd73e51a1f8a 42507:febf5c8215c1
   118   $ cat > bookrace.py << EOF
   118   $ cat > bookrace.py << EOF
   119   > import os
   119   > import os
   120   > import time
   120   > import time
   121   > import atexit
   121   > import atexit
   122   > from mercurial import error, extensions, bookmarks
   122   > from mercurial import error, extensions, bookmarks
   123   > def wrapinit(orig, self, repo):
   123   > 
       
   124   > def wait():
   124   >     if not os.path.exists('push-A-started'):
   125   >     if not os.path.exists('push-A-started'):
   125   >         print('setting raced push up')
   126   >         print('setting raced push up')
   126   >         with open('push-A-started', 'w'):
   127   >         with open('push-A-started', 'w'):
   127   >             pass
   128   >             pass
   128   >     clock = 300
   129   >     clock = 300
   129   >     while not os.path.exists('push-B-done'):
   130   >     while not os.path.exists('push-B-done'):
   130   >         clock -= 1
   131   >         clock -= 1
   131   >         if clock <= 0:
   132   >         if clock <= 0:
   132   >             raise error.Abort("race scenario timed out")
   133   >             raise error.Abort("race scenario timed out")
   133   >         time.sleep(0.1)
   134   >         time.sleep(0.1)
       
   135   > 
       
   136   > def wrapinit(orig, self, repo):
       
   137   >     wait()
   134   >     return orig(self, repo)
   138   >     return orig(self, repo)
   135   > def uisetup(ui):
   139   > def uisetup(ui):
   136   >     extensions.wrapfunction(bookmarks.bmstore, '__init__', wrapinit)
   140   >     extensions.wrapfunction(bookmarks.bmstore, '__init__', wrapinit)
   137   > def e():
   141   > def e():
   138   >     with open('push-A-done', 'w'):
   142   >     with open('push-A-done', 'w'):