Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
2988:63c3a1921a67 | 2991:f63667f694de |
---|---|
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) |
1609 parents = [p for p in repo.dirstate.parents() if p != nullid] | 1607 parents = [p for p in repo.dirstate.parents() if p != nullid] |
1610 if not parents: | 1608 if not parents: |
1611 ui.write(_("unknown\n")) | 1609 ui.write(_("unknown\n")) |
1612 return | 1610 return |
1613 | 1611 |
1614 hexfunc = ui.verbose and hex or short | 1612 hexfunc = ui.debugflag and hex or short |
1615 modified, added, removed, deleted = repo.status()[:4] | 1613 modified, added, removed, deleted = repo.status()[:4] |
1616 output = ["%s%s" % | 1614 output = ["%s%s" % |
1617 ('+'.join([hexfunc(parent) for parent in parents]), | 1615 ('+'.join([hexfunc(parent) for parent in parents]), |
1618 (modified or added or removed or deleted) and "+" or "")] | 1616 (modified or added or removed or deleted) and "+" or "")] |
1619 | 1617 |
2599 if opts['rev']: | 2597 if opts['rev']: |
2600 raise util.Abort(_("use only one form to specify the revision")) | 2598 raise util.Abort(_("use only one form to specify the revision")) |
2601 if opts['rev']: | 2599 if opts['rev']: |
2602 rev_ = opts['rev'] | 2600 rev_ = opts['rev'] |
2603 if rev_: | 2601 if rev_: |
2604 r = hex(repo.lookup(rev_)) | 2602 r = repo.lookup(rev_) |
2605 else: | 2603 else: |
2606 p1, p2 = repo.dirstate.parents() | 2604 p1, p2 = repo.dirstate.parents() |
2607 if p1 == nullid: | 2605 if p1 == nullid: |
2608 raise util.Abort(_('no revision to tag')) | 2606 raise util.Abort(_('no revision to tag')) |
2609 if p2 != nullid: | 2607 if p2 != nullid: |
2610 raise util.Abort(_('outstanding uncommitted merges')) | 2608 raise util.Abort(_('outstanding uncommitted merges')) |
2611 r = hex(p1) | 2609 r = p1 |
2612 | 2610 |
2613 repo.tag(name, r, opts['local'], opts['message'], opts['user'], | 2611 message = opts['message'] |
2614 opts['date']) | 2612 if not message: |
2613 message = _('Added tag %s for changeset %s') % (name, short(r)) | |
2614 | |
2615 repo.tag(name, r, message, opts['local'], opts['user'], opts['date']) | |
2615 | 2616 |
2616 def tags(ui, repo): | 2617 def tags(ui, repo): |
2617 """list repository tags | 2618 """list repository tags |
2618 | 2619 |
2619 List the repository tags. | 2620 List the repository tags. |
2621 This lists both regular and local tags. | 2622 This lists both regular and local tags. |
2622 """ | 2623 """ |
2623 | 2624 |
2624 l = repo.tagslist() | 2625 l = repo.tagslist() |
2625 l.reverse() | 2626 l.reverse() |
2627 hexfunc = ui.debugflag and hex or short | |
2626 for t, n in l: | 2628 for t, n in l: |
2627 try: | 2629 try: |
2628 r = "%5d:%s" % (repo.changelog.rev(n), hex(n)) | 2630 r = "%5d:%s" % (repo.changelog.rev(n), hexfunc(n)) |
2629 except KeyError: | 2631 except KeyError: |
2630 r = " ?:?" | 2632 r = " ?:?" |
2631 if ui.quiet: | 2633 if ui.quiet: |
2632 ui.write("%s\n" % t) | 2634 ui.write("%s\n" % t) |
2633 else: | 2635 else: |