public function main()
    {
        $clone = $this->getFactoryInstance('archive');
        if ($this->revision !== '') {
            $clone->setRev($this->revision);
        }

        if ($this->destination === null) {
            throw new BuildException("Destination must be set.");
        }
        $clone->setDestination($this->destination);

        try {
            $this->log("Executing: " . $clone->asString(), Project::MSG_INFO);
            $output = $clone->execute();
            if ($output !== '') {
                $this->log(PHP_EOL . $output);
            }
        } catch (Exception $ex) {
            $msg = $ex->getMessage();
            $p = strpos($msg, 'hg returned:');
            if ($p !== false) {
                $msg = substr($msg, $p + 13);
            }
            throw new BuildException($msg);
        }
    }