[F014] AddRemove

This functionality aims to surround : hg addremove and to adapt it for <ant> tags.

Shell command

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

add all new files, delete all missing files

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

    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. With a parameter
    greater than 0, this compares every removed file with every added file and
    records those similar enough as renames. This option takes a percentage
    between 0 (disabled) and 100 (files must be identical) as its parameter.
    Detecting renamed files this way can be expensive.


 -s --similarity  guess renamed files by similarity (0<=s<=100)
 -I --include     include names matching the given patterns
 -X --exclude     exclude names matching the given patterns
 -n --dry-run     do not perform actions, just print output

use "hg -v help addremove" to show global options


Attribute Description Value Required
cmd hg command addremove yes
dir directory to addremove yes
dry-run do not perform actions, just print output true/false, yes/no, on/off no
Nested element Description Required
dirset resource collections no
arg command line argument value no


<project name="hg-addremove" default="addremove" basedir=".">

  <taskdef resource="net/sourceforge/ant4hg/taskdefs/antlib.xml" />

  <property name="user" value="myname"/>
  <!-- patterns -->
  <patternset id="cpp.pattern">
    <include name="**/*.cpp" />

  <target name="addremove">
    <hg cmd="addremove" dir="." pattern="cpp.pattern" />

  <target name="add2">
    <hg cmd="addremove" dir=".">
      <dirset dir="src">
        <include name="**/*.java"/>
        <exclude name="**/*.bak"/>