Home


Overview

ANT4HG is an ANT task for HG ( mercurial ) , a distributed source control management system.

You can use ant4hg :

  • as a build tool, in your ant scripts,
  • as a Java API (see ant4hg API ),


Latest version is ant4hg V0.07. It has been released with ant 1.8.0 and hg 1.5.1.
Source code and binaries are available on the SourceForge download page .

Important

Consider using :
<taskdef resource="net/sourceforge/ant4hg/taskdefs/antlib.xml" />
instead of :
<taskdef resource="net/sourceforge/ant4hg/antlib.xml" />


Contributions

Developper cookbook

To implement missing commands, please read this cookbook.
For example :

$ hg help summary
hg summary [--remote]

aliases: sum

summarize working directory state

    This generates a brief summary of the working directory state, including
    parents, branch, commit status, and available updates.

    With the --remote option, this will check the default paths for incoming
    and outgoing changes. This can be time-consuming.

options:

    --remote  check for push and pull
               


  1. net/sourceforge/ant4hg/taskdefs/SummaryTask.java

    Create new class

    package net.sourceforge.ant4hg.taskdefs;
    public class SummaryTask extends HgTask {
        public SummaryTask(HgTask task) {
            super(task);
        }
    }
                                           
    


  2. net/sourceforge/ant4hg/taskdefs/HgTask.java

    Write options

    protected String remote;
    public void setRemote(String remote) {
            this.remote = remote;
    }
                                           
    


  3. net/sourceforge/ant4hg/taskdefs/SummaryTask.java

    Copy options

    public SummaryTask(HgTask task) {
            super(task);
            
            // copy options
            this.remote = task.remote;
    }
                                           
    


  4. net/sourceforge/ant4hg/taskdefs/SummaryTask.java

    Override : initCommandLine

        @Override
        public void initCommandLine() {
            super.initCommandLine();
            
            // init command line
            if (isTrue(remote)) {
                super.cmdl.createArgument().setValue("--remote");
            }               
            
            // OR if (isSet(remote) && remote.equals("true") ) ...
        }
    }
                                           
    


  5. antunit tests
    <hg cmd="summary" dir="." remote="true" />
    <au:assertLogContains text="..." level="info" />
                                           
    




Features

ANT4HG aims to support all mercurial functionalities.
Current functionalities are described in the specification document.

Table  1.  Traceability matrix

Requirement Function specification Test cases
F001 hg init TC#F001
F002 hg status TC#F002
F003 hg log TC#F003
F004 hg add TC#F004
F005 hg remove TC#F005
F006 hg commit TC#F006
F007 hg update TC#F007
F008 hg clone TC#F008
F009 hg pull TC#F009
F010 hg push TC#F010
F011 hg export TC#F011



News

  • [2009-05-10] mercurial ant task V0.07 is available for download .

    Added features : f11-export

  • [2009-11-29] mercurial ant task V0.06 released.

    Updated features : f008-clone, f009-pull, f010-push

  • [2009-09-24] mercurial ant task V0.05 released.

    New features : f008-clone, f009-pull, f010-push
    (added to f001-init, f002-status, f003-log, f004-add, f005-remove, f006-commit, f007-update)

  • [2009-07-07] mercurial ant task V0.04 released.

  • [2009-05-27] mercurial ant task V0.03 released.

  • [2009-04-15] mercurial ant task V0.02 released.

  • [2009-04-08] specifications : first draft