Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 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 | 6e3436082697 |
children | c07c6fb2f0a8 |
comparison
equal
deleted
inserted
replaced
385:e9e1efd5291c | 386:494c8e3f47f3 |
---|---|
331 for i in range(repo.changelog.count() - 1, -1, -1): | 331 for i in range(repo.changelog.count() - 1, -1, -1): |
332 show_changeset(ui, repo, rev=i) | 332 show_changeset(ui, repo, rev=i) |
333 | 333 |
334 def identify(ui, repo): | 334 def identify(ui, repo): |
335 """print information about the working copy""" | 335 """print information about the working copy""" |
336 (c, a, d, u) = repo.diffdir(repo.root) | |
337 mflag = (c or a or d or u) and "+" or "" | |
338 parents = [p for p in repo.dirstate.parents() if p != hg.nullid] | 336 parents = [p for p in repo.dirstate.parents() if p != hg.nullid] |
339 if not parents: | 337 if not parents: |
340 ui.write("unknown\n") | 338 ui.write("unknown\n") |
341 return | 339 return |
342 | 340 |
343 tstring = '' | 341 hexfunc = ui.verbose and hg.hex or hg.short |
342 (c, a, d, u) = repo.diffdir(repo.root) | |
343 output = ["%s%s" % ('+'.join([hexfunc(parent) for parent in parents]), | |
344 (c or a or d) and "+" or "")] | |
345 | |
344 if not ui.quiet: | 346 if not ui.quiet: |
345 tags = sum(map(repo.nodetags, parents), []) | 347 # multiple tags for a single parent separated by '/' |
346 tstring = " " + ' + '.join(tags) | 348 parenttags = ['/'.join(tags) |
347 | 349 for tags in map(repo.nodetags, parents) if tags] |
348 hexfunc = ui.verbose and hg.hex or hg.short | 350 # tags for multiple parents separated by ' + ' |
349 pstring = '+'.join([hexfunc(parent) for parent in parents]) | 351 output.append(' + '.join(parenttags)) |
350 ui.write("%s%s%s\n" % (pstring, mflag, tstring)) | 352 |
353 ui.write("%s\n" % ' '.join(output)) | |
351 | 354 |
352 def init(ui, source=None): | 355 def init(ui, source=None): |
353 """create a new repository or copy an existing one""" | 356 """create a new repository or copy an existing one""" |
354 | 357 |
355 if source: | 358 if source: |