##// END OF EJS Templates
phabricator: record all local commits used to create a Differential revision...
Matt Harbison -
r45133:0437959d default
parent child Browse files
Show More
@@ -968,42 +968,49 b' def creatediff(basectx, ctx):'
968 return diff
968 return diff
969
969
970
970
971 def writediffproperties(ctx, diff):
971 def writediffproperties(ctxs, diff):
972 """write metadata to diff so patches could be applied losslessly"""
972 """write metadata to diff so patches could be applied losslessly
973
974 ``ctxs`` is the list of commits that created the diff, in ascending order.
975 The list is generally a single commit, but may be several when using
976 ``phabsend --fold``.
977 """
973 # creatediff returns with a diffid but query returns with an id
978 # creatediff returns with a diffid but query returns with an id
974 diffid = diff.get(b'diffid', diff.get(b'id'))
979 diffid = diff.get(b'diffid', diff.get(b'id'))
980 basectx = ctxs[0]
981 tipctx = ctxs[-1]
982
975 params = {
983 params = {
976 b'diff_id': diffid,
984 b'diff_id': diffid,
977 b'name': b'hg:meta',
985 b'name': b'hg:meta',
978 b'data': templatefilters.json(
986 b'data': templatefilters.json(
979 {
987 {
980 b'user': ctx.user(),
988 b'user': tipctx.user(),
981 b'date': b'%d %d' % ctx.date(),
989 b'date': b'%d %d' % tipctx.date(),
982 b'branch': ctx.branch(),
990 b'branch': tipctx.branch(),
983 b'node': ctx.hex(),
991 b'node': tipctx.hex(),
984 b'parent': ctx.p1().hex(),
992 b'parent': basectx.p1().hex(),
985 }
993 }
986 ),
994 ),
987 }
995 }
988 callconduit(ctx.repo().ui, b'differential.setdiffproperty', params)
996 callconduit(basectx.repo().ui, b'differential.setdiffproperty', params)
989
997
998 commits = {}
999 for ctx in ctxs:
1000 commits[ctx.hex()] = {
1001 b'author': stringutil.person(ctx.user()),
1002 b'authorEmail': stringutil.email(ctx.user()),
1003 b'time': int(ctx.date()[0]),
1004 b'commit': ctx.hex(),
1005 b'parents': [ctx.p1().hex()],
1006 b'branch': ctx.branch(),
1007 }
990 params = {
1008 params = {
991 b'diff_id': diffid,
1009 b'diff_id': diffid,
992 b'name': b'local:commits',
1010 b'name': b'local:commits',
993 b'data': templatefilters.json(
1011 b'data': templatefilters.json(commits),
994 {
995 ctx.hex(): {
996 b'author': stringutil.person(ctx.user()),
997 b'authorEmail': stringutil.email(ctx.user()),
998 b'time': int(ctx.date()[0]),
999 b'commit': ctx.hex(),
1000 b'parents': [ctx.p1().hex()],
1001 b'branch': ctx.branch(),
1002 },
1003 }
1004 ),
1005 }
1012 }
1006 callconduit(ctx.repo().ui, b'differential.setdiffproperty', params)
1013 callconduit(basectx.repo().ui, b'differential.setdiffproperty', params)
1007
1014
1008
1015
1009 def createdifferentialrevision(
1016 def createdifferentialrevision(
@@ -1049,7 +1056,7 b' def createdifferentialrevision('
1049 # pushers could know the correct node metadata.
1056 # pushers could know the correct node metadata.
1050 assert olddiff
1057 assert olddiff
1051 diff = olddiff
1058 diff = olddiff
1052 writediffproperties(ctx, diff)
1059 writediffproperties([ctx], diff)
1053
1060
1054 # Set the parent Revision every time, so commit re-ordering is picked-up
1061 # Set the parent Revision every time, so commit re-ordering is picked-up
1055 if parentrevphid:
1062 if parentrevphid:
@@ -1289,7 +1296,9 b' def phabsend(ui, repo, *revs, **opts):'
1289 # If it fails just warn and keep going, otherwise the DREV
1296 # If it fails just warn and keep going, otherwise the DREV
1290 # associations will be lost
1297 # associations will be lost
1291 try:
1298 try:
1292 writediffproperties(unfi[newnode], diffmap[old.node()])
1299 writediffproperties(
1300 [unfi[newnode]], diffmap[old.node()]
1301 )
1293 except util.urlerr.urlerror:
1302 except util.urlerr.urlerror:
1294 ui.warnnoi18n(
1303 ui.warnnoi18n(
1295 b'Failed to update metadata for D%d\n' % drevid
1304 b'Failed to update metadata for D%d\n' % drevid
General Comments 0
You need to be logged in to leave comments. Login now