mercurial/hg.py
changeset 27354 bced7180db19
parent 27344 43c00ca887d1
child 27402 5184089f5d30
equal deleted inserted replaced
27353:98e59d9e0d77 27354:bced7180db19
   233     requirements += 'shared\n'
   233     requirements += 'shared\n'
   234     destvfs.write('requires', requirements)
   234     destvfs.write('requires', requirements)
   235     destvfs.write('sharedpath', sharedpath)
   235     destvfs.write('sharedpath', sharedpath)
   236 
   236 
   237     r = repository(ui, destwvfs.base)
   237     r = repository(ui, destwvfs.base)
   238 
   238     postshare(srcrepo, r, bookmarks=bookmarks)
   239     default = srcrepo.ui.config('paths', 'default')
       
   240     if default:
       
   241         fp = r.vfs("hgrc", "w", text=True)
       
   242         fp.write("[paths]\n")
       
   243         fp.write("default = %s\n" % default)
       
   244         fp.close()
       
   245 
   239 
   246     if update:
   240     if update:
   247         r.ui.status(_("updating working directory\n"))
   241         r.ui.status(_("updating working directory\n"))
   248         if update is not True:
   242         if update is not True:
   249             checkout = update
   243             checkout = update
   255                 break
   249                 break
   256             except error.RepoLookupError:
   250             except error.RepoLookupError:
   257                 continue
   251                 continue
   258         _update(r, uprev)
   252         _update(r, uprev)
   259 
   253 
       
   254 def postshare(sourcerepo, destrepo, bookmarks=True):
       
   255     """Called after a new shared repo is created.
       
   256 
       
   257     The new repo only has a requirements file and pointer to the source.
       
   258     This function configures additional shared data.
       
   259 
       
   260     Extensions can wrap this function and write additional entries to
       
   261     destrepo/.hg/shared to indicate additional pieces of data to be shared.
       
   262     """
       
   263     default = sourcerepo.ui.config('paths', 'default')
       
   264     if default:
       
   265         fp = destrepo.vfs("hgrc", "w", text=True)
       
   266         fp.write("[paths]\n")
       
   267         fp.write("default = %s\n" % default)
       
   268         fp.close()
       
   269 
   260     if bookmarks:
   270     if bookmarks:
   261         fp = r.vfs('shared', 'w')
   271         fp = destrepo.vfs('shared', 'w')
   262         fp.write('bookmarks\n')
   272         fp.write('bookmarks\n')
   263         fp.close()
   273         fp.close()
   264 
   274 
   265 def copystore(ui, srcrepo, destpath):
   275 def copystore(ui, srcrepo, destpath):
   266     '''copy files from store of srcrepo in destpath
   276     '''copy files from store of srcrepo in destpath