diff mercurial/commands.py @ 2974:eef469259745

tag: shorten hash in default commit message Move default message to commands.py Pass node in binary for consistency Remove default arguments Fix up tests
author Matt Mackall <mpm@selenic.com>
date Sun, 20 Aug 2006 23:52:52 -0500
parents fb493241d7f6
children f63667f694de
line wrap: on
line diff
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2594,17 +2594,20 @@ def tag(ui, repo, name, rev_=None, **opt
     if opts['rev']:
         rev_ = opts['rev']
     if rev_:
-        r = hex(repo.lookup(rev_))
+        r = repo.lookup(rev_)
     else:
         p1, p2 = repo.dirstate.parents()
         if p1 == nullid:
             raise util.Abort(_('no revision to tag'))
         if p2 != nullid:
             raise util.Abort(_('outstanding uncommitted merges'))
-        r = hex(p1)
-
-    repo.tag(name, r, opts['local'], opts['message'], opts['user'],
-             opts['date'])
+        r = p1
+
+    message = opts['message']
+    if not message:
+        message = _('Added tag %s for changeset %s') % (name, short(r))
+
+    repo.tag(name, r, message, opts['local'], opts['user'], opts['date'])
 
 def tags(ui, repo):
     """list repository tags