##// END OF EJS Templates
hg: extract post share update logic into own function...
Gregory Szorc -
r28201:60adda1a default
parent child Browse files
Show More
@@ -236,20 +236,7 b' def share(ui, source, dest=None, update='
236 236
237 237 r = repository(ui, destwvfs.base)
238 238 postshare(srcrepo, r, bookmarks=bookmarks)
239
240 if update:
241 r.ui.status(_("updating working directory\n"))
242 if update is not True:
243 checkout = update
244 for test in (checkout, 'default', 'tip'):
245 if test is None:
246 continue
247 try:
248 uprev = r.lookup(test)
249 break
250 except error.RepoLookupError:
251 continue
252 _update(r, uprev)
239 _postshareupdate(r, update, checkout=checkout)
253 240
254 241 def postshare(sourcerepo, destrepo, bookmarks=True):
255 242 """Called after a new shared repo is created.
@@ -272,6 +259,27 b' def postshare(sourcerepo, destrepo, book'
272 259 fp.write('bookmarks\n')
273 260 fp.close()
274 261
262 def _postshareupdate(repo, update, checkout=None):
263 """Maybe perform a working directory update after a shared repo is created.
264
265 ``update`` can be a boolean or a revision to update to.
266 """
267 if not update:
268 return
269
270 repo.ui.status(_("updating working directory\n"))
271 if update is not True:
272 checkout = update
273 for test in (checkout, 'default', 'tip'):
274 if test is None:
275 continue
276 try:
277 uprev = repo.lookup(test)
278 break
279 except error.RepoLookupError:
280 continue
281 _update(repo, uprev)
282
275 283 def copystore(ui, srcrepo, destpath):
276 284 '''copy files from store of srcrepo in destpath
277 285
General Comments 0
You need to be logged in to leave comments. Login now