711 raise error.ParseError(_("localdate expects a timezone")) |
711 raise error.ParseError(_("localdate expects a timezone")) |
712 else: |
712 else: |
713 tzoffset = util.makedate()[1] |
713 tzoffset = util.makedate()[1] |
714 return (date[0], tzoffset) |
714 return (date[0], tzoffset) |
715 |
715 |
|
716 @templatefunc('relpath(path)') |
|
717 def relpath(context, mapping, args): |
|
718 """Convert a repository-absolute path into a filesystem path relative to |
|
719 the current working directory.""" |
|
720 if len(args) != 1: |
|
721 # i18n: "relpath" is a keyword |
|
722 raise error.ParseError(_("relpath expects one argument")) |
|
723 |
|
724 repo = mapping['ctx'].repo() |
|
725 path = evalstring(context, mapping, args[0]) |
|
726 return repo.pathto(path) |
|
727 |
716 @templatefunc('revset(query[, formatargs...])') |
728 @templatefunc('revset(query[, formatargs...])') |
717 def revset(context, mapping, args): |
729 def revset(context, mapping, args): |
718 """Execute a revision set query. See |
730 """Execute a revision set query. See |
719 :hg:`help revset`.""" |
731 :hg:`help revset`.""" |
720 if not len(args) > 0: |
732 if not len(args) > 0: |