hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
diff repository (or selected files)
Show differences between revisions for the specified files.
Differences between files are shown using the unified diff format.
Note: diff may generate unexpected results for merges, as it will default to comparing against the working directory's first parent changeset if no revisions are specified.
When two revision arguments are given, then changes are shown between those revisions. If only one revision is specified then that revision is compared to the working directory, and, when no revisions are specified, the working directory files are compared to its parent.
Alternatively you can specify -c/--change with a revision to see the changes in that changeset relative to its first parent.
Without the -a/--text option, diff will avoid generating diffs of files it detects as binary. With -a, diff will generate a diff anyway, probably with undesirable results.
Use the -g/--git option to generate diffs in the git extended diff format. For more information, read "hg help diffs".
Examples:
hg diff foo.c
hg diff --git -r 1.0:1.2 lib/
hg diff --stat -r "date('may 2')"
hg diff "set:added() and grep(GNU)"
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.
options:
-r | --rev REV [+] | revision |
-c | --change REV | change made by revision |
-a | --text | treat all files as text |
-g | --git | use git extended diff format |
--nodates | omit dates from diff headers | |
-p | --show-function | show which function each change is in |
--reverse | produce a diff that undoes the changes | |
-w | --ignore-all-space | ignore white space when comparing lines |
-b | --ignore-space-change | ignore changes in the amount of white space |
-B | --ignore-blank-lines | ignore changes whose lines are all blank |
-U | --unified NUM | number of lines of context to show |
--stat | output diffstat-style summary of changes | |
-I | --include PATTERN [+] | include names matching the given patterns |
-X | --exclude PATTERN [+] | exclude names matching the given patterns |
-S | --subrepos | recurse into subrepositories |
[+] marked option can be specified multiple times
global options:
-R | --repository REPO | repository root directory or name of overlay bundle file |
--cwd DIR | change working directory | |
-y | --noninteractive | do not prompt, automatically pick the first choice for all prompts |
-q | --quiet | suppress output |
-v | --verbose | enable additional output |
--config CONFIG [+] | set/override config option (use 'section.name=value') | |
--debug | enable debugging output | |
--debugger | start debugger | |
--encoding ENCODE | set the charset encoding (default: ascii) | |
--encodingmode MODE | set the charset encoding mode (default: strict) | |
--traceback | always print a traceback on exception | |
--time | time how long the command takes | |
--profile | print command execution profile | |
--version | output version information and exit | |
-h | --help | display help and exit |
--hidden | consider hidden changesets |
[+] marked option can be specified multiple times