comparison mercurial/commands.py @ 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
comparison
equal deleted inserted replaced
15109:f7993be2c32f 15110:7ebf60dbfa46
2183 files it detects as binary. With -a, diff will generate a diff 2183 files it detects as binary. With -a, diff will generate a diff
2184 anyway, probably with undesirable results. 2184 anyway, probably with undesirable results.
2185 2185
2186 Use the -g/--git option to generate diffs in the git extended diff 2186 Use the -g/--git option to generate diffs in the git extended diff
2187 format. For more information, read :hg:`help diffs`. 2187 format. For more information, read :hg:`help diffs`.
2188
2189 .. container:: verbose
2190
2191 Examples:
2192
2193 - compare a file in the current working directory to its parent::
2194
2195 hg diff foo.c
2196
2197 - compare two historical versions of a directory, with rename info::
2198
2199 hg diff --git -r 1.0:1.2 lib/
2200
2201 - get change stats relative to the last change on some date::
2202
2203 hg diff --stat -r "date('may 2')"
2204
2205 - diff all newly-added files that contain a keyword::
2206
2207 hg diff "set:added() and grep(GNU)"
2208
2209 - compare a revision and its parents::
2210
2211 hg diff -c 9353 # compare against first parent
2212 hg diff -r 9353^:9353 # same using revset syntax
2213 hg diff -r 9353^2:9353 # compare against the second parent
2188 2214
2189 Returns 0 on success. 2215 Returns 0 on success.
2190 """ 2216 """
2191 2217
2192 revs = opts.get('rev') 2218 revs = opts.get('rev')