comparison hgext/shelve.py @ 39342:d52fa7ddd1ac

shelve: move createcmd next to _docreatecmd It is simpler not to have to jump around the file all the time.
author Boris Feld <boris.feld@octobus.net>
date Thu, 23 Aug 2018 00:51:38 +0200
parents ad24b581e4d9
children bab58b1d87c7
comparison
equal deleted inserted replaced
39341:ca2f4dabf51d 39342:d52fa7ddd1ac
321 narrowspec.savebackup(repo, narrowspecbackupname) 321 narrowspec.savebackup(repo, narrowspecbackupname)
322 tr.abort() 322 tr.abort()
323 narrowspec.restorebackup(repo, narrowspecbackupname) 323 narrowspec.restorebackup(repo, narrowspecbackupname)
324 repo.dirstate.restorebackup(None, dirstatebackupname) 324 repo.dirstate.restorebackup(None, dirstatebackupname)
325 325
326 def createcmd(ui, repo, pats, opts):
327 """subcommand that creates a new shelve"""
328 with repo.wlock():
329 cmdutil.checkunfinished(repo)
330 return _docreatecmd(ui, repo, pats, opts)
331
332 def getshelvename(repo, parent, opts): 326 def getshelvename(repo, parent, opts):
333 """Decide on the name this shelve is going to have""" 327 """Decide on the name this shelve is going to have"""
334 def gennames(): 328 def gennames():
335 yield label 329 yield label
336 for i in itertools.count(1): 330 for i in itertools.count(1):
427 extra['shelve_unknown'] = '\0'.join(s.unknown) 421 extra['shelve_unknown'] = '\0'.join(s.unknown)
428 repo[None].add(s.unknown) 422 repo[None].add(s.unknown)
429 423
430 def _finishshelve(repo): 424 def _finishshelve(repo):
431 _aborttransaction(repo) 425 _aborttransaction(repo)
426
427 def createcmd(ui, repo, pats, opts):
428 """subcommand that creates a new shelve"""
429 with repo.wlock():
430 cmdutil.checkunfinished(repo)
431 return _docreatecmd(ui, repo, pats, opts)
432 432
433 def _docreatecmd(ui, repo, pats, opts): 433 def _docreatecmd(ui, repo, pats, opts):
434 wctx = repo[None] 434 wctx = repo[None]
435 parents = wctx.parents() 435 parents = wctx.parents()
436 if len(parents) > 1: 436 if len(parents) > 1: