changeset 4664:dedb8abfd0e1

identify: use contexts
author Matt Mackall <mpm@selenic.com>
date Thu, 21 Jun 2007 11:42:39 -0500
parents 6b2e8cb39583
children 091c9e54d306
files mercurial/commands.py
diffstat 1 files changed, 11 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Jun 21 11:42:39 2007 -0500
+++ b/mercurial/commands.py	Thu Jun 21 11:42:39 2007 -0500
@@ -1442,28 +1442,24 @@
     in the working directory, followed by a list of tags for this revision.
     """
 
-    parents = [p for p in repo.dirstate.parents() if p != nullid]
-    if not parents:
-        parents = [nullid]
-
     hexfunc = ui.debugflag and hex or short
-    modified, added, removed, deleted = repo.status()[:4]
-    output = ["%s%s" %
-              ('+'.join([hexfunc(parent) for parent in parents]),
-              (modified or added or removed or deleted) and "+" or "")]
+
+    wctx = repo.workingctx()
+    parents = wctx.parents()
+    changed = wctx.files() + wctx.deleted()
+
+    output = ["%s%s" % ('+'.join([hexfunc(p.node()) for p in parents]),
+                        (changed) and "+" or "")]
 
     if not ui.quiet:
-
-        branch = util.tolocal(repo.workingctx().branch())
+        branch = util.tolocal(wctx.branch())
         if branch != 'default':
             output.append("(%s)" % branch)
 
         # multiple tags for a single parent separated by '/'
-        parenttags = ['/'.join(tags)
-                      for tags in map(repo.nodetags, parents) if tags]
-        # tags for multiple parents separated by ' + '
-        if parenttags:
-            output.append(' + '.join(parenttags))
+        tags = "/".join(wctx.tags())
+        if tags:
+            output.append(tags)
 
     ui.write("%s\n" % ' '.join(output))