##// END OF EJS Templates
Allow specifying revisions in 'hg log' like with 'hg diff'....
Thomas Arendsen Hein -
r552:22043116 default
parent child Browse files
Show More
@@ -167,7 +167,7 b' import [-p <n> -b <base> -q] <patches>::'
167 167 init::
168 168 Initialize a new repository in the current directory.
169 169
170 log [file]::
170 log [-r revision ...] [file]::
171 171 Print the revision history of the specified file or the entire project.
172 172
173 173 By default this command outputs: changeset id and hash, tags,
@@ -175,6 +175,11 b' log [file]::'
175 175 -v switch adds some more detail, such as changed files, manifest
176 176 hashes or message signatures.
177 177
178 When a revision argument is given, only this file or changelog revision
179 is displayed. With two revision arguments all revisions in this range
180 are listed. Additional revision arguments may be given repeating the above
181 cycle.
182
178 183 aliases: history
179 184
180 185 manifest [revision]::
@@ -515,16 +515,28 b' def init(ui, source=None):'
515 515 sys.exit(1)
516 516 repo = hg.repository(ui, ".", create=1)
517 517
518 def log(ui, repo, f = None):
518 def log(ui, repo, f=None, **opts):
519 519 """show the revision history of the repository or a single file"""
520 520 if f:
521 f = relpath(repo, [f])[0]
522 r = repo.file(f)
523 for i in range(r.count() - 1, -1, -1):
524 show_changeset(ui, repo, filelog=r, rev=i)
521 filelog = repo.file(relpath(repo, [f])[0])
522 log = filelog
523 lookup = filelog.lookup
525 524 else:
526 for i in range(repo.changelog.count() - 1, -1, -1):
527 show_changeset(ui, repo, rev=i)
525 filelog = None
526 log = repo.changelog
527 lookup = repo.lookup
528 revlist = []
529 revs = [log.rev(lookup(rev)) for rev in opts['rev']]
530 while revs:
531 if len(revs) == 1:
532 revlist.append(revs.pop(0))
533 else:
534 a = revs.pop(0)
535 b = revs.pop(0)
536 off = a > b and -1 or 1
537 revlist.extend(range(a, b + off, off))
538 for i in revlist or range(log.count() - 1, -1, -1):
539 show_changeset(ui, repo, filelog=filelog, rev=i)
528 540
529 541 def manifest(ui, repo, rev = []):
530 542 """output the latest or given revision of the project manifest"""
@@ -765,7 +777,9 b' table = {'
765 777 ('b', 'base', "", 'base path')],
766 778 "hg import [options] <patches>"),
767 779 "init": (init, [], 'hg init'),
768 "log|history": (log, [], 'hg log [file]'),
780 "log|history": (log,
781 [('r', 'rev', [], 'revision')],
782 'hg log [-r A] [-r B] [file]'),
769 783 "manifest": (manifest, [], 'hg manifest [rev]'),
770 784 "parents": (parents, [], 'hg parents [node]'),
771 785 "pull": (pull,
General Comments 0
You need to be logged in to leave comments. Login now