Show More
@@ -1432,7 +1432,7 b' def help_(ui, name=None, with_version=Fa' | |||
|
1432 | 1432 | else: |
|
1433 | 1433 | ui.write("%s\n" % first) |
|
1434 | 1434 | |
|
1435 | def identify(ui, repo, rev=None): | |
|
1435 | def identify(ui, repo, rev=None, num=None, id=None, branch=None, tags=None): | |
|
1436 | 1436 | """identify the working copy or specified revision |
|
1437 | 1437 | |
|
1438 | 1438 | With no argument, print a summary of the current state of the repo. |
@@ -1444,26 +1444,43 b' def identify(ui, repo, rev=None):' | |||
|
1444 | 1444 | """ |
|
1445 | 1445 | |
|
1446 | 1446 | hexfunc = ui.debugflag and hex or short |
|
1447 | default = not (num or id or branch or tags) | |
|
1448 | output = [] | |
|
1447 | 1449 | |
|
1448 | 1450 | if not rev: |
|
1449 | 1451 | ctx = repo.workingctx() |
|
1450 | 1452 | parents = ctx.parents() |
|
1451 | changed = ctx.files() + ctx.deleted() | |
|
1452 | output = ["%s%s" % ('+'.join([hexfunc(p.node()) for p in parents]), | |
|
1453 | (changed) and "+" or "")] | |
|
1453 | changed = False | |
|
1454 | if default or id or num: | |
|
1455 | changed = ctx.files() + ctx.deleted() | |
|
1456 | if default or id: | |
|
1457 | output = ["%s%s" % ('+'.join([hexfunc(p.node()) for p in parents]), | |
|
1458 | (changed) and "+" or "")] | |
|
1459 | if num: | |
|
1460 | output.append("%s%s" % ('+'.join([str(p.rev()) for p in parents]), | |
|
1461 | (changed) and "+" or "")) | |
|
1454 | 1462 | else: |
|
1455 | 1463 | ctx = repo.changectx(rev) |
|
1456 | output = [hexfunc(ctx.node())] | |
|
1457 | ||
|
1458 | if not ui.quiet: | |
|
1459 | branch = util.tolocal(ctx.branch()) | |
|
1460 | if branch != 'default': | |
|
1461 | output.append("(%s)" % branch) | |
|
1464 | if default or id: | |
|
1465 | output = [hexfunc(ctx.node())] | |
|
1466 | if num: | |
|
1467 | output.append(str(ctx.rev())) | |
|
1468 | ||
|
1469 | if default and not ui.quiet: | |
|
1470 | b = util.tolocal(ctx.branch()) | |
|
1471 | if b != 'default': | |
|
1472 | output.append("(%s)" % b) | |
|
1462 | 1473 | |
|
1463 | 1474 | # multiple tags for a single parent separated by '/' |
|
1464 |
t |
|
|
1465 |
if t |
|
|
1466 |
output.append(t |
|
|
1475 | t = "/".join(ctx.tags()) | |
|
1476 | if t: | |
|
1477 | output.append(t) | |
|
1478 | ||
|
1479 | if branch: | |
|
1480 | output.append(util.tolocal(ctx.branch())) | |
|
1481 | ||
|
1482 | if tags: | |
|
1483 | output.extend(ctx.tags()) | |
|
1467 | 1484 | |
|
1468 | 1485 | ui.write("%s\n" % ' '.join(output)) |
|
1469 | 1486 | |
@@ -2827,8 +2844,12 b' table = {' | |||
|
2827 | 2844 | "help": (help_, [], _('hg help [COMMAND]')), |
|
2828 | 2845 | "identify|id": |
|
2829 | 2846 | (identify, |
|
2830 |
[('r', 'rev', '', _('identify the specified rev')) |
|
|
2831 | _('hg identify [-r REV]')), | |
|
2847 | [('r', 'rev', '', _('identify the specified rev')), | |
|
2848 | ('n', 'num', None, _('show local revision number')), | |
|
2849 | ('i', 'id', None, _('show global revision id')), | |
|
2850 | ('b', 'branch', None, _('show branch')), | |
|
2851 | ('t', 'tags', None, _('show tags'))], | |
|
2852 | _('hg identify [-nibt] [-r REV]')), | |
|
2832 | 2853 | "import|patch": |
|
2833 | 2854 | (import_, |
|
2834 | 2855 | [('p', 'strip', 1, |
General Comments 0
You need to be logged in to leave comments.
Login now