##// END OF EJS Templates
added hg identify|id (based on a patch from Andrew Thompson)...
Thomas Arendsen Hein -
r339:a76fc9c4 default
parent child Browse files
Show More
@@ -126,6 +126,18 b' def show_changeset(ui, repo, rev=0, chan'
126 ui.status("summary: %s\n" % description[0])
126 ui.status("summary: %s\n" % description[0])
127 ui.status("\n")
127 ui.status("\n")
128
128
129 def tags_load(repo):
130 repo.lookup(0) # prime the cache
131 i = repo.tags.items()
132 n = []
133 for e in i:
134 try:
135 l = repo.changelog.rev(e[1])
136 except KeyError:
137 l = -2
138 n.append((l, e))
139 return n
140
129 def help(ui, cmd=None):
141 def help(ui, cmd=None):
130 '''show help for a given command or all commands'''
142 '''show help for a given command or all commands'''
131 if cmd:
143 if cmd:
@@ -312,6 +324,22 b' def history(ui, repo):'
312 for i in range(repo.changelog.count() - 1, -1, -1):
324 for i in range(repo.changelog.count() - 1, -1, -1):
313 show_changeset(ui, repo, rev=i)
325 show_changeset(ui, repo, rev=i)
314
326
327 def identify(ui, repo):
328 """print information about the working copy"""
329 (c, a, d, u) = repo.diffdir(repo.root)
330 mflag = (c or a or d or u) and "+" or ""
331 parents = [parent for parent in repo.dirstate.parents()
332 if parent != hg.nullid]
333 tstring = ''
334 if not ui.quiet:
335 taglist = [e[1] for e in tags_load(repo)]
336 tstring = " %s" % ' + '.join([e[0] for e in taglist
337 if e[0] != 'tip' and e[1] in parents])
338
339 hexfunc = ui.verbose and hg.hex or hg.short
340 pstring = '+'.join([hexfunc(parent) for parent in parents])
341 ui.write("%s%s%s\n" % (pstring, mflag, tstring))
342
315 def init(ui, source=None):
343 def init(ui, source=None):
316 """create a new repository or copy an existing one"""
344 """create a new repository or copy an existing one"""
317
345
@@ -512,15 +540,7 b' def status(ui, repo):'
512
540
513 def tags(ui, repo):
541 def tags(ui, repo):
514 """list repository tags"""
542 """list repository tags"""
515 repo.lookup(0) # prime the cache
543 n = tags_load(repo)
516 i = repo.tags.items()
517 n = []
518 for e in i:
519 try:
520 l = repo.changelog.rev(e[1])
521 except KeyError:
522 l = -2
523 n.append((l, e))
524
544
525 n.sort()
545 n.sort()
526 n.reverse()
546 n.reverse()
@@ -590,6 +610,7 b' table = {'
590 "heads": (heads, [], 'hg heads'),
610 "heads": (heads, [], 'hg heads'),
591 "history": (history, [], 'hg history'),
611 "history": (history, [], 'hg history'),
592 "help": (help, [], 'hg help [command]'),
612 "help": (help, [], 'hg help [command]'),
613 "identify|id": (identify, [], 'hg identify'),
593 "init": (init, [], 'hg init [url]'),
614 "init": (init, [], 'hg init [url]'),
594 "log": (log, [], 'hg log <file>'),
615 "log": (log, [], 'hg log <file>'),
595 "manifest|dumpmanifest": (manifest, [], 'hg manifest [rev]'),
616 "manifest|dumpmanifest": (manifest, [], 'hg manifest [rev]'),
General Comments 0
You need to be logged in to leave comments. Login now