changeset 386:494c8e3f47f3

Improvements for hg identify: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Improvements for hg identify: Don't add the modified flag if unknown files are found. Remove extra space if there was no tag found. Multiple tags for a single parent separated by '/'. Getting rid of sum() to aid porting to Python 2.2. manifest hash: f91224afcb239908ba3ef02299fcf2b0380ebd1a -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCspWvW7P1GVgWeRoRAnqbAJwL1DIzOxOrdqpPj9vsYJeeiq+VrQCcCyli P+b/S0s2n628ku1IfrW3Elo= =lgRY -----END PGP SIGNATURE-----
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 17 Jun 2005 10:19:43 +0100
parents e9e1efd5291c
children c07c6fb2f0a8
files mercurial/commands.py
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Jun 17 10:16:31 2005 +0100
+++ b/mercurial/commands.py	Fri Jun 17 10:19:43 2005 +0100
@@ -333,21 +333,24 @@
 
 def identify(ui, repo):
     """print information about the working copy"""
-    (c, a, d, u) = repo.diffdir(repo.root)
-    mflag = (c or a or d or u) and "+" or ""
     parents = [p for p in repo.dirstate.parents() if p != hg.nullid]
     if not parents:
         ui.write("unknown\n")
         return
 
-    tstring = ''
+    hexfunc = ui.verbose and hg.hex or hg.short
+    (c, a, d, u) = repo.diffdir(repo.root)
+    output = ["%s%s" % ('+'.join([hexfunc(parent) for parent in parents]),
+                        (c or a or d) and "+" or "")]
+
     if not ui.quiet:
-        tags = sum(map(repo.nodetags, parents), [])
-        tstring = " " + ' + '.join(tags)
+        # 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 ' + '
+        output.append(' + '.join(parenttags))
 
-    hexfunc = ui.verbose and hg.hex or hg.short
-    pstring = '+'.join([hexfunc(parent) for parent in parents])
-    ui.write("%s%s%s\n" % (pstring, mflag, tstring))
+    ui.write("%s\n" % ' '.join(output))
 
 def init(ui, source=None):
     """create a new repository or copy an existing one"""