comparison mercurial/commands.py @ 21237:0054a77f49df

localrepo: add "editor" argument to "tag()" Before this patch, "localrepository.tag()" doesn't take "editor" argument, and this prevents callers from passing "editor" argument to "localrepository.commit()" invoked internally. This patch adds "editor" argument to "localrepository.tag()" (and "_tag()", too), and makes "commands.tag()" invoke it with "editor" argument. This patch also omits explicit "localrepository.savecommitmesssage()" invocation, because "localrepository.commit()" will invoke specified "editor" and save edited commit message into ".hg/last-message.txt" automatically.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 05 May 2014 21:26:40 +0900
parents a1381eea7c7d
children edac098e6a55
comparison
equal deleted inserted replaced
21236:49148d7868df 21237:0054a77f49df
5682 date = opts.get('date') 5682 date = opts.get('date')
5683 if date: 5683 if date:
5684 date = util.parsedate(date) 5684 date = util.parsedate(date)
5685 5685
5686 if opts.get('edit'): 5686 if opts.get('edit'):
5687 message = ui.edit(message, ui.username()) 5687 def editor(repo, ctx, subs):
5688 repo.savecommitmessage(message) 5688 return ui.edit(ctx.description() + "\n", ctx.user())
5689 else:
5690 editor = False
5689 5691
5690 # don't allow tagging the null rev 5692 # don't allow tagging the null rev
5691 if (not opts.get('remove') and 5693 if (not opts.get('remove') and
5692 scmutil.revsingle(repo, rev_).rev() == nullrev): 5694 scmutil.revsingle(repo, rev_).rev() == nullrev):
5693 raise util.Abort(_("cannot tag null revision")) 5695 raise util.Abort(_("cannot tag null revision"))
5694 5696
5695 repo.tag(names, r, message, opts.get('local'), opts.get('user'), date) 5697 repo.tag(names, r, message, opts.get('local'), opts.get('user'), date,
5698 editor=editor)
5696 finally: 5699 finally:
5697 release(lock, wlock) 5700 release(lock, wlock)
5698 5701
5699 @command('tags', [], '') 5702 @command('tags', [], '')
5700 def tags(ui, repo, **opts): 5703 def tags(ui, repo, **opts):