124 ui.status("\n") |
124 ui.status("\n") |
125 else: |
125 else: |
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 |
|
141 def help(ui, cmd=None): |
129 def help(ui, cmd=None): |
142 '''show help for a given command or all commands''' |
130 '''show help for a given command or all commands''' |
143 if cmd: |
131 if cmd: |
144 try: |
132 try: |
145 i = find(cmd) |
133 i = find(cmd) |
326 |
314 |
327 def identify(ui, repo): |
315 def identify(ui, repo): |
328 """print information about the working copy""" |
316 """print information about the working copy""" |
329 (c, a, d, u) = repo.diffdir(repo.root) |
317 (c, a, d, u) = repo.diffdir(repo.root) |
330 mflag = (c or a or d or u) and "+" or "" |
318 mflag = (c or a or d or u) and "+" or "" |
331 parents = [parent for parent in repo.dirstate.parents() |
319 parents = [p for p in repo.dirstate.parents() if p != hg.nullid] |
332 if parent != hg.nullid] |
|
333 if not parents: |
320 if not parents: |
334 ui.note("unknown\n") |
321 ui.write("unknown\n") |
335 return |
322 return |
336 |
323 |
337 tstring = '' |
324 tstring = '' |
338 if not ui.quiet: |
325 if not ui.quiet: |
339 taglist = [e[1] for e in tags_load(repo)] |
326 tags = sum(map(repo.nodetags, parents), []) |
340 tstring = " %s" % ' + '.join([e[0] for e in taglist |
327 tstring = " " + ' + '.join(tags) |
341 if e[0] != 'tip' and e[1] in parents]) |
|
342 |
328 |
343 hexfunc = ui.verbose and hg.hex or hg.short |
329 hexfunc = ui.verbose and hg.hex or hg.short |
344 pstring = '+'.join([hexfunc(parent) for parent in parents]) |
330 pstring = '+'.join([hexfunc(parent) for parent in parents]) |
345 ui.write("%s%s%s\n" % (pstring, mflag, tstring)) |
331 ui.write("%s%s%s\n" % (pstring, mflag, tstring)) |
346 |
332 |
542 for f in d: print "R", f |
528 for f in d: print "R", f |
543 for f in u: print "?", f |
529 for f in u: print "?", f |
544 |
530 |
545 def tags(ui, repo): |
531 def tags(ui, repo): |
546 """list repository tags""" |
532 """list repository tags""" |
547 n = tags_load(repo) |
533 |
548 |
534 l = repo.tagslist() |
549 n.sort() |
535 l.reverse() |
550 n.reverse() |
536 for t,n in l: |
551 i = [ e[1] for e in n ] |
|
552 for k, n in i: |
|
553 try: |
537 try: |
554 r = repo.changelog.rev(n) |
538 r = repo.changelog.rev(n) |
555 except KeyError: |
539 except KeyError: |
556 r = "?" |
540 r = "?" |
557 print "%-30s %5d:%s" % (k, repo.changelog.rev(n), hg.hex(n)) |
541 print "%-30s %5d:%s" % (t, repo.changelog.rev(n), hg.hex(n)) |
558 |
542 |
559 def tip(ui, repo): |
543 def tip(ui, repo): |
560 """show the tip revision""" |
544 """show the tip revision""" |
561 n = repo.changelog.tip() |
545 n = repo.changelog.tip() |
562 show_changeset(ui, repo, changenode=n) |
546 show_changeset(ui, repo, changenode=n) |