changeset 509:98a2935c3d6c

[PATCH] replace history with log -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] replace history with log From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl> Merge hg history into hg log leaving the first as an alias (tweaked by mpm: update docs, tests, use existing alias mechanism) manifest hash: f85001a4373b8b823a6221ba5c506628059d6779 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCwSr1ywK+sNU5EO8RAmbAAJ9HlFkf8/qLOAQUtj8CWxGRPEyzVgCgtXwP SdnAg1a2q4693+TBiOjrimY= =w9rf -----END PGP SIGNATURE-----
author mpm@selenic.com
date Tue, 28 Jun 2005 02:48:21 -0800
parents 42a660abaf75
children 7f3fc8fd427e
files doc/hg.1.txt mercurial/commands.py tests/test-help.out
diffstat 3 files changed, 21 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/doc/hg.1.txt	Tue Jun 28 02:38:33 2005 -0800
+++ b/doc/hg.1.txt	Tue Jun 28 02:48:21 2005 -0800
@@ -146,16 +146,6 @@
     changesets. They are where development generally takes place and
     are the usual targets for update and merge operations.
 
-history::
-    Print a log of the revision history of the repository.
-    
-    By default this command outputs: changeset id and hash, tags,
-    parents, user, date and time, and a summary for each commit. The
-    -v switch adds some more detail, such as changed files, manifest
-    hashes or message signatures.
-
-    To display the history of a given file, see the log command.
-
 identify::
     Print a short summary of the current state of the repo.
     
@@ -178,11 +168,15 @@
 init::
     Initialize a new repository in the current directory.
 
-log <file>::
-    Print the revision history of the specified file.
+log [file]::
+    Print the revision history of the specified file or the entire project.
 
-    To display the revision history for the whole repository, use the history
-    command.
+    By default this command outputs: changeset id and hash, tags,
+    parents, user, date and time, and a summary for each commit. The
+    -v switch adds some more detail, such as changed files, manifest
+    hashes or message signatures.
+
+    aliases: history
 
 manifest [revision]::
     Print a list of version controlled files for the given revision.
--- a/mercurial/commands.py	Tue Jun 28 02:38:33 2005 -0800
+++ b/mercurial/commands.py	Tue Jun 28 02:48:21 2005 -0800
@@ -434,11 +434,6 @@
     for n in repo.changelog.heads():
         show_changeset(ui, repo, changenode=n)
 
-def history(ui, repo):
-    """show the changelog history"""
-    for i in range(repo.changelog.count() - 1, -1, -1):
-        show_changeset(ui, repo, rev=i)
-
 def identify(ui, repo):
     """print information about the working copy"""
     parents = [p for p in repo.dirstate.parents() if p != hg.nullid]
@@ -511,13 +506,16 @@
         sys.exit(1)
     repo = hg.repository(ui, ".", create=1)
 
-def log(ui, repo, f):
-    """show the revision history of a single file"""
-    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)
+def log(ui, repo, f = None):
+    """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)
+    else:
+        for i in range(repo.changelog.count() - 1, -1, -1):
+            show_changeset(ui, repo, rev=i)
 
 def manifest(ui, repo, rev = []):
     """output the latest or given revision of the project manifest"""
@@ -745,7 +743,6 @@
     "export": (export, [], "hg export <changeset>"),
     "forget": (forget, [], "hg forget [files]"),
     "heads": (heads, [], 'hg heads'),
-    "history": (history, [], 'hg history'),
     "help": (help, [], 'hg help [command]'),
     "identify|id": (identify, [], 'hg identify'),
     "import|patch": (import_,
@@ -753,7 +750,7 @@
                       ('b', 'base', "", 'base path')],
                      "hg import [options] <patches>"),
     "init": (init, [], 'hg init'),
-    "log": (log, [], 'hg log <file>'),
+    "log|history": (log, [], 'hg log [file]'),
     "manifest": (manifest, [], 'hg manifest [rev]'),
     "parents": (parents, [], 'hg parents [node]'),
     "pull": (pull,
--- a/tests/test-help.out	Tue Jun 28 02:38:33 2005 -0800
+++ b/tests/test-help.out	Tue Jun 28 02:48:21 2005 -0800
@@ -13,11 +13,10 @@
  forget      don't add the specified files on the next commit
  heads       show current repository heads
  help        show help for a given command or all commands
- history     show the changelog history
  identify    print information about the working copy
  import      import an ordered set of patches
  init        create a new repository in the current directory
- log         show the revision history of a single file
+ log         show the revision history of the repository or a single file
  manifest    output the latest or given revision of the project manifest
  parents     show the parents of the current working dir
  pull        pull changes from the specified source
@@ -65,11 +64,10 @@
  forget      don't add the specified files on the next commit
  heads       show current repository heads
  help        show help for a given command or all commands
- history     show the changelog history
  identify    print information about the working copy
  import      import an ordered set of patches
  init        create a new repository in the current directory
- log         show the revision history of a single file
+ log         show the revision history of the repository or a single file
  manifest    output the latest or given revision of the project manifest
  parents     show the parents of the current working dir
  pull        pull changes from the specified source