80 |
80 |
81 @eh.command( |
81 @eh.command( |
82 'amend|refresh', |
82 'amend|refresh', |
83 [('A', 'addremove', None, |
83 [('A', 'addremove', None, |
84 _('mark new/missing files as added/removed before committing')), |
84 _('mark new/missing files as added/removed before committing')), |
|
85 ('a', 'all', False, _("match all files")), |
85 ('e', 'edit', False, _('invoke editor on commit messages')), |
86 ('e', 'edit', False, _('invoke editor on commit messages')), |
|
87 ('', 'extract', False, _('extract changes from the commit to the working copy')), |
86 ('', 'close-branch', None, |
88 ('', 'close-branch', None, |
87 _('mark a branch as closed, hiding it from the branch list')), |
89 _('mark a branch as closed, hiding it from the branch list')), |
88 ('s', 'secret', None, _('use the secret phase for committing')), |
90 ('s', 'secret', None, _('use the secret phase for committing')), |
89 ] + walkopts + commitopts + commitopts2 + commitopts3 + interactiveopt, |
91 ] + walkopts + commitopts + commitopts2 + commitopts3 + interactiveopt, |
90 _('[OPTION]... [FILE]...')) |
92 _('[OPTION]... [FILE]...')) |
96 |
98 |
97 See :hg:`commit` for details about committing changes. |
99 See :hg:`commit` for details about committing changes. |
98 |
100 |
99 If you don't specify -m, the parent's message will be reused. |
101 If you don't specify -m, the parent's message will be reused. |
100 |
102 |
|
103 If --extra is specified, the behavior of `hg amend` is reversed: Changes |
|
104 to selected files in the checked out revision appear again as uncommitted |
|
105 changed in the working directory. |
|
106 |
101 Returns 0 on success, 1 if nothing changed. |
107 Returns 0 on success, 1 if nothing changed. |
102 """ |
108 """ |
103 opts = opts.copy() |
109 opts = opts.copy() |
104 edit = opts.pop('edit', False) |
110 if opts.get('extract'): |
105 log = opts.get('logfile') |
111 if opts.pop('interactive', False): |
106 opts['amend'] = True |
112 msg = _('not support for --interactive with --extract yet') |
107 if not (edit or opts['message'] or log): |
113 raise error.Abort(msg) |
108 opts['message'] = repo['.'].description() |
114 return uncommit(ui, repo, *pats, **opts) |
109 _resolveoptions(ui, opts) |
115 else: |
110 _alias, commitcmd = cmdutil.findcmd('commit', commands.table) |
116 if opts.pop('all', False): |
111 return commitcmd[0](ui, repo, *pats, **opts) |
117 # add an include for all |
|
118 include = list(opts.get('include')) |
|
119 include.append('re:.*') |
|
120 edit = opts.pop('edit', False) |
|
121 log = opts.get('logfile') |
|
122 opts['amend'] = True |
|
123 if not (edit or opts['message'] or log): |
|
124 opts['message'] = repo['.'].description() |
|
125 _resolveoptions(ui, opts) |
|
126 _alias, commitcmd = cmdutil.findcmd('commit', commands.table) |
|
127 return commitcmd[0](ui, repo, *pats, **opts) |
112 |
128 |
113 def _touchedbetween(repo, source, dest, match=None): |
129 def _touchedbetween(repo, source, dest, match=None): |
114 touched = set() |
130 touched = set() |
115 for files in repo.status(source, dest, match=match)[:3]: |
131 for files in repo.status(source, dest, match=match)[:3]: |
116 touched.update(files) |
132 touched.update(files) |