def tag(self, name, user, revision=None, message=None, date=None,
            **kwargs):
        if name in self.tags:
            raise TagAlreadyExistError("Tag %s already exists" % name)
        changeset = self.get_changeset(revision)
        local = kwargs.setdefault('local', False)

        if message is None:
            message = "Added tag %s for changeset %s" % (name,
                changeset.short_id)

        if date is None:
            date = datetime.datetime.now().ctime()

        try:
            self._repo.tag(name, changeset._ctx.node(), message, local, user,
                date)
        except Abort, e:
            raise RepositoryError(e.message)

        # Reinitialize tags
        self.tags = self._get_tags()
        tag_id = self.tags[name]

        return self.get_changeset(revision=tag_id)
Raises validators.ValidationError if field_data has any errors.
dataset/ETHPy150Open codeinn/vcs/vcs/backends/hg/repository.py/MercurialRepository.tag--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/db/models/fields/__init__.py/Field.validate