mercurial/hg.py
changeset 39849 d3d4b4b5f725
parent 39848 4ece3cdfd907
child 40324 6637b079ae45
--- a/mercurial/hg.py	Wed Sep 19 17:05:59 2018 -0700
+++ b/mercurial/hg.py	Wed Sep 19 17:27:37 2018 -0700
@@ -259,12 +259,17 @@
         srcrepo = source.local()
         checkout = None
 
+    shareditems = set()
+    if bookmarks:
+        shareditems.add(sharedbookmarks)
+
     r = repository(ui, dest, create=True, createopts={
         'sharedrepo': srcrepo,
         'sharedrelative': relative,
+        'shareditems': shareditems,
     })
 
-    postshare(srcrepo, r, bookmarks=bookmarks, defaultpath=defaultpath)
+    postshare(srcrepo, r, defaultpath=defaultpath)
     _postshareupdate(r, update, checkout=checkout)
     return r
 
@@ -315,7 +320,7 @@
 
     return newrepo
 
-def postshare(sourcerepo, destrepo, bookmarks=True, defaultpath=None):
+def postshare(sourcerepo, destrepo, defaultpath=None):
     """Called after a new shared repo is created.
 
     The new repo only has a requirements file and pointer to the source.
@@ -330,10 +335,6 @@
                     'default = %s\n')
         destrepo.vfs.write('hgrc', util.tonativeeol(template % default))
 
-    with destrepo.wlock():
-        if bookmarks:
-            destrepo.vfs.write('shared', sharedbookmarks + '\n')
-
 def _postshareupdate(repo, update, checkout=None):
     """Maybe perform a working directory update after a shared repo is created.