Comments
Patch
@@ -231,30 +231,17 @@ def share(ui, source, dest=None, update=
raise
requirements += 'shared\n'
destvfs.write('requires', requirements)
destvfs.write('sharedpath', sharedpath)
r = repository(ui, destwvfs.base)
postshare(srcrepo, r, bookmarks=bookmarks)
-
- if update:
- r.ui.status(_("updating working directory\n"))
- if update is not True:
- checkout = update
- for test in (checkout, 'default', 'tip'):
- if test is None:
- continue
- try:
- uprev = r.lookup(test)
- break
- except error.RepoLookupError:
- continue
- _update(r, uprev)
+ _postshareupdate(r, update, checkout=checkout)
def postshare(sourcerepo, destrepo, bookmarks=True):
"""Called after a new shared repo is created.
The new repo only has a requirements file and pointer to the source.
This function configures additional shared data.
Extensions can wrap this function and write additional entries to
@@ -267,16 +254,37 @@ def postshare(sourcerepo, destrepo, book
fp.write("default = %s\n" % default)
fp.close()
if bookmarks:
fp = destrepo.vfs('shared', 'w')
fp.write('bookmarks\n')
fp.close()
+def _postshareupdate(repo, update, checkout=None):
+ """Maybe perform a working directory update after a shared repo is created.
+
+ ``update`` can be a boolean or a revision to update to.
+ """
+ if not update:
+ return
+
+ repo.ui.status(_("updating working directory\n"))
+ if update is not True:
+ checkout = update
+ for test in (checkout, 'default', 'tip'):
+ if test is None:
+ continue
+ try:
+ uprev = repo.lookup(test)
+ break
+ except error.RepoLookupError:
+ continue
+ _update(repo, uprev)
+
def copystore(ui, srcrepo, destpath):
'''copy files from store of srcrepo in destpath
returns destlock
'''
destlock = None
try:
hardlink = None