--- a/hgext3rd/evolve/__init__.py Wed Jul 12 16:09:08 2017 +0200
+++ b/hgext3rd/evolve/__init__.py Tue Jul 11 10:38:01 2017 +0200
@@ -270,7 +270,7 @@
scmutil,
)
-from mercurial.commands import walkopts, commitopts, commitopts2, mergetoolopts
+from mercurial.commands import commitopts, commitopts2, mergetoolopts
from mercurial.i18n import _
from mercurial.node import nullid
@@ -278,6 +278,7 @@
checkheads,
compat,
debugcmd,
+ evocommands,
exthelper,
metadata,
obscache,
@@ -313,7 +314,9 @@
_unpack = struct.unpack
aliases, entry = cmdutil.findcmd('commit', commands.table)
-interactiveopt = [['i', 'interactive', None, _('use interactive mode')]]
+commitopts3 = evocommands.commitopts3
+interactiveopt = evocommands.commitopts3
+
# This extension contains the following code
#
# - Extension Helper code
@@ -330,6 +333,7 @@
eh.merge(obshistory.eh)
eh.merge(templatekw.eh)
eh.merge(compat.eh)
+eh.merge(evocommands.eh)
uisetup = eh.final_uisetup
extsetup = eh.final_extsetup
reposetup = eh.final_reposetup
@@ -400,25 +404,6 @@
### experimental behavior ###
#####################################################################
-commitopts3 = [
- ('D', 'current-date', None,
- _('record the current date as commit date')),
- ('U', 'current-user', None,
- _('record the current user as committer')),
-]
-
-def _resolveoptions(ui, opts):
- """modify commit options dict to handle related options
-
- For now, all it does is figure out the commit date: respect -D unless
- -d was supplied.
- """
- # N.B. this is extremely similar to setupheaderopts() in mq.py
- if not opts.get('date') and opts.get('current_date'):
- opts['date'] = '%d %d' % util.makedate()
- if not opts.get('user') and opts.get('current_user'):
- opts['user'] = ui.username()
-
getrevs = obsolete.getrevs
#####################################################################
@@ -1978,7 +1963,7 @@
with repo.dirstate.parentchange():
repo.dirstate.setparents(divergent.node(), node.nullid)
oldlen = len(repo)
- amend(ui, repo, message='', logfile='')
+ evocommands.amend(ui, repo, message='', logfile='')
if oldlen == len(repo):
new = divergent
# no changes
@@ -2421,45 +2406,6 @@
finally:
lockmod.release(tr, lock, wlock)
-@eh.command(
- 'amend|refresh',
- [('A', 'addremove', None,
- _('mark new/missing files as added/removed before committing')),
- ('e', 'edit', False, _('invoke editor on commit messages')),
- ('', 'close-branch', None,
- _('mark a branch as closed, hiding it from the branch list')),
- ('s', 'secret', None, _('use the secret phase for committing')),
- ] + walkopts + commitopts + commitopts2 + commitopts3 + interactiveopt,
- _('[OPTION]... [FILE]...'))
-def amend(ui, repo, *pats, **opts):
- """combine a changeset with updates and replace it with a new one
-
- Commits a new changeset incorporating both the changes to the given files
- and all the changes from the current parent changeset into the repository.
-
- See :hg:`commit` for details about committing changes.
-
- If you don't specify -m, the parent's message will be reused.
-
- Behind the scenes, Mercurial first commits the update as a regular child
- of the current parent. Then it creates a new commit on the parent's parents
- with the updated contents. Then it changes the working copy parent to this
- new combined changeset. Finally, the old changeset and its update are hidden
- from :hg:`log` (unless you use --hidden with log).
-
- Returns 0 on success, 1 if nothing changed.
- """
- opts = opts.copy()
- edit = opts.pop('edit', False)
- log = opts.get('logfile')
- opts['amend'] = True
- if not (edit or opts['message'] or log):
- opts['message'] = repo['.'].description()
- _resolveoptions(ui, opts)
- _alias, commitcmd = cmdutil.findcmd('commit', commands.table)
- return commitcmd[0](ui, repo, *pats, **opts)
-
-
def _touchedbetween(repo, source, dest, match=None):
touched = set()
for files in repo.status(source, dest, match=match)[:3]: