Submitter | Andrew Shadura |
---|---|
Date | May 5, 2013, 11:37 a.m. |
Message ID | <33f279c34ac6c5b4bd4e.1367753820@localhost.localdomain> |
Download | mbox | patch |
Permalink | /patch/1556/ |
State | Rejected, archived |
Delegated to: | Matt Mackall |
Headers | show |
Comments
On Sun, 2013-05-05 at 13:37 +0200, Andrew Shadura wrote: > # HG changeset patch > # User Andrew Shadura <bugzilla@tut.by> > # Date 1367753776 -7200 > # Node ID 33f279c34ac6c5b4bd4eb525719261afe7e2433d > # Parent 70f0d1da36b0b304ea00fbdd742285e2dc1c22eb > mq: add basic support for DEP-3 patch fields What is this and why do we care? I guess this allows us to read some sort of "standard Debian patch" and set some commit metadata from it. I guess that's useful. Seems like something we'd want on the import command too? Bear in mind that MQ is in the middle of being obsoleted by evolve. > 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. > > 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@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
Hello, On Sun, 05 May 2013 19:56:48 -0500 Matt Mackall <mpm@selenic.com> wrote: > > mq: add basic support for DEP-3 patch fields > What is this and why do we care? > I guess this allows us to read some sort of "standard Debian patch" > and set some commit metadata from it. I guess that's useful. Exactly; I have tried to explain that in the long description of a patch. > Seems like something we'd want on the import command too? Bear in mind > that MQ is in the middle of being obsoleted by evolve. Well, evolve is evolve, and mq is mq. In my opinion, while they solve similar problems, they however do different things. While evolve is cool and great, sometimes patch-orientedness of mq is what better fits the task. And yes, sure, it'd be cool if we had those headers supported on the import command too.
On Sun, May 05, 2013 at 01:37:00PM +0200, Andrew Shadura wrote: > # HG changeset patch > # User Andrew Shadura <bugzilla@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@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
On Sun, 2013-05-05 at 13:37 +0200, Andrew Shadura wrote: > # HG changeset patch > # User Andrew Shadura <bugzilla@tut.by> > # Date 1367753776 -7200 > # Node ID 33f279c34ac6c5b4bd4eb525719261afe7e2433d > # Parent 70f0d1da36b0b304ea00fbdd742285e2dc1c22eb > mq: add basic support for DEP-3 patch fields Going to drop this for now, as it needs two things: - some form of user-facing documentation - parallel behavior in 'hg import'
Patch
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)