Show More
@@ -1014,9 +1014,10 b' def writediffproperties(ctxs, diff):' | |||||
1014 |
|
1014 | |||
1015 |
|
1015 | |||
1016 | def createdifferentialrevision( |
|
1016 | def createdifferentialrevision( | |
1017 | ctx, |
|
1017 | ctxs, | |
1018 | revid=None, |
|
1018 | revid=None, | |
1019 | parentrevphid=None, |
|
1019 | parentrevphid=None, | |
|
1020 | oldbasenode=None, | |||
1020 | oldnode=None, |
|
1021 | oldnode=None, | |
1021 | olddiff=None, |
|
1022 | olddiff=None, | |
1022 | actions=None, |
|
1023 | actions=None, | |
@@ -1027,17 +1028,29 b' def createdifferentialrevision(' | |||||
1027 | If revid is None, create a new Differential Revision, otherwise update |
|
1028 | If revid is None, create a new Differential Revision, otherwise update | |
1028 | revid. If parentrevphid is not None, set it as a dependency. |
|
1029 | revid. If parentrevphid is not None, set it as a dependency. | |
1029 |
|
1030 | |||
|
1031 | If there is a single commit for the new Differential Revision, ``ctxs`` will | |||
|
1032 | be a list of that single context. Otherwise, it is a list that covers the | |||
|
1033 | range of changes for the differential, where ``ctxs[0]`` is the first change | |||
|
1034 | to include and ``ctxs[-1]`` is the last. | |||
|
1035 | ||||
1030 | If oldnode is not None, check if the patch content (without commit message |
|
1036 | If oldnode is not None, check if the patch content (without commit message | |
1031 | and metadata) has changed before creating another diff. |
|
1037 | and metadata) has changed before creating another diff. For a Revision with | |
|
1038 | a single commit, ``oldbasenode`` and ``oldnode`` have the same value. For a | |||
|
1039 | Revision covering multiple commits, ``oldbasenode`` corresponds to | |||
|
1040 | ``ctxs[0]`` the previous time this Revision was posted, and ``oldnode`` | |||
|
1041 | corresponds to ``ctxs[-1]``. | |||
1032 |
|
1042 | |||
1033 | If actions is not None, they will be appended to the transaction. |
|
1043 | If actions is not None, they will be appended to the transaction. | |
1034 | """ |
|
1044 | """ | |
1035 |
|
|
1045 | ctx = ctxs[-1] | |
|
1046 | basectx = ctxs[0] | |||
|
1047 | ||||
1036 | repo = ctx.repo() |
|
1048 | repo = ctx.repo() | |
1037 | if oldnode: |
|
1049 | if oldnode: | |
1038 | diffopts = mdiff.diffopts(git=True, context=32767) |
|
1050 | diffopts = mdiff.diffopts(git=True, context=32767) | |
1039 |
|
|
1051 | unfi = repo.unfiltered() | |
1040 |
old |
|
1052 | oldctx = unfi[oldnode] | |
|
1053 | oldbasectx = unfi[oldbasenode] | |||
1041 | neednewdiff = getdiff(basectx, ctx, diffopts) != getdiff( |
|
1054 | neednewdiff = getdiff(basectx, ctx, diffopts) != getdiff( | |
1042 | oldbasectx, oldctx, diffopts |
|
1055 | oldbasectx, oldctx, diffopts | |
1043 | ) |
|
1056 | ) | |
@@ -1056,7 +1069,7 b' def createdifferentialrevision(' | |||||
1056 | # pushers could know the correct node metadata. |
|
1069 | # pushers could know the correct node metadata. | |
1057 | assert olddiff |
|
1070 | assert olddiff | |
1058 | diff = olddiff |
|
1071 | diff = olddiff | |
1059 |
writediffproperties( |
|
1072 | writediffproperties(ctxs, diff) | |
1060 |
|
1073 | |||
1061 | # Set the parent Revision every time, so commit re-ordering is picked-up |
|
1074 | # Set the parent Revision every time, so commit re-ordering is picked-up | |
1062 | if parentrevphid: |
|
1075 | if parentrevphid: | |
@@ -1076,7 +1089,7 b' def createdifferentialrevision(' | |||||
1076 | # this gets assigned to the title. |
|
1089 | # this gets assigned to the title. | |
1077 | fields = util.sortdict() # sorted for stable wire protocol in tests |
|
1090 | fields = util.sortdict() # sorted for stable wire protocol in tests | |
1078 |
|
1091 | |||
1079 |
for i, _ctx in enumerate( |
|
1092 | for i, _ctx in enumerate(ctxs): | |
1080 | # Parse commit message and update related fields. |
|
1093 | # Parse commit message and update related fields. | |
1081 | desc = _ctx.description() |
|
1094 | desc = _ctx.description() | |
1082 | info = callconduit( |
|
1095 | info = callconduit( | |
@@ -1111,7 +1124,11 b' def createdifferentialrevision(' | |||||
1111 |
|
1124 | |||
1112 | revision = callconduit(repo.ui, b'differential.revision.edit', params) |
|
1125 | revision = callconduit(repo.ui, b'differential.revision.edit', params) | |
1113 | if not revision: |
|
1126 | if not revision: | |
1114 | raise error.Abort(_(b'cannot create revision for %s') % ctx) |
|
1127 | if len(ctxs) == 1: | |
|
1128 | msg = _(b'cannot create revision for %s') % ctx | |||
|
1129 | else: | |||
|
1130 | msg = _(b'cannot create revision for %s::%s') % (basectx, ctx) | |||
|
1131 | raise error.Abort(msg) | |||
1115 |
|
1132 | |||
1116 | return revision, diff |
|
1133 | return revision, diff | |
1117 |
|
1134 | |||
@@ -1226,12 +1243,14 b' def phabsend(ui, repo, *revs, **opts):' | |||||
1226 |
|
1243 | |||
1227 | # Get Differential Revision ID |
|
1244 | # Get Differential Revision ID | |
1228 | oldnode, olddiff, revid = oldmap.get(ctx.node(), (None, None, None)) |
|
1245 | oldnode, olddiff, revid = oldmap.get(ctx.node(), (None, None, None)) | |
|
1246 | oldbasenode = oldnode | |||
1229 | if oldnode != ctx.node() or opts.get(b'amend'): |
|
1247 | if oldnode != ctx.node() or opts.get(b'amend'): | |
1230 | # Create or update Differential Revision |
|
1248 | # Create or update Differential Revision | |
1231 | revision, diff = createdifferentialrevision( |
|
1249 | revision, diff = createdifferentialrevision( | |
1232 | ctx, |
|
1250 | [ctx], | |
1233 | revid, |
|
1251 | revid, | |
1234 | lastrevphid, |
|
1252 | lastrevphid, | |
|
1253 | oldbasenode, | |||
1235 | oldnode, |
|
1254 | oldnode, | |
1236 | olddiff, |
|
1255 | olddiff, | |
1237 | actions, |
|
1256 | actions, |
General Comments 0
You need to be logged in to leave comments.
Login now