public HgVersionTokenReplacer(HgInfoProvider infoProvider)
 {
     AddToken("REVNUM", () => infoProvider.GetRevisionNumber().ToString());
     AddToken("REVNUM_MOD", x => (infoProvider.GetRevisionNumber() % x).ToString());
     AddToken("REVNUM_DIV", x => (infoProvider.GetRevisionNumber() / x).ToString());
     AddToken("REVID", () => infoProvider.GetRevisionId());
     AddToken("REVIDLONG", () => infoProvider.GetLongRevisionId());
     AddToken("DIRTY", () => infoProvider.IsWorkingCopyDirty() ? "1" : "0");
     AddToken("BRANCH", () => infoProvider.GetBranch());
     AddToken("TAGS", () => infoProvider.GetTags());
 }
 public HgVersionTokenReplacer(HgInfoProvider infoProvider)
 {
     AddToken("REVNUM", () => infoProvider.GetRevisionNumber().ToString());
     AddToken("REVNUM_MOD", x => (infoProvider.GetRevisionNumber() % x).ToString());
     AddToken("REVNUM_DIV", x => (infoProvider.GetRevisionNumber() / x).ToString());
     AddToken("REVID", () => infoProvider.GetRevisionId(false));
     AddToken("REVIDLONG", () => infoProvider.GetRevisionId(true));
     AddToken("DIRTY", () => infoProvider.IsWorkingCopyDirty() ? "1" : "0");
     AddToken("BRANCH", () => infoProvider.GetBranch());
     AddToken("TAGS", () => infoProvider.GetTags());
 }
        public override bool Execute()
        {
            try
            {
                HgInfoProvider infoProvider = new HgInfoProvider();
                infoProvider.Path = ToolPath;
                infoProvider.IgnoreToolNotFound = IgnoreToolNotFound;

                Revision = infoProvider.GetRevisionNumber().ToString(CultureInfo.InvariantCulture);
                Dirty    = infoProvider.IsWorkingCopyDirty() ? "1" : "0";
                return(true);
            }
            catch (BuildErrorException e)
            {
                Log.LogError(e.Message);
                return(false);
            }
        }