hgext/shelve.py
changeset 35005 aad6b9fdfc75
parent 34496 18cd210535b3
child 35912 78b985c75731
equal deleted inserted replaced
35004:3ebae3ec4664 35005:aad6b9fdfc75
    41     mdiff,
    41     mdiff,
    42     merge,
    42     merge,
    43     node as nodemod,
    43     node as nodemod,
    44     patch,
    44     patch,
    45     phases,
    45     phases,
       
    46     pycompat,
    46     registrar,
    47     registrar,
    47     repair,
    48     repair,
    48     scmutil,
    49     scmutil,
    49     templatefilters,
    50     templatefilters,
    50     util,
    51     util,
   378         overrides = {('phases', 'new-commit'): phases.secret}
   379         overrides = {('phases', 'new-commit'): phases.secret}
   379         try:
   380         try:
   380             editor_ = False
   381             editor_ = False
   381             if editor:
   382             if editor:
   382                 editor_ = cmdutil.getcommiteditor(editform='shelve.shelve',
   383                 editor_ = cmdutil.getcommiteditor(editform='shelve.shelve',
   383                                                   **opts)
   384                                                   **pycompat.strkwargs(opts))
   384             with repo.ui.configoverride(overrides):
   385             with repo.ui.configoverride(overrides):
   385                 return repo.commit(message, shelveuser, opts.get('date'),
   386                 return repo.commit(message, shelveuser, opts.get('date'),
   386                                    match, editor=editor_, extra=extra)
   387                                    match, editor=editor_, extra=extra)
   387         finally:
   388         finally:
   388             if hasmq:
   389             if hasmq:
   389                 repo.mq.checkapplied = saved
   390                 repo.mq.checkapplied = saved
   390 
   391 
   391     def interactivecommitfunc(ui, repo, *pats, **opts):
   392     def interactivecommitfunc(ui, repo, *pats, **opts):
       
   393         opts = pycompat.byteskwargs(opts)
   392         match = scmutil.match(repo['.'], pats, {})
   394         match = scmutil.match(repo['.'], pats, {})
   393         message = opts['message']
   395         message = opts['message']
   394         return commitfunc(ui, repo, message, match, opts)
   396         return commitfunc(ui, repo, message, match, opts)
   395 
   397 
   396     return interactivecommitfunc if interactive else commitfunc
   398     return interactivecommitfunc if interactive else commitfunc
   463         if not interactive:
   465         if not interactive:
   464             node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
   466             node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
   465         else:
   467         else:
   466             node = cmdutil.dorecord(ui, repo, commitfunc, None,
   468             node = cmdutil.dorecord(ui, repo, commitfunc, None,
   467                                     False, cmdutil.recordfilter, *pats,
   469                                     False, cmdutil.recordfilter, *pats,
   468                                     **opts)
   470                                     **pycompat.strkwargs(opts))
   469         if not node:
   471         if not node:
   470             _nothingtoshelvemessaging(ui, repo, pats, opts)
   472             _nothingtoshelvemessaging(ui, repo, pats, opts)
   471             return 1
   473             return 1
   472 
   474 
   473         _shelvecreatedcommit(repo, node, name)
   475         _shelvecreatedcommit(repo, node, name)
   850     """
   852     """
   851     with repo.wlock():
   853     with repo.wlock():
   852         return _dounshelve(ui, repo, *shelved, **opts)
   854         return _dounshelve(ui, repo, *shelved, **opts)
   853 
   855 
   854 def _dounshelve(ui, repo, *shelved, **opts):
   856 def _dounshelve(ui, repo, *shelved, **opts):
       
   857     opts = pycompat.byteskwargs(opts)
   855     abortf = opts.get('abort')
   858     abortf = opts.get('abort')
   856     continuef = opts.get('continue')
   859     continuef = opts.get('continue')
   857     if not abortf and not continuef:
   860     if not abortf and not continuef:
   858         cmdutil.checkunfinished(repo)
   861         cmdutil.checkunfinished(repo)
   859     shelved = list(shelved)
   862     shelved = list(shelved)
  1008     and description; use ``--patch`` or ``--stat`` for more details.
  1011     and description; use ``--patch`` or ``--stat`` for more details.
  1009 
  1012 
  1010     To delete specific shelved changes, use ``--delete``. To delete
  1013     To delete specific shelved changes, use ``--delete``. To delete
  1011     all shelved changes, use ``--cleanup``.
  1014     all shelved changes, use ``--cleanup``.
  1012     '''
  1015     '''
       
  1016     opts = pycompat.byteskwargs(opts)
  1013     allowables = [
  1017     allowables = [
  1014         ('addremove', {'create'}), # 'create' is pseudo action
  1018         ('addremove', {'create'}), # 'create' is pseudo action
  1015         ('unknown', {'create'}),
  1019         ('unknown', {'create'}),
  1016         ('cleanup', {'cleanup'}),
  1020         ('cleanup', {'cleanup'}),
  1017 #       ('date', {'create'}), # ignored for passing '--date "0 0"' in tests
  1021 #       ('date', {'create'}), # ignored for passing '--date "0 0"' in tests