[F002] Status

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

Shell command

hg status [OPTION]... [FILE]...

aliases: st

show changed files in the working directory

    Show status of files in the repository. If names are given, only files
    that match are shown. Files that are clean or ignored or the source of a
    copy/move operation, are not listed unless -c/--clean, -i/--ignored,
    -C/--copies or -A/--all are given. Unless options described with "show
    only ..." are given, the options -mardu are used.

    Option -q/--quiet hides untracked (unknown and ignored) files unless
    explicitly requested with -u/--unknown or -i/--ignored.

    NOTE: status may appear to disagree with diff if permissions have changed
    or a merge has occurred. The standard diff format does not report
    permission changes and diff only reports changes relative to one merge

    If one revision is given, it is used as the base revision. If two
    revisions are given, the differences between them are shown.

    The codes used to show the status of files are:

      M = modified
      A = added
      R = removed
      C = clean
      ! = missing (deleted by non-hg command, but still tracked)
      ? = not tracked
      I = ignored
        = origin of the previous file listed as A (added)


 -A --all        show status of all files
 -m --modified   show only modified files
 -a --added      show only added files
 -r --removed    show only removed files
 -d --deleted    show only deleted (but tracked) files
 -c --clean      show only files without changes
 -u --unknown    show only unknown (not tracked) files
 -i --ignored    show only ignored files
 -n --no-status  hide status prefix
 -C --copies     show source of copied files
 -0 --print0     end filenames with NUL, for use with xargs
    --rev        show difference from revision
 -I --include    include names matching the given patterns
 -X --exclude    exclude names matching the given patterns

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


Attribute Description Value Required
cmd hg command status yes
dir directory to check yes
status files status all (default) | modified
added | removed
deleted | clean
unknown | ignored
Nested element Description Required
dirset resource collections no
arg command line argument value no

Missing options :
-n --no-status hide status prefix
-C --copies show source of copied files
-0 --print0 end filenames with NUL, for use with xargs
--rev show difference from revision


<hg cmd="status" dir="/my/rootdirectory/dir/to/check" status="modified">
  <dirset dir="/my/rootdirectory/dir/to/check">
    <include name="**/*.cpp"/>
    <exclude name="**/*.bak"/>

ant4hg set properties to retrieve status values :

  • ant4hg.status.list
  • ant4hg.status.♯list
  • ant4hg.status.delimiter

They can be used with ant-contrib <for> task :

<?xml version="1.0" encoding="UTF-8"?>
<project name="test-status" basedir="." default="test1" xmlns:ac="antlib:net.sf.antcontrib" xmlns="antlib:org.apache.tools.ant">

  <property environment="myenv" />
  <path id="ant4hg.classpath">
    <fileset dir="BJDOLLAR{myenv.ANT_HOME}/lib">
      <include name="ant.jar" />
      <include name="ant-launcher.jar" />
      <include name="ant4hg.jar" />
      <include name="ant-contrib-1.0b3.jar" />
  <taskdef resource="net/sourceforge/ant4hg/taskdefs/antlib.xml" classpathref="ant4hg.classpath" />
  <taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="ant4hg.classpath" />
  <target name="test1">  
    <hg cmd="status" dir="." />

    <!-- list all files -->
    <echo>NB ELEMENTS : BJDOLLAR{ant4hg.status.#list}</echo>
    <ac:for list="BJDOLLAR{ant4hg.status.list}" delimiter="BJDOLLAR{ant4hg.status.delimiter}" param="line">
        <echo>LINE : @{line}</echo>