changeset 15110:7ebf60dbfa46

diff: add help examples
author Matt Mackall <mpm@selenic.com>
date Fri, 16 Sep 2011 16:39:55 -0500
parents f7993be2c32f
children 0be86ec3cafe
files mercurial/commands.py tests/test-help.t
diffstat 2 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Sep 16 15:31:21 2011 -0500
+++ b/mercurial/commands.py	Fri Sep 16 16:39:55 2011 -0500
@@ -2186,6 +2186,32 @@
     Use the -g/--git option to generate diffs in the git extended diff
     format. For more information, read :hg:`help diffs`.
 
+    .. container:: verbose
+
+      Examples:
+
+      - compare a file in the current working directory to its parent::
+
+          hg diff foo.c
+
+      - compare two historical versions of a directory, with rename info::
+
+          hg diff --git -r 1.0:1.2 lib/
+
+      - get change stats relative to the last change on some date::
+
+          hg diff --stat -r "date('may 2')"
+
+      - diff all newly-added files that contain a keyword::
+
+          hg diff "set:added() and grep(GNU)"
+
+      - compare a revision and its parents::
+
+          hg diff -c 9353         # compare against first parent
+          hg diff -r 9353^:9353   # same using revset syntax
+          hg diff -r 9353^2:9353  # compare against the second parent
+
     Returns 0 on success.
     """
 
--- a/tests/test-help.t	Fri Sep 16 15:31:21 2011 -0500
+++ b/tests/test-help.t	Fri Sep 16 16:39:55 2011 -0500
@@ -432,6 +432,8 @@
   
       Returns 0 on success.
   
+  use "hg -v help diff" to show verbose help
+  
   options:
   
    -r --rev REV [+]          revision