changeset 553:f2442a6a5893

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-----
author mpm@selenic.com
date Fri, 01 Jul 2005 00:10:52 -0800
parents b460a2fd8bb7 (current diff) 2204311609a0 (diff)
children 2f515dcfbc24
files doc/hg.1.txt mercurial/bdiff.c mercurial/commands.py mercurial/hg.py mercurial/mpatch.c
diffstat 2 files changed, 28 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/doc/hg.1.txt	Thu Jun 30 23:54:17 2005 -0800
+++ b/doc/hg.1.txt	Fri Jul 01 00:10:52 2005 -0800
@@ -167,7 +167,7 @@
 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 @@
     -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]::
--- a/mercurial/commands.py	Thu Jun 30 23:54:17 2005 -0800
+++ b/mercurial/commands.py	Fri Jul 01 00:10:52 2005 -0800
@@ -515,16 +515,28 @@
         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 @@
                       ('b', 'base', "", 'base path')],
                      "hg import [options] <patches>"),
     "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,