# HG changeset patch # User mpm@selenic.com # Date 1120205452 28800 # Node ID f2442a6a589355e6c29b01882acaa8e439611ee0 # Parent b460a2fd8bb7855348fafb861cd22de1616d331e# Parent 2204311609a08017171372e6be13304222dccaa1 Merge with TAH -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Merge with TAH manifest hash: b8ea5be49794773eeb6b8beb712a7c1bd9ed1e9b -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCxPqMywK+sNU5EO8RAn62AJ9nmqCKGck8T4E90V+jljRV56hcHwCff0Co jTfrJT1oJrGRgd6VE/B4hKc= =8nW7 -----END PGP SIGNATURE----- diff --git a/doc/hg.1.txt b/doc/hg.1.txt --- a/doc/hg.1.txt +++ b/doc/hg.1.txt @@ -167,7 +167,7 @@ import [-p -b -q] :: init:: Initialize a new repository in the current directory. -log [file]:: +log [-r revision ...] [file]:: Print the revision history of the specified file or the entire project. By default this command outputs: changeset id and hash, tags, @@ -175,6 +175,11 @@ log [file]:: -v switch adds some more detail, such as changed files, manifest hashes or message signatures. + When a revision argument is given, only this file or changelog revision + is displayed. With two revision arguments all revisions in this range + are listed. Additional revision arguments may be given repeating the above + cycle. + aliases: history manifest [revision]:: diff --git a/mercurial/bdiff.c b/mercurial/bdiff.c diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -515,16 +515,28 @@ def init(ui, source=None): sys.exit(1) repo = hg.repository(ui, ".", create=1) -def log(ui, repo, f = None): +def log(ui, repo, f=None, **opts): """show the revision history of the repository or a single file""" if f: - f = relpath(repo, [f])[0] - r = repo.file(f) - for i in range(r.count() - 1, -1, -1): - show_changeset(ui, repo, filelog=r, rev=i) + filelog = repo.file(relpath(repo, [f])[0]) + log = filelog + lookup = filelog.lookup else: - for i in range(repo.changelog.count() - 1, -1, -1): - show_changeset(ui, repo, rev=i) + filelog = None + log = repo.changelog + lookup = repo.lookup + revlist = [] + revs = [log.rev(lookup(rev)) for rev in opts['rev']] + while revs: + if len(revs) == 1: + revlist.append(revs.pop(0)) + else: + a = revs.pop(0) + b = revs.pop(0) + off = a > b and -1 or 1 + revlist.extend(range(a, b + off, off)) + for i in revlist or range(log.count() - 1, -1, -1): + show_changeset(ui, repo, filelog=filelog, rev=i) def manifest(ui, repo, rev = []): """output the latest or given revision of the project manifest""" @@ -765,7 +777,9 @@ table = { ('b', 'base', "", 'base path')], "hg import [options] "), "init": (init, [], 'hg init'), - "log|history": (log, [], 'hg log [file]'), + "log|history": (log, + [('r', 'rev', [], 'revision')], + 'hg log [-r A] [-r B] [file]'), "manifest": (manifest, [], 'hg manifest [rev]'), "parents": (parents, [], 'hg parents [node]'), "pull": (pull, diff --git a/mercurial/hg.py b/mercurial/hg.py diff --git a/mercurial/mpatch.c b/mercurial/mpatch.c