##// END OF EJS Templates
identify: accept a revision argument
Matt Mackall -
r4665:091c9e54 default
parent child Browse files
Show More
@@ -1432,32 +1432,36 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):
1435 def identify(ui, repo, rev=None):
1436 """print information about the working copy
1436 """identify the working copy or specified revision
1437
1437
1438 Print a short summary of the current state of the repo.
1438 With no argument, print a summary of the current state of the repo.
1439
1439
1440 This summary identifies the repository state using one or two parent
1440 This summary identifies the repository state using one or two parent
1441 hash identifiers, followed by a "+" if there are uncommitted changes
1441 hash identifiers, followed by a "+" if there are uncommitted changes
1442 in the working directory, followed by a list of tags for this revision.
1442 in the working directory, a list of tags for this revision and a branch
1443 name for non-default branches.
1443 """
1444 """
1444
1445
1445 hexfunc = ui.debugflag and hex or short
1446 hexfunc = ui.debugflag and hex or short
1446
1447
1447 wctx = repo.workingctx()
1448 if not rev:
1448 parents = wctx.parents()
1449 ctx = repo.workingctx()
1449 changed = wctx.files() + wctx.deleted()
1450 parents = ctx.parents()
1450
1451 changed = ctx.files() + ctx.deleted()
1451 output = ["%s%s" % ('+'.join([hexfunc(p.node()) for p in parents]),
1452 output = ["%s%s" % ('+'.join([hexfunc(p.node()) for p in parents]),
1452 (changed) and "+" or "")]
1453 (changed) and "+" or "")]
1454 else:
1455 ctx = repo.changectx(rev)
1456 output = [hexfunc(ctx.node())]
1453
1457
1454 if not ui.quiet:
1458 if not ui.quiet:
1455 branch = util.tolocal(wctx.branch())
1459 branch = util.tolocal(ctx.branch())
1456 if branch != 'default':
1460 if branch != 'default':
1457 output.append("(%s)" % branch)
1461 output.append("(%s)" % branch)
1458
1462
1459 # multiple tags for a single parent separated by '/'
1463 # multiple tags for a single parent separated by '/'
1460 tags = "/".join(wctx.tags())
1464 tags = "/".join(ctx.tags())
1461 if tags:
1465 if tags:
1462 output.append(tags)
1466 output.append(tags)
1463
1467
@@ -2821,7 +2825,10 b' table = {'
2821 ('', 'template', '', _('display with template'))],
2825 ('', 'template', '', _('display with template'))],
2822 _('hg heads [-r REV] [REV]...')),
2826 _('hg heads [-r REV] [REV]...')),
2823 "help": (help_, [], _('hg help [COMMAND]')),
2827 "help": (help_, [], _('hg help [COMMAND]')),
2824 "identify|id": (identify, [], _('hg identify')),
2828 "identify|id":
2829 (identify,
2830 [('r', 'rev', '', _('identify the specified rev'))],
2831 _('hg identify [-r REV]')),
2825 "import|patch":
2832 "import|patch":
2826 (import_,
2833 (import_,
2827 [('p', 'strip', 1,
2834 [('p', 'strip', 1,
@@ -136,7 +136,7 b' list of commands:'
136 grep search for a pattern in specified files and revisions
136 grep search for a pattern in specified files and revisions
137 heads show current repository heads or show branch heads
137 heads show current repository heads or show branch heads
138 help show help for a command, extension, or list of commands
138 help show help for a command, extension, or list of commands
139 identify print information about the working copy
139 identify identify the working copy or specified revision
140 import import an ordered set of patches
140 import import an ordered set of patches
141 incoming show new changesets found in source
141 incoming show new changesets found in source
142 init create a new repository in the given directory
142 init create a new repository in the given directory
@@ -188,7 +188,7 b' list of commands:'
188 grep search for a pattern in specified files and revisions
188 grep search for a pattern in specified files and revisions
189 heads show current repository heads or show branch heads
189 heads show current repository heads or show branch heads
190 help show help for a command, extension, or list of commands
190 help show help for a command, extension, or list of commands
191 identify print information about the working copy
191 identify identify the working copy or specified revision
192 import import an ordered set of patches
192 import import an ordered set of patches
193 incoming show new changesets found in source
193 incoming show new changesets found in source
194 init create a new repository in the given directory
194 init create a new repository in the given directory
@@ -59,7 +59,7 b' list of commands:'
59 grep search for a pattern in specified files and revisions
59 grep search for a pattern in specified files and revisions
60 heads show current repository heads or show branch heads
60 heads show current repository heads or show branch heads
61 help show help for a command, extension, or list of commands
61 help show help for a command, extension, or list of commands
62 identify print information about the working copy
62 identify identify the working copy or specified revision
63 import import an ordered set of patches
63 import import an ordered set of patches
64 incoming show new changesets found in source
64 incoming show new changesets found in source
65 init create a new repository in the given directory
65 init create a new repository in the given directory
@@ -107,7 +107,7 b' use "hg -v help" to show aliases and glo'
107 grep search for a pattern in specified files and revisions
107 grep search for a pattern in specified files and revisions
108 heads show current repository heads or show branch heads
108 heads show current repository heads or show branch heads
109 help show help for a command, extension, or list of commands
109 help show help for a command, extension, or list of commands
110 identify print information about the working copy
110 identify identify the working copy or specified revision
111 import import an ordered set of patches
111 import import an ordered set of patches
112 incoming show new changesets found in source
112 incoming show new changesets found in source
113 init create a new repository in the given directory
113 init create a new repository in the given directory
General Comments 0
You need to be logged in to leave comments. Login now