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