Help: addremove

hg addremove [OPTION]... [FILE]...

add all new files, delete all missing files

Add all new files and remove all missing files from the repository.

Unless names are given, new files are ignored if they match any of the patterns in ".hgignore". As with add, these changes take effect at the next commit.

Use the -s/--similarity option to detect renamed files. This option takes a percentage between 0 (disabled) and 100 (files must be identical) as its parameter. With a parameter greater than 0, this compares every removed file with every added file and records those similar enough as renames. Detecting renamed files this way can be expensive. After using this option, 'hg status -C' can be used to check which files were identified as moved or renamed. If not specified, -s/--similarity defaults to 100 and only renames of identical files are detected.

Examples:

  • A number of files (bar.c and foo.c) are new, while foobar.c has been removed (without using 'hg remove') from the repository:
    $ ls
    bar.c foo.c
    $ hg status
    ! foobar.c
    ? bar.c
    ? foo.c
    $ hg addremove
    adding bar.c
    adding foo.c
    removing foobar.c
    $ hg status
    A bar.c
    A foo.c
    R foobar.c
    
  • A file foobar.c was moved to foo.c without using 'hg rename'. Afterwards, it was edited slightly:
    $ ls
    foo.c
    $ hg status
    ! foobar.c
    ? foo.c
    $ hg addremove --similarity 90
    removing foobar.c
    adding foo.c
    recording removal of foobar.c as rename to foo.c (94% similar)
    $ hg status -C
    A foo.c
      foobar.c
    R foobar.c
    

Returns 0 if all files are successfully added.

options ([+] can be repeated):

-s --similarity SIMILARITY guess renamed files by similarity (0<=s<=100)
-S --subrepos recurse into subrepositories
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns
-n --dry-run do not perform actions, just print output

global options ([+] can be repeated):

-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
--color TYPE when to colorize (boolean, always, auto, never, or debug)
--config CONFIG [+] set/override config option (use 'section.name=value')
--debug enable debugging output
--debugger start debugger
--encoding ENCODE set the charset encoding (default: "UTF-8")
--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
--pager TYPE when to paginate (boolean, always, auto, or never) (default: auto)