Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 2966:fb493241d7f6
Only show long hashes with --debug, not --verbose
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 20 Aug 2006 22:51:56 -0500 |
parents | a8546e40070a |
children | eef469259745 |
comparison
equal
deleted
inserted
replaced
2965:96d034d02d61 | 2966:fb493241d7f6 |
---|---|
401 return | 401 return |
402 | 402 |
403 changes = log.read(changenode) | 403 changes = log.read(changenode) |
404 date = util.datestr(changes[2]) | 404 date = util.datestr(changes[2]) |
405 | 405 |
406 parents = [(log.rev(p), self.ui.verbose and hex(p) or short(p)) | 406 hexfunc = self.ui.debugflag and hex or short |
407 for p in log.parents(changenode) | 407 |
408 parents = [(log.rev(p), hexfunc(p)) for p in log.parents(changenode) | |
408 if self.ui.debugflag or p != nullid] | 409 if self.ui.debugflag or p != nullid] |
409 if (not self.ui.debugflag and len(parents) == 1 and | 410 if (not self.ui.debugflag and len(parents) == 1 and |
410 parents[0][0] == rev-1): | 411 parents[0][0] == rev-1): |
411 parents = [] | 412 parents = [] |
412 | 413 |
413 if self.ui.verbose: | 414 self.ui.write(_("changeset: %d:%s\n") % (rev, hexfunc(changenode))) |
414 self.ui.write(_("changeset: %d:%s\n") % (rev, hex(changenode))) | |
415 else: | |
416 self.ui.write(_("changeset: %d:%s\n") % (rev, short(changenode))) | |
417 | 415 |
418 for tag in self.repo.nodetags(changenode): | 416 for tag in self.repo.nodetags(changenode): |
419 self.ui.status(_("tag: %s\n") % tag) | 417 self.ui.status(_("tag: %s\n") % tag) |
420 for parent in parents: | 418 for parent in parents: |
421 self.ui.write(_("parent: %d:%s\n") % parent) | 419 self.ui.write(_("parent: %d:%s\n") % parent) |
1608 parents = [p for p in repo.dirstate.parents() if p != nullid] | 1606 parents = [p for p in repo.dirstate.parents() if p != nullid] |
1609 if not parents: | 1607 if not parents: |
1610 ui.write(_("unknown\n")) | 1608 ui.write(_("unknown\n")) |
1611 return | 1609 return |
1612 | 1610 |
1613 hexfunc = ui.verbose and hex or short | 1611 hexfunc = ui.debugflag and hex or short |
1614 modified, added, removed, deleted = repo.status()[:4] | 1612 modified, added, removed, deleted = repo.status()[:4] |
1615 output = ["%s%s" % | 1613 output = ["%s%s" % |
1616 ('+'.join([hexfunc(parent) for parent in parents]), | 1614 ('+'.join([hexfunc(parent) for parent in parents]), |
1617 (modified or added or removed or deleted) and "+" or "")] | 1615 (modified or added or removed or deleted) and "+" or "")] |
1618 | 1616 |
2616 This lists both regular and local tags. | 2614 This lists both regular and local tags. |
2617 """ | 2615 """ |
2618 | 2616 |
2619 l = repo.tagslist() | 2617 l = repo.tagslist() |
2620 l.reverse() | 2618 l.reverse() |
2619 hexfunc = ui.debugflag and hex or short | |
2621 for t, n in l: | 2620 for t, n in l: |
2622 try: | 2621 try: |
2623 r = "%5d:%s" % (repo.changelog.rev(n), hex(n)) | 2622 r = "%5d:%s" % (repo.changelog.rev(n), hexfunc(n)) |
2624 except KeyError: | 2623 except KeyError: |
2625 r = " ?:?" | 2624 r = " ?:?" |
2626 if ui.quiet: | 2625 if ui.quiet: |
2627 ui.write("%s\n" % t) | 2626 ui.write("%s\n" % t) |
2628 else: | 2627 else: |