[PATCH] mq: add basic support for DEP-3 patch fields

Augie Fackler raf at durin42.com
Tue May 7 12:48:24 CDT 2013


On Sun, May 05, 2013 at 01:37:00PM +0200, Andrew Shadura wrote:
> # HG changeset patch
> # User Andrew Shadura <bugzilla at tut.by>
> # Date 1367753776 -7200
> # Node ID 33f279c34ac6c5b4bd4eb525719261afe7e2433d
> # Parent  70f0d1da36b0b304ea00fbdd742285e2dc1c22eb
> mq: add basic support for DEP-3 patch fields
>
> Add support for fields specified in Debian patch tagging guidelines
> in a document called DEP-3. The documents specifies Description,
> Author and Last-Update headers, which are semantically almost
> identical to Subject, From and Date already supported by mq.
>
> Additional features of DEP-3, such as Description continuation lines,
> multiple Author fields aren't (yet) supported. Also, Last-Update
> header isn't updated, as it uses ISO date format without time,
> so having Date instead makes more sense.

Multiple authors you could store in an "extra-authors" field in the
change's extra.

>
> diff --git a/hgext/mq.py b/hgext/mq.py
> --- a/hgext/mq.py
> +++ b/hgext/mq.py
> @@ -146,14 +146,26 @@ class patchheader(object):
>                                             line.startswith("subject: "))):
>                  subject = line[9:]
>                  format = "tag"
> +            elif (format != "tagdone" and (line.startswith("Description: ") or
> +                                           line.startswith("description: "))):
> +                subject = line[13:]
> +                format = "tag"
>              elif (format != "tagdone" and (line.startswith("From: ") or
>                                             line.startswith("from: "))):
>                  user = line[6:]
>                  format = "tag"
> +            elif (format != "tagdone" and (line.startswith("Author: ") or
> +                                           line.startswith("author: "))):
> +                user = line[8:]
> +                format = "tag"
>              elif (format != "tagdone" and (line.startswith("Date: ") or
>                                             line.startswith("date: "))):
>                  date = line[6:]
>                  format = "tag"
> +            elif (format != "tagdone" and (line.startswith("Last-Update: ") or
> +                                           line.startswith("last-update: "))):
> +                date = line[13:]
> +                format = "tag"
>              elif format == "tag" and line == "":
>                  # when looking for tags (subject: from: etc) they
>                  # end once you find a blank line in the source
> @@ -187,7 +199,7 @@ class patchheader(object):
>          self.plainmode = plainmode
>
>      def setuser(self, user):
> -        if not self.updateheader(['From: ', '# User '], user):
> +        if not self.updateheader(['From: ', 'Author: ', '# User '], user):
>              try:
>                  patchheaderat = self.comments.index('# HG changeset patch')
>                  self.comments.insert(patchheaderat + 1, '# User ' + user)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list