Mercurial > evolve
comparison hgext/evolve.py @ 976:bed842762447
amend: add -D/--current-date option, just like mq's qrefresh has
Carefully designed so we can easily add -D to other changeset-creating
commands (probably anything that takes -d), and so that we can add
-U/--current-user as well. When that's done, the date and user options
should be very similar to those in MQ.
author | Greg Ward <greg@gerg.ca> |
---|---|
date | Fri, 06 Jun 2014 17:43:45 -0400 |
parents | d04a52f40f41 |
children | 1c7b73739a0d |
comparison
equal
deleted
inserted
replaced
975:09d6036ad596 | 976:bed842762447 |
---|---|
322 reposetup = eh.final_reposetup | 322 reposetup = eh.final_reposetup |
323 | 323 |
324 ##################################################################### | 324 ##################################################################### |
325 ### experimental behavior ### | 325 ### experimental behavior ### |
326 ##################################################################### | 326 ##################################################################### |
327 | |
328 commitopts3 = [ | |
329 ('D', 'current-date', None, | |
330 _('record the current date as commit date')), | |
331 ] | |
332 | |
333 def _resolveoptions(opts): | |
334 """modify commit options dict to handle related options | |
335 | |
336 For now, all it does is figure out the commit date: respect -D unless | |
337 -d was supplied. | |
338 """ | |
339 # N.B. this is extremely similar to setupheaderopts() in mq.py | |
340 if not opts.get('date') and opts.get('current_date'): | |
341 opts['date'] = '%d %d' % util.makedate() | |
327 | 342 |
328 @eh.wrapfunction(mercurial.obsolete, 'createmarkers') | 343 @eh.wrapfunction(mercurial.obsolete, 'createmarkers') |
329 def _createmarkers(orig, repo, relations, *args, **kwargs): | 344 def _createmarkers(orig, repo, relations, *args, **kwargs): |
330 """register parent information at prune time""" | 345 """register parent information at prune time""" |
331 # every time this test is run, a kitten is slain. | 346 # every time this test is run, a kitten is slain. |
1793 _('mark new/missing files as added/removed before committing')), | 1808 _('mark new/missing files as added/removed before committing')), |
1794 ('e', 'edit', False, _('invoke editor on commit messages')), | 1809 ('e', 'edit', False, _('invoke editor on commit messages')), |
1795 ('', 'close-branch', None, | 1810 ('', 'close-branch', None, |
1796 _('mark a branch as closed, hiding it from the branch list')), | 1811 _('mark a branch as closed, hiding it from the branch list')), |
1797 ('s', 'secret', None, _('use the secret phase for committing')), | 1812 ('s', 'secret', None, _('use the secret phase for committing')), |
1798 ] + walkopts + commitopts + commitopts2, | 1813 ] + walkopts + commitopts + commitopts2 + commitopts3, |
1799 _('[OPTION]... [FILE]...')) | 1814 _('[OPTION]... [FILE]...')) |
1800 def amend(ui, repo, *pats, **opts): | 1815 def amend(ui, repo, *pats, **opts): |
1801 """combine a changeset with updates and replace it with a new one | 1816 """combine a changeset with updates and replace it with a new one |
1802 | 1817 |
1803 Commits a new changeset incorporating both the changes to the given files | 1818 Commits a new changeset incorporating both the changes to the given files |
1818 opts = opts.copy() | 1833 opts = opts.copy() |
1819 edit = opts.pop('edit', False) | 1834 edit = opts.pop('edit', False) |
1820 opts['amend'] = True | 1835 opts['amend'] = True |
1821 if not (edit or opts['message']): | 1836 if not (edit or opts['message']): |
1822 opts['message'] = repo['.'].description() | 1837 opts['message'] = repo['.'].description() |
1838 _resolveoptions(opts) | |
1823 _alias, commitcmd = cmdutil.findcmd('commit', commands.table) | 1839 _alias, commitcmd = cmdutil.findcmd('commit', commands.table) |
1824 return commitcmd[0](ui, repo, *pats, **opts) | 1840 return commitcmd[0](ui, repo, *pats, **opts) |
1825 | 1841 |
1826 def _commitfiltered(repo, ctx, match): | 1842 def _commitfiltered(repo, ctx, match): |
1827 """Recommit ctx with changed files not in match. Return the new | 1843 """Recommit ctx with changed files not in match. Return the new |