mercurial/commands.py
changeset 31464 7b5fb4b0c0e8
parent 31436 b2fb0fd239b8
child 31472 55df8fa15b09
equal deleted inserted replaced
31463:a5bad127128d 31464:7b5fb4b0c0e8
  1700         if node == old.node():
  1700         if node == old.node():
  1701             ui.status(_("nothing changed\n"))
  1701             ui.status(_("nothing changed\n"))
  1702             return 1
  1702             return 1
  1703     else:
  1703     else:
  1704         def commitfunc(ui, repo, message, match, opts):
  1704         def commitfunc(ui, repo, message, match, opts):
  1705             backup = ui.backupconfig('phases', 'new-commit')
  1705             overrides = {}
       
  1706             if opts.get('secret'):
       
  1707                 overrides[('phases', 'new-commit')] = 'secret'
       
  1708 
  1706             baseui = repo.baseui
  1709             baseui = repo.baseui
  1707             basebackup = baseui.backupconfig('phases', 'new-commit')
  1710             with baseui.configoverride(overrides, 'commit'):
  1708             try:
  1711                 with ui.configoverride(overrides, 'commit'):
  1709                 if opts.get('secret'):
  1712                     editform = cmdutil.mergeeditform(repo[None],
  1710                     ui.setconfig('phases', 'new-commit', 'secret', 'commit')
  1713                                                      'commit.normal')
  1711                     # Propagate to subrepos
  1714                     editor = cmdutil.getcommiteditor(editform=editform, **opts)
  1712                     baseui.setconfig('phases', 'new-commit', 'secret', 'commit')
  1715                     return repo.commit(message,
  1713 
  1716                                        opts.get('user'),
  1714                 editform = cmdutil.mergeeditform(repo[None], 'commit.normal')
  1717                                        opts.get('date'),
  1715                 editor = cmdutil.getcommiteditor(editform=editform, **opts)
  1718                                        match,
  1716                 return repo.commit(message, opts.get('user'), opts.get('date'),
  1719                                        editor=editor,
  1717                                    match,
  1720                                        extra=extra)
  1718                                    editor=editor,
       
  1719                                    extra=extra)
       
  1720             finally:
       
  1721                 ui.restoreconfig(backup)
       
  1722                 repo.baseui.restoreconfig(basebackup)
       
  1723 
       
  1724 
  1721 
  1725         node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
  1722         node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
  1726 
  1723 
  1727         if not node:
  1724         if not node:
  1728             stat = cmdutil.postcommitstatus(repo, pats, opts)
  1725             stat = cmdutil.postcommitstatus(repo, pats, opts)