Patchwork D6299: phabricator: don't assume the existence of properties of local:commits

login
register
mail settings
Submitter phabricator
Date April 25, 2019, 6:07 p.m.
Message ID <9cc0f49d9f5ef80e8de1c20a904bbbd8@localhost.localdomain>
Download mbox | patch
Permalink /patch/39828/
State Not Applicable
Headers show

Comments

phabricator - April 25, 2019, 6:07 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6dd454e5b123: phabricator: don&#039;t assume the existence of properties of local:commits (authored by Kwan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6299?vs=14887&id=14921

REVISION DETAIL
  https://phab.mercurial-scm.org/D6299

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS




To: Kwan, #hg-reviewers, indygreg, pulkit
Cc: mercurial-devel

Patch

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -905,11 +905,14 @@ 
     meta = props.get(b'hg:meta')
     if not meta and props.get(b'local:commits'):
         commit = sorted(props[b'local:commits'].values())[0]
-        meta = {
-            b'date': b'%d 0' % commit[b'time'],
-            b'node': commit[b'rev'],
-            b'user': b'%s <%s>' % (commit[b'author'], commit[b'authorEmail']),
-        }
+        meta = {}
+        if b'author' in commit and b'authorEmail' in commit:
+            meta[b'user'] = b'%s <%s>' % (commit[b'author'],
+                                          commit[b'authorEmail'])
+        if b'time' in commit:
+            meta[b'date'] = b'%d 0' % commit[b'time']
+        if b'rev' in commit:
+            meta[b'node'] = commit[b'rev']
         if len(commit.get(b'parents', ())) >= 1:
             meta[b'parent'] = commit[b'parents'][0]
     return meta or {}