/* ====================================================================
 * Copyright (c) 2003-2006, 2008  Martin Hauner
 *                                http://subcommander.tigris.org
 *
 * Subcommander is licensed as described in the file doc/COPYING, which
 * you should have received as part of this distribution.
 * ====================================================================
 */

// sc
#include "BlameCmd.h"
#include "BlameParam.h"
#include "CmdResultCallback.h"
#include "CmdProgressCallback.h"
#include "svn/Client.h"


BlameCmd::BlameCmd( BlameParam* param, CmdResultCallback* cb )
: ScCmd(param->getId()), _param(param), _cb(cb)
{
}

BlameCmd::~BlameCmd()
{
  delete _cb;
}

void BlameCmd::run()
{
  sc::Error* err;

  _prgscb->started( _param, getCancel() );

  err = _client->blame( _param->getPathOrUrl(), *_param->getStartRevision(),
    *_param->getStopRevision(), _param->getBaton() );

  _param->setError( err );
  _prgscb->finished( _param );

  _cb->handleResult( _param, err );
}
