hgext/amend.py
changeset 43077 687b865b95ad
parent 43076 2372284d9457
child 47427 6ce89165eaa0
equal deleted inserted replaced
43076:2372284d9457 43077:687b865b95ad
    22 
    22 
    23 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
    23 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
    24 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
    24 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
    25 # be specifying the version(s) of Mercurial they are tested with, or
    25 # be specifying the version(s) of Mercurial they are tested with, or
    26 # leave the attribute unspecified.
    26 # leave the attribute unspecified.
    27 testedwith = 'ships-with-hg-core'
    27 testedwith = b'ships-with-hg-core'
    28 
    28 
    29 cmdtable = {}
    29 cmdtable = {}
    30 command = registrar.command(cmdtable)
    30 command = registrar.command(cmdtable)
    31 
    31 
    32 
    32 
    33 @command(
    33 @command(
    34     'amend',
    34     b'amend',
    35     [
    35     [
    36         (
    36         (
    37             'A',
    37             b'A',
    38             'addremove',
    38             b'addremove',
    39             None,
    39             None,
    40             _('mark new/missing files as added/removed before committing'),
    40             _(b'mark new/missing files as added/removed before committing'),
    41         ),
    41         ),
    42         ('e', 'edit', None, _('invoke editor on commit messages')),
    42         (b'e', b'edit', None, _(b'invoke editor on commit messages')),
    43         ('i', 'interactive', None, _('use interactive mode')),
    43         (b'i', b'interactive', None, _(b'use interactive mode')),
    44         (
    44         (
    45             b'',
    45             b'',
    46             b'close-branch',
    46             b'close-branch',
    47             None,
    47             None,
    48             _(b'mark a branch as closed, hiding it from the branch list'),
    48             _(b'mark a branch as closed, hiding it from the branch list'),
    49         ),
    49         ),
    50         (b's', b'secret', None, _(b'use the secret phase for committing')),
    50         (b's', b'secret', None, _(b'use the secret phase for committing')),
    51         ('n', 'note', '', _('store a note on the amend')),
    51         (b'n', b'note', b'', _(b'store a note on the amend')),
    52     ]
    52     ]
    53     + cmdutil.walkopts
    53     + cmdutil.walkopts
    54     + cmdutil.commitopts
    54     + cmdutil.commitopts
    55     + cmdutil.commitopts2
    55     + cmdutil.commitopts2
    56     + cmdutil.commitopts3,
    56     + cmdutil.commitopts3,
    57     _('[OPTION]... [FILE]...'),
    57     _(b'[OPTION]... [FILE]...'),
    58     helpcategory=command.CATEGORY_COMMITTING,
    58     helpcategory=command.CATEGORY_COMMITTING,
    59     inferrepo=True,
    59     inferrepo=True,
    60 )
    60 )
    61 def amend(ui, repo, *pats, **opts):
    61 def amend(ui, repo, *pats, **opts):
    62     """amend the working copy parent with all or specified outstanding changes
    62     """amend the working copy parent with all or specified outstanding changes
    68     """
    68     """
    69     opts = pycompat.byteskwargs(opts)
    69     opts = pycompat.byteskwargs(opts)
    70     cmdutil.checknotesize(ui, opts)
    70     cmdutil.checknotesize(ui, opts)
    71 
    71 
    72     with repo.wlock(), repo.lock():
    72     with repo.wlock(), repo.lock():
    73         if not opts.get('logfile'):
    73         if not opts.get(b'logfile'):
    74             opts['message'] = opts.get('message') or repo['.'].description()
    74             opts[b'message'] = opts.get(b'message') or repo[b'.'].description()
    75         opts['amend'] = True
    75         opts[b'amend'] = True
    76         return commands._docommit(ui, repo, *pats, **pycompat.strkwargs(opts))
    76         return commands._docommit(ui, repo, *pats, **pycompat.strkwargs(opts))