hgext3rd/evolve/cmdrewrite.py
changeset 3218 772cc931f085
parent 3217 b6ba296532cb
child 3219 b73bd280b21c
equal deleted inserted replaced
3217:b6ba296532cb 3218:772cc931f085
   603 
   603 
   604 @eh.command(
   604 @eh.command(
   605     '^metaedit',
   605     '^metaedit',
   606     [('r', 'rev', [], _("revision to edit")),
   606     [('r', 'rev', [], _("revision to edit")),
   607      ('', 'fold', None, _("also fold specified revisions into one")),
   607      ('', 'fold', None, _("also fold specified revisions into one")),
       
   608      ('n', 'note', '', _('store a note on metaedit')),
   608     ] + commitopts + commitopts2 + commitopts3,
   609     ] + commitopts + commitopts2 + commitopts3,
   609     _('hg metaedit [OPTION]... [-r] [REV]'))
   610     _('hg metaedit [OPTION]... [-r] [REV]'))
   610 def metaedit(ui, repo, *revs, **opts):
   611 def metaedit(ui, repo, *revs, **opts):
   611     """edit commit information
   612     """edit commit information
   612 
   613 
   634          hg metaedit --fold 'draft() and only(foo,@)'
   635          hg metaedit --fold 'draft() and only(foo,@)'
   635 
   636 
   636        See :hg:`help phases` for more about draft revisions, and
   637        See :hg:`help phases` for more about draft revisions, and
   637        :hg:`help revsets` for more about the `draft()` and `only()` keywords.
   638        :hg:`help revsets` for more about the `draft()` and `only()` keywords.
   638     """
   639     """
       
   640     _checknotesize(opts)
   639     _resolveoptions(ui, opts)
   641     _resolveoptions(ui, opts)
   640     revs = list(revs)
   642     revs = list(revs)
   641     revs.extend(opts['rev'])
   643     revs.extend(opts['rev'])
   642     if not revs:
   644     if not revs:
   643         if opts['fold']:
   645         if opts['fold']:
   707                                                   root.p2().node()],
   709                                                   root.p2().node()],
   708                                                  commitopts=commitopts)
   710                                                  commitopts=commitopts)
   709             if created:
   711             if created:
   710                 if p1.rev() in revs:
   712                 if p1.rev() in revs:
   711                     newp1 = newid
   713                     newp1 = newid
       
   714                 # metadata to be stored on obsmarker
       
   715                 metadata = {}
       
   716                 if opts.get('note'):
       
   717                     metadata['note'] = opts['note']
       
   718 
   712                 phases.retractboundary(repo, tr, targetphase, [newid])
   719                 phases.retractboundary(repo, tr, targetphase, [newid])
   713                 obsolete.createmarkers(repo, [(ctx, (repo[newid],))
   720                 obsolete.createmarkers(repo, [(ctx, (repo[newid],))
   714                                               for ctx in allctx])
   721                                               for ctx in allctx],
       
   722                                        metadata=metadata)
   715             else:
   723             else:
   716                 ui.status(_("nothing changed\n"))
   724                 ui.status(_("nothing changed\n"))
   717             tr.close()
   725             tr.close()
   718         finally:
   726         finally:
   719             tr.release()
   727             tr.release()