Submitter | phabricator |
---|---|
Date | April 19, 2018, 1:06 a.m. |
Message ID | <differential-rev-PHID-DREV-b7gfjrbr2xjs7tvyjqll-req@phab.mercurial-scm.org> |
Download | mbox | patch |
Permalink | /patch/31191/ |
State | Superseded |
Headers | show |
Comments
tom.prince added a comment. This is just enough metadata to support Mozilla's autolanding service. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3414 To: tom.prince, #hg-reviewers, indygreg Cc: mercurial-devel
durin42 accepted this revision as: durin42. durin42 added a comment. I'm in favor, and would be fine with this change to a contrib script landing during the freeze. If someone else agrees, please land this. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3414 To: tom.prince, #hg-reviewers, indygreg, durin42 Cc: durin42, mercurial-devel
pulkit added a comment. There is missing `"""` which is resulting in SyntaxError. @tom.prince can you followup with a fix? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3414 To: tom.prince, #hg-reviewers, indygreg, durin42 Cc: pulkit, durin42, mercurial-devel
durin42 added a comment.
In https://phab.mercurial-scm.org/D3414#54497, @pulkit wrote:
> There is missing `"""` which is resulting in SyntaxError. @tom.prince can you followup with a fix?
Belay that @tom.prince, it looks like this patch got mangled at import time due to a bug in 4.6rc0. We've fixed that bug, and will touch up the damage to this patch. Sorry for the noise!
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3414
To: tom.prince, #hg-reviewers, indygreg, durin42
Cc: pulkit, durin42, mercurial-devel
Patch
diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -2341,6 +2341,33 @@ r = None return author[author.find('<') + 1:r] +def person(author): + """Any text. Returns the name before an email address, + interpreting it as per RFC 5322. + + >>> person(b'foo@bar') + 'foo' + >>> person(b'Foo Bar <foo@bar>') + 'Foo Bar' + >>> person(b'"Foo Bar" <foo@bar>') + 'Foo Bar' + >>> person(b'"Foo \"buz\" Bar" <foo@bar>') + 'Foo "buz" Bar' + >>> # The following are invalid, but do exist in real-life + ... + >>> person(b'Foo "buz" Bar <foo@bar>') + 'Foo "buz" Bar' + >>> person(b'"Foo Bar <foo@bar>') + 'Foo Bar' + """ + if '@' not in author: + return author + f = author.find('<') + if f != -1: + return author[:f].strip(' "').replace('\\"', '"') + f = author.find('@') + return author[:f].replace('.', ' ') + def ellipsis(text, maxlength=400): """Trim string to at most maxlength (default: 400) columns in display.""" return encoding.trim(text, maxlength, ellipsis='...') diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py --- a/mercurial/templatefilters.py +++ b/mercurial/templatefilters.py @@ -297,13 +297,7 @@ >>> person(b'"Foo Bar <foo@bar>') 'Foo Bar' """ - if '@' not in author: - return author - f = author.find('<') - if f != -1: - return author[:f].strip(' "').replace('\\"', '"') - f = author.find('@') - return author[:f].replace('.', ' ') + return util.person(author) @templatefilter('revescape') def revescape(text): diff --git a/contrib/phabricator.py b/contrib/phabricator.py --- a/contrib/phabricator.py +++ b/contrib/phabricator.py @@ -306,6 +306,19 @@ } callconduit(ctx.repo(), 'differential.setdiffproperty', params) + params = { + 'diff_id': diff[r'id'], + 'name': 'local:commits', + 'data': json.dumps({ + ctx.hex(): { + 'author': util.person(ctx.user()), + 'authorEmail': util.email(ctx.user()), + 'time': ctx.date()[0], + }, + }), + } + callconduit(ctx.repo(), 'differential.setdiffproperty', params) + def createdifferentialrevision(ctx, revid=None, parentrevid=None, oldnode=None, olddiff=None, actions=None): """create or update a Differential Revision