##// END OF EJS Templates
phabricator: fallback to reading metadata from diff for phabread...
Ian Moody -
r42442:a4f7dceb default
parent child Browse files
Show More
@@ -905,22 +905,31 b' def getdiffmeta(diff):'
905 """
905 """
906 props = diff.get(b'properties') or {}
906 props = diff.get(b'properties') or {}
907 meta = props.get(b'hg:meta')
907 meta = props.get(b'hg:meta')
908 if not meta and props.get(b'local:commits'):
908 if not meta:
909 commit = sorted(props[b'local:commits'].values())[0]
909 if props.get(b'local:commits'):
910 meta = {}
910 commit = sorted(props[b'local:commits'].values())[0]
911 if b'author' in commit and b'authorEmail' in commit:
911 meta = {}
912 meta[b'user'] = b'%s <%s>' % (commit[b'author'],
912 if b'author' in commit and b'authorEmail' in commit:
913 commit[b'authorEmail'])
913 meta[b'user'] = b'%s <%s>' % (commit[b'author'],
914 if b'time' in commit:
914 commit[b'authorEmail'])
915 meta[b'date'] = b'%d 0' % commit[b'time']
915 if b'time' in commit:
916 if b'branch' in commit:
916 meta[b'date'] = b'%d 0' % commit[b'time']
917 meta[b'branch'] = commit[b'branch']
917 if b'branch' in commit:
918 node = commit.get(b'commit', commit.get(b'rev'))
918 meta[b'branch'] = commit[b'branch']
919 if node:
919 node = commit.get(b'commit', commit.get(b'rev'))
920 meta[b'node'] = node
920 if node:
921 if len(commit.get(b'parents', ())) >= 1:
921 meta[b'node'] = node
922 meta[b'parent'] = commit[b'parents'][0]
922 if len(commit.get(b'parents', ())) >= 1:
923 return meta or {}
923 meta[b'parent'] = commit[b'parents'][0]
924 else:
925 meta = {}
926 if b'date' not in meta and b'dateCreated' in diff:
927 meta[b'date'] = b'%s 0' % diff[b'dateCreated']
928 if b'branch' not in meta and diff.get(b'branch'):
929 meta[b'branch'] = diff[b'branch']
930 if b'parent' not in meta and diff.get(b'sourceControlBaseRevision'):
931 meta[b'parent'] = diff[b'sourceControlBaseRevision']
932 return meta
924
933
925 def readpatch(repo, drevs, write):
934 def readpatch(repo, drevs, write):
926 """generate plain-text patch readable by 'hg import'
935 """generate plain-text patch readable by 'hg import'
@@ -32,6 +32,8 b' this test.'
32 Basic phabread:
32 Basic phabread:
33 $ hg phabread --test-vcr "$VCR/phabread-4480.json" D4480 | head
33 $ hg phabread --test-vcr "$VCR/phabread-4480.json" D4480 | head
34 # HG changeset patch
34 # HG changeset patch
35 # Date 1536771503 0
36 # Parent a5de21c9e3703f8e8eb064bd7d893ff2f703c66a
35 exchangev2: start to implement pull with wire protocol v2
37 exchangev2: start to implement pull with wire protocol v2
36
38
37 Wire protocol version 2 will take a substantially different
39 Wire protocol version 2 will take a substantially different
@@ -39,8 +41,6 b' Basic phabread:'
39 is concerned).
41 is concerned).
40
42
41 This commit establishes a new exchangev2 module for holding
43 This commit establishes a new exchangev2 module for holding
42 code related to exchange using wire protocol v2. I could have
43 added things to the existing exchange module. But it is already
44
44
45 phabupdate with an accept:
45 phabupdate with an accept:
46 $ hg phabupdate --accept D4564 \
46 $ hg phabupdate --accept D4564 \
General Comments 0
You need to be logged in to leave comments. Login now