diff mercurial/commands.py @ 2991:f63667f694de

Merge with tah
author Thomas Arendsen Hein <thomas@intevation.de>
date Tue, 22 Aug 2006 10:18:40 +0200
parents 63c3a1921a67 eef469259745
children 01454af644b8
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Aug 21 21:59:29 2006 -0700
+++ b/mercurial/commands.py	Tue Aug 22 10:18:40 2006 +0200
@@ -403,17 +403,15 @@
         changes = log.read(changenode)
         date = util.datestr(changes[2])
 
-        parents = [(log.rev(p), self.ui.verbose and hex(p) or short(p))
-                   for p in log.parents(changenode)
+        hexfunc = self.ui.debugflag and hex or short
+
+        parents = [(log.rev(p), hexfunc(p)) for p in log.parents(changenode)
                    if self.ui.debugflag or p != nullid]
         if (not self.ui.debugflag and len(parents) == 1 and
             parents[0][0] == rev-1):
             parents = []
 
-        if self.ui.verbose:
-            self.ui.write(_("changeset:   %d:%s\n") % (rev, hex(changenode)))
-        else:
-            self.ui.write(_("changeset:   %d:%s\n") % (rev, short(changenode)))
+        self.ui.write(_("changeset:   %d:%s\n") % (rev, hexfunc(changenode)))
 
         for tag in self.repo.nodetags(changenode):
             self.ui.status(_("tag:         %s\n") % tag)
@@ -1611,7 +1609,7 @@
         ui.write(_("unknown\n"))
         return
 
-    hexfunc = ui.verbose and hex or short
+    hexfunc = ui.debugflag and hex or short
     modified, added, removed, deleted = repo.status()[:4]
     output = ["%s%s" %
               ('+'.join([hexfunc(parent) for parent in parents]),
@@ -2601,17 +2599,20 @@
     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
@@ -2623,9 +2624,10 @@
 
     l = repo.tagslist()
     l.reverse()
+    hexfunc = ui.debugflag and hex or short
     for t, n in l:
         try:
-            r = "%5d:%s" % (repo.changelog.rev(n), hex(n))
+            r = "%5d:%s" % (repo.changelog.rev(n), hexfunc(n))
         except KeyError:
             r = "    ?:?"
         if ui.quiet: